diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-04-28 01:36:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-28 01:36:44 +0300 |
commit | 34e7e8780c0196313be8700f504ec84fd6cba3d1 (patch) | |
tree | a93fa9cb431f518bd9b1edb0191b1a839d03bd9b /run_unittests.py | |
parent | 7c68fe80083fd72a100998578417b223e3704af5 (diff) | |
parent | 97f7e3d83cdafbd94d4a164582ea71035c996baa (diff) | |
download | meson-34e7e8780c0196313be8700f504ec84fd6cba3d1.zip meson-34e7e8780c0196313be8700f504ec84fd6cba3d1.tar.gz meson-34e7e8780c0196313be8700f504ec84fd6cba3d1.tar.bz2 |
Merge pull request #7018 from dcbaker/junit
mtest: Generate JUnit results for tests
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 831e53f..da898a3 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4617,6 +4617,31 @@ recommended as it is not supported on some platforms''') out = self.build() self.assertNotIn('Project configured', out) + def _test_junit(self, case: str) -> None: + try: + import lxml.etree as et + except ImportError: + raise unittest.SkipTest('lxml required, but not found.') + + schema = et.XMLSchema(et.parse(str(Path(__file__).parent / 'data' / 'schema.xsd'))) + + testdir = os.path.join(self.common_test_dir, case) + self.init(testdir) + self.run_tests() + + junit = et.parse(str(Path(self.builddir) / 'meson-logs' / 'testlog.junit.xml')) + try: + schema.assertValid(junit) + except et.DocumentInvalid as e: + self.fail(e.error_log) + + def test_junit_valid_tap(self): + self._test_junit('213 tap tests') + + def test_junit_valid_exitcode(self): + self._test_junit('44 test args') + + class FailureTests(BasePlatformTests): ''' Tests that test failure conditions. Build files here should be dynamically |