diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-09-20 13:47:18 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-09-20 19:38:42 -0700 |
commit | e049494890c76ab2b74a382dea8f4f1147fe0f25 (patch) | |
tree | 3e4ee1cc0d631601c463cc6f195025192527c35d /mesonbuild/mtest.py | |
parent | 173a40be330c1aedec9f7f99ebca67a5edd25c3d (diff) | |
download | meson-e049494890c76ab2b74a382dea8f4f1147fe0f25.zip meson-e049494890c76ab2b74a382dea8f4f1147fe0f25.tar.gz meson-e049494890c76ab2b74a382dea8f4f1147fe0f25.tar.bz2 |
mtest: Allow gtest protocol test to fail more gracefully
Currently, if the test fails to produce XML (or valid XML) then the test
fails with a backtrace. It's actually pretty easy to get into this
situation, a total failure of the test will result in no XML being
written (this can happen, for example, if rpaths to gtest are not
correctly set up). If we can't read the test, go ahead and complete
using `TestRunExitCode.complete()`, which will fail for the bad exit
code.
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r-- | mesonbuild/mtest.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 4c1d00e..fd175ba 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -990,7 +990,14 @@ class TestRunGTest(TestRunExitCode): if self.test.workdir: filename = os.path.join(self.test.workdir, filename) - self.junit = et.parse(filename) + try: + self.junit = et.parse(filename) + except FileNotFoundError: + # This can happen if the test fails to run or complete for some + # reason, like the rpath for libgtest isn't properly set. ExitCode + # will handle the failure, don't generate a stacktrace. + pass + super().complete(returncode, res, stdo, stde) TestRun.PROTOCOL_TO_CLASS[TestProtocol.GTEST] = TestRunGTest |