diff options
-rw-r--r-- | .travis.yml | 16 | ||||
-rwxr-xr-x | run_tests.py | 43 |
2 files changed, 38 insertions, 21 deletions
diff --git a/.travis.yml b/.travis.yml index 77deae8..f4b15af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,20 @@ matrix: # On OS X gcc is just a wrapper around clang, so don't waste time testing that - os: osx compiler: gcc + include: + # Test cross builds separately, they do not use the global compiler + - os: linux + compiler: gcc + env: RUN_TESTS_ARGS="--cross=arm" + - os: linux + compiler: gcc + env: RUN_TESTS_ARGS="--cross=arm" MESON_ARGS="--unity=on" + - os: linux + compiler: gcc + env: RUN_TESTS_ARGS="--cross=mingw" + - os: linux + compiler: gcc + env: RUN_TESTS_ARGS="--cross=mingw" MESON_ARGS="--unity=on" before_install: - python ./skip_ci.py --base-branch-env=TRAVIS_BRANCH --is-pull-env=TRAVIS_PULL_REQUEST @@ -51,6 +65,6 @@ script: ci_env=`bash <(curl -s https://codecov.io/env)` docker run $ci_env -v ${PWD}/.coverage:/root/.coverage \ withgit \ - /bin/sh -c "cd /root && mkdir -p tools; wget -c http://nirbheek.in/files/binaries/ninja/linux-amd64/ninja -O /root/tools/ninja; chmod +x /root/tools/ninja; CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX PATH=/root/tools:$PATH MESON_FIXED_NINJA=1 ./run_tests.py -- $MESON_ARGS && chmod -R a+rwX .coverage" + /bin/sh -c "cd /root && mkdir -p tools; wget -c http://nirbheek.in/files/binaries/ninja/linux-amd64/ninja -O /root/tools/ninja; chmod +x /root/tools/ninja; CC=$CC CXX=$CXX OBJC=$CC OBJCXX=$CXX PATH=/root/tools:$PATH MESON_FIXED_NINJA=1 ./run_tests.py $RUN_TESTS_ARGS -- $MESON_ARGS && chmod -R a+rwX .coverage" fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib OBJC=$CC OBJCXX=$CXX PATH=$HOME/tools:/usr/local/opt/qt/bin:$PATH MESON_FIXED_NINJA=1 ./run_tests.py --backend=ninja -- $MESON_ARGS ; fi diff --git a/run_tests.py b/run_tests.py index da02a9b..1fd72b2 100755 --- a/run_tests.py +++ b/run_tests.py @@ -158,9 +158,6 @@ def get_fake_options(prefix): def should_run_linux_cross_tests(): return shutil.which('arm-linux-gnueabihf-gcc') and not platform.machine().lower().startswith('arm') -def should_run_mingw_cross_tests(): - return shutil.which('x86_64-w64-mingw32-gcc') - def run_configure_inprocess(commandlist): old_stdout = sys.stdout sys.stdout = mystdout = StringIO() @@ -204,13 +201,21 @@ if __name__ == '__main__': returncode = 0 # Iterate over list in reverse order to find the last --backend arg backend = Backend.ninja + cross = False + # FIXME: Convert to argparse for arg in reversed(sys.argv[1:]): if arg.startswith('--backend'): if arg.startswith('--backend=vs'): backend = Backend.vs elif arg == '--backend=xcode': backend = Backend.xcode - break + if arg.startswith('--cross'): + if arg == '--cross=arm': + cross = 'arm' + elif arg == '--cross=mingw': + cross = 'mingw' + else: + raise RuntimeError('Unknown cross tests selected') # Running on a developer machine? Be nice! if not mesonlib.is_windows() and not mesonlib.is_haiku() and 'TRAVIS' not in os.environ: os.nice(20) @@ -242,20 +247,18 @@ if __name__ == '__main__': 'coverage.process_startup()\n') env['COVERAGE_PROCESS_START'] = '.coveragerc' env['PYTHONPATH'] = os.pathsep.join([td] + env.get('PYTHONPATH', [])) - # Meson command tests - returncode += subprocess.call(mesonlib.python_command + ['run_meson_command_tests.py', '-v'], env=env) - # Unit tests - returncode += subprocess.call(mesonlib.python_command + ['run_unittests.py', '-v'], env=env) - # Ubuntu packages do not have a binary without -6 suffix. - cross_test_args = mesonlib.python_command + ['run_cross_test.py'] - if should_run_linux_cross_tests(): - print(mlog.bold('Running armhf cross tests.').get_text(mlog.colorize_console)) - print() - returncode += subprocess.call(cross_test_args + ['cross/ubuntu-armhf.txt'], env=env) - if should_run_mingw_cross_tests(): - print(mlog.bold('Running mingw-w64 64-bit cross tests.').get_text(mlog.colorize_console)) - print() - returncode += subprocess.call(cross_test_args + ['cross/linux-mingw-w64-64bit.txt'], env=env) - # Project tests - returncode += subprocess.call(mesonlib.python_command + ['run_project_tests.py'] + sys.argv[1:], env=env) + if not cross: + returncode += subprocess.call(mesonlib.python_command + ['run_meson_command_tests.py', '-v'], env=env) + returncode += subprocess.call(mesonlib.python_command + ['run_unittests.py', '-v'], env=env) + returncode += subprocess.call(mesonlib.python_command + ['run_project_tests.py'] + sys.argv[1:], env=env) + else: + cross_test_args = mesonlib.python_command + ['run_cross_test.py'] + if cross == 'arm': + print(mlog.bold('Running armhf cross tests.').get_text(mlog.colorize_console)) + print() + returncode += subprocess.call(cross_test_args + ['cross/ubuntu-armhf.txt'], env=env) + elif cross == 'mingw': + print(mlog.bold('Running mingw-w64 64-bit cross tests.').get_text(mlog.colorize_console)) + print() + returncode += subprocess.call(cross_test_args + ['cross/linux-mingw-w64-64bit.txt'], env=env) sys.exit(returncode) |