aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-12-26 20:56:04 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-01-02 23:52:50 +0200
commitee8a6e6fc5b58b5756f4e01271e77399f2d973bb (patch)
treeb10b93b2b28e1135a3e87b4f127198786e596896 /run_unittests.py
parent776b0d9a5f425d0363b8b71933f990183ca4a281 (diff)
downloadmeson-ee8a6e6fc5b58b5756f4e01271e77399f2d973bb.zip
meson-ee8a6e6fc5b58b5756f4e01271e77399f2d973bb.tar.gz
meson-ee8a6e6fc5b58b5756f4e01271e77399f2d973bb.tar.bz2
Can specify test setups and run them with mesontest.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 179bed6..b7a393c 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -63,6 +63,7 @@ class LinuxlikeTests(unittest.TestCase):
self.meson_command = [sys.executable, os.path.join(src_root, 'meson.py')]
self.mconf_command = [sys.executable, os.path.join(src_root, 'mesonconf.py')]
self.mintro_command = [sys.executable, os.path.join(src_root, 'mesonintrospect.py')]
+ self.mtest_command = [sys.executable, os.path.join(src_root, 'mesontest.py'), '-C', self.builddir]
self.ninja_command = [detect_ninja(), '-C', self.builddir]
self.common_test_dir = os.path.join(src_root, 'test cases/common')
self.vala_test_dir = os.path.join(src_root, 'test cases/vala')
@@ -89,6 +90,9 @@ class LinuxlikeTests(unittest.TestCase):
def build(self):
self._run(self.ninja_command)
+ def run_tests(self):
+ self._run(self.ninja_command + ['test'])
+
def install(self):
os.environ['DESTDIR'] = self.installdir
self._run(self.ninja_command + ['install'])
@@ -387,6 +391,13 @@ class LinuxlikeTests(unittest.TestCase):
meson_exe_dat2 = glob(os.path.join(self.privatedir, 'meson_exe*.dat'))
self.assertListEqual(meson_exe_dat1, meson_exe_dat2)
+ def test_testsetups(self):
+ testdir = os.path.join(self.unit_test_dir, '2 testsetups')
+ self.init(testdir)
+ self.build()
+ self.run_tests()
+ self.assertRaises(subprocess.CalledProcessError,
+ self._run, self.mtest_command + ['--setup=valgrind'])
class RewriterTests(unittest.TestCase):
@@ -446,5 +457,6 @@ class RewriterTests(unittest.TestCase):
self.assertEqual(top, self.read_contents('meson.build'))
self.assertEqual(s2, self.read_contents('sub2/meson.build'))
+
if __name__ == '__main__':
unittest.main()