aboutsummaryrefslogtreecommitdiff
path: root/run_tests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-07-09 04:02:02 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-07-09 05:39:40 +0530
commite8dae2b966498207867cb07d58f4404b76c087ce (patch)
tree5ee7e334660dd3409e9af474861ba43147d0b309 /run_tests.py
parent416a00308f5b0f228af3c93eb597eca8529fdbb0 (diff)
downloadmeson-e8dae2b966498207867cb07d58f4404b76c087ce.zip
meson-e8dae2b966498207867cb07d58f4404b76c087ce.tar.gz
meson-e8dae2b966498207867cb07d58f4404b76c087ce.tar.bz2
cross: Be more permissive about not-found exe_wrapper
We used to immediately try to use whatever exe_wrapper was defined in the cross file, but some people generate the cross file once and use it for several projects, most of which do not even need an exe wrapper to build. Now we're a bit more resilient. We quietly fall back to using non-exe-wrapper paths for compiler checks and skip the sanity check. However, if some code needs the exe wrapper, f.ex., if you run a built executable using custom_target() or run_target(), we will error out during setup. Tests will, of course, continue to error out when you run them if the exe wrapper was not found. We don't want people's tests to silently "pass" (aka skip) because of a bad CI setup. Closes https://github.com/mesonbuild/meson/issues/3562 This commit also adds a test for the behaviour of exe_wrapper in these cases, and refactors the unit tests a bit for it.
Diffstat (limited to 'run_tests.py')
-rwxr-xr-xrun_tests.py34
1 files changed, 25 insertions, 9 deletions
diff --git a/run_tests.py b/run_tests.py
index af20ba2..6e441d3 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -29,6 +29,7 @@ from pathlib import Path
import mesonbuild
from mesonbuild import mesonlib
from mesonbuild import mesonmain
+from mesonbuild import mtest
from mesonbuild import mlog
from mesonbuild.environment import detect_ninja
@@ -156,8 +157,17 @@ def get_fake_options(prefix):
opts.cmd_line_options = {}
return opts
-def should_run_linux_cross_tests():
- return shutil.which('arm-linux-gnueabihf-gcc') and not platform.machine().lower().startswith('arm')
+def run_mtest_inprocess(commandlist):
+ old_stdout = sys.stdout
+ sys.stdout = mystdout = StringIO()
+ old_stderr = sys.stderr
+ sys.stderr = mystderr = StringIO()
+ try:
+ returncode = mtest.run(commandlist)
+ finally:
+ sys.stdout = old_stdout
+ sys.stderr = old_stderr
+ return returncode, mystdout.getvalue(), mystderr.getvalue()
def run_configure_inprocess(commandlist):
old_stdout = sys.stdout
@@ -203,7 +213,7 @@ if __name__ == '__main__':
# Iterate over list in reverse order to find the last --backend arg
backend = Backend.ninja
cross = False
- # FIXME: Convert to argparse
+ # FIXME: PLEASE convert to argparse
for arg in reversed(sys.argv[1:]):
if arg.startswith('--backend'):
if arg.startswith('--backend=vs'):
@@ -212,6 +222,10 @@ if __name__ == '__main__':
backend = Backend.xcode
if arg.startswith('--cross'):
cross = True
+ if arg == '--cross=mingw':
+ cross = 'mingw'
+ elif arg == '--cross=arm':
+ cross = 'arm'
# 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)
@@ -249,10 +263,12 @@ if __name__ == '__main__':
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']
- 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)
- 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)
+ if cross is True or 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)
+ if cross is True or 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)