diff options
7 files changed, 54 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index 41cbf39..b69aaae 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -949,6 +949,31 @@ class AllPlatformTests(BasePlatformTests): # Setup with only a timeout works self._run(self.mtest_command + ['--setup=timeout']) + def test_testsetup_selection(self): + testdir = os.path.join(self.unit_test_dir, '13 testsetup selection') + self.init(testdir) + self.build() + + # Run tests without setup + self.run_tests() + + self.assertRaises(subprocess.CalledProcessError, self._run, self.mtest_command + ['--setup=missingfromfoo']) + self._run(self.mtest_command + ['--setup=missingfromfoo', '--no-suite=foo:']) + + self._run(self.mtest_command + ['--setup=worksforall']) + self._run(self.mtest_command + ['--setup=main:worksforall']) + + self.assertRaises(subprocess.CalledProcessError, self._run, + self.mtest_command + ['--setup=onlyinbar']) + self.assertRaises(subprocess.CalledProcessError, self._run, + self.mtest_command + ['--setup=onlyinbar', '--no-suite=main:']) + self._run(self.mtest_command + ['--setup=onlyinbar', '--no-suite=main:', '--no-suite=foo:']) + self._run(self.mtest_command + ['--setup=bar:onlyinbar']) + self.assertRaises(subprocess.CalledProcessError, self._run, + self.mtest_command + ['--setup=foo:onlyinbar']) + self.assertRaises(subprocess.CalledProcessError, self._run, + self.mtest_command + ['--setup=main:onlyinbar']) + def assertFailedTestCount(self, failure_count, command): try: self._run(command) diff --git a/test cases/unit/13 testsetup selection/main.c b/test cases/unit/13 testsetup selection/main.c new file mode 100644 index 0000000..cb3f748 --- /dev/null +++ b/test cases/unit/13 testsetup selection/main.c @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/test cases/unit/13 testsetup selection/meson.build b/test cases/unit/13 testsetup selection/meson.build new file mode 100644 index 0000000..ae996c5 --- /dev/null +++ b/test cases/unit/13 testsetup selection/meson.build @@ -0,0 +1,10 @@ +project('main', 'c') + +main = executable('main', 'main.c') +test('Test main', main) + +add_test_setup('worksforall') +add_test_setup('missingfromfoo') + +subproject('foo') +subproject('bar') diff --git a/test cases/unit/13 testsetup selection/subprojects/bar/bar.c b/test cases/unit/13 testsetup selection/subprojects/bar/bar.c new file mode 100644 index 0000000..cb3f748 --- /dev/null +++ b/test cases/unit/13 testsetup selection/subprojects/bar/bar.c @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/test cases/unit/13 testsetup selection/subprojects/bar/meson.build b/test cases/unit/13 testsetup selection/subprojects/bar/meson.build new file mode 100644 index 0000000..1155a88 --- /dev/null +++ b/test cases/unit/13 testsetup selection/subprojects/bar/meson.build @@ -0,0 +1,6 @@ +project('bar', 'c') +bar = executable('bar', 'bar.c') +test('Test bar', bar) +add_test_setup('onlyinbar') +add_test_setup('worksforall') +add_test_setup('missingfromfoo') diff --git a/test cases/unit/13 testsetup selection/subprojects/foo/foo.c b/test cases/unit/13 testsetup selection/subprojects/foo/foo.c new file mode 100644 index 0000000..cb3f748 --- /dev/null +++ b/test cases/unit/13 testsetup selection/subprojects/foo/foo.c @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/test cases/unit/13 testsetup selection/subprojects/foo/meson.build b/test cases/unit/13 testsetup selection/subprojects/foo/meson.build new file mode 100644 index 0000000..2eef840 --- /dev/null +++ b/test cases/unit/13 testsetup selection/subprojects/foo/meson.build @@ -0,0 +1,4 @@ +project('foo', 'c') +foo = executable('foo', 'foo.c') +test('Test foo', foo) +add_test_setup('worksforall') |