diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-07-09 04:02:02 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-07-09 05:39:40 +0530 |
commit | e8dae2b966498207867cb07d58f4404b76c087ce (patch) | |
tree | 5ee7e334660dd3409e9af474861ba43147d0b309 /mesonbuild/mtest.py | |
parent | 416a00308f5b0f228af3c93eb597eca8529fdbb0 (diff) | |
download | meson-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 'mesonbuild/mtest.py')
-rw-r--r-- | mesonbuild/mtest.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 3c4073b..8ebef04 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -240,7 +240,10 @@ class SingleTestRunner: # because there is no execute wrapper. return None else: - return [self.test.exe_runner] + self.test.fname + if not self.test.exe_runner.found(): + msg = 'The exe_wrapper defined in the cross file {!r} was not ' \ + 'found. Please check the command and/or add it to PATH.' + raise TestException(msg.format(self.test.exe_runner.name)) return self.test.exe_runner.get_command() + self.test.fname else: return self.test.fname @@ -738,12 +741,13 @@ def run(args): if check_bin is not None: exe = ExternalProgram(check_bin, silent=True) if not exe.found(): - sys.exit('Could not find requested program: %s' % check_bin) + print('Could not find requested program: {!r}'.format(check_bin)) + return 1 options.wd = os.path.abspath(options.wd) if not options.list and not options.no_rebuild: if not rebuild_all(options.wd): - sys.exit(-1) + return 1 try: th = TestHarness(options) @@ -755,5 +759,8 @@ def run(args): return th.run_special() except TestException as e: print('Meson test encountered an error:\n') - print(e) + if os.environ.get('MESON_FORCE_BACKTRACE'): + raise e + else: + print(e) return 1 |