Skip to content

Commit 4c33c5e

Browse files
afiestasprobonopd
authored andcommitted
Make running the tests like in travis-ci easier (probonopd#92)
* Move testing logic from travis.yml to tests-ci.sh script This way we can share this logic between travis CI and other systems like for example a docker container. * Move logic to create a testing environment to tests-environment.sh As with the logic to execute the tests, this way we can share this logic with other systems to tests linuxdeployqt. * Install Qt also in tests-environment.sh No reason to keep it separate from the rest as far as I know * Wait until the X server is up and running Otherwise we get into a racy situation. * Add Dockerfile to create a testing container This container tries to emulate the environment we have in travis-ci, this way we can test whatever is failing on the CI locally.
1 parent 585f487 commit 4c33c5e

File tree

4 files changed

+66
-30
lines changed

4 files changed

+66
-30
lines changed

Diff for: .travis.yml

+2-30
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,10 @@ env:
99
- DISPLAY=:99
1010

1111
before_install:
12-
- sudo add-apt-repository --yes ppa:beineri/opt-qt58-trusty
13-
- sudo apt-get update -qq
14-
- git clone https://github.com/NixOS/patchelf.git
15-
- cd patchelf
16-
- bash ./bootstrap.sh
17-
- ./configure
18-
- make -j2
19-
- sudo make install
20-
- cd -
21-
- sudo wget -c "https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool
22-
- sudo chmod a+x /usr/local/bin/appimagetool
23-
24-
install:
25-
- sudo apt-get -y install qt58base qt58declarative qt58webengine binutils xpra
12+
- ./tests/tests-environment.sh
2613

2714
script:
28-
- source /opt/qt*/bin/qt*-env.sh
29-
- /opt/qt*/bin/qmake linuxdeployqt.pro
30-
31-
- make -j2
32-
33-
- mkdir -p linuxdeployqt.AppDir/usr/bin/
34-
- cp /usr/local/bin/patchelf linuxdeployqt.AppDir/usr/bin/
35-
- cp /usr/local/bin/appimagetool linuxdeployqt.AppDir/usr/bin/
36-
- find linuxdeployqt.AppDir/
37-
- export VERSION=continuous
38-
- cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/
39-
- ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt.desktop -verbose=3 -appimage
40-
- ls -lh
41-
- find *.AppDir
42-
- xpra start :99
43-
- bash -e tests/tests.sh
15+
- ./tests/tests-ci.sh
4416

4517
after_success:
4618
- wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh

Diff for: Dockerfile

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This container amins to offer a testing environment similar to the one we are
2+
# creating in travis-ci so we can easily reproduce issues detected on our CI
3+
# locally
4+
#
5+
# To use it, simply execute the container like this:
6+
# docker run --rm -ti --privileged -v /path/to/linuxdeployqt:/linuxdeployqt bash
7+
# and then execute tests/tests-ci.sh
8+
9+
FROM ubuntu:trusty
10+
11+
RUN apt-get update && apt-get -y install software-properties-common wget build-essential \
12+
autoconf git fuse libgl1-mesa-dev psmisc
13+
14+
COPY tests/tests-environment.sh /
15+
16+
RUN /tests-environment.sh

Diff for: tests/tests-ci.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
set -x
4+
5+
source /opt/qt*/bin/qt*-env.sh
6+
/opt/qt*/bin/qmake linuxdeployqt.pro
7+
make -j2
8+
9+
mkdir -p linuxdeployqt.AppDir/usr/bin/
10+
cp /usr/local/bin/patchelf linuxdeployqt.AppDir/usr/bin/
11+
cp /usr/local/bin/appimagetool linuxdeployqt.AppDir/usr/bin/
12+
find linuxdeployqt.AppDir/
13+
export VERSION=continuous
14+
cp ./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/usr/bin/
15+
./linuxdeployqt/linuxdeployqt linuxdeployqt.AppDir/linuxdeployqt.desktop -verbose=3 -appimage
16+
ls -lh
17+
find *.AppDir
18+
xpra start :99
19+
20+
export DISPLAY=:99
21+
22+
until xset -q
23+
do
24+
echo "Waiting for X server to start..."
25+
sleep 1;
26+
done
27+
28+
bash -e tests/tests.sh

Diff for: tests/tests-environment.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
sudo add-apt-repository --yes ppa:beineri/opt-qt58-trusty
6+
sudo apt-get update -qq
7+
8+
git clone https://github.com/NixOS/patchelf.git
9+
cd patchelf
10+
bash ./bootstrap.sh
11+
./configure
12+
make -j2
13+
sudo make install
14+
15+
cd -
16+
17+
sudo wget -c "https://github.com/probonopd/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O /usr/local/bin/appimagetool
18+
sudo chmod a+x /usr/local/bin/appimagetool
19+
20+
sudo apt-get -y install qt58base qt58declarative qt58webengine binutils xpra

0 commit comments

Comments
 (0)