diff options
-rwxr-xr-x | run_unittests.py | 8 | ||||
-rwxr-xr-x | test cases/common/58 run target/check_exists.py | 7 | ||||
-rw-r--r-- | test cases/common/58 run target/meson.build | 4 |
3 files changed, 17 insertions, 2 deletions
diff --git a/run_unittests.py b/run_unittests.py index cf30276..8df0001 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -73,6 +73,9 @@ class LinuxlikeTests(unittest.TestCase): def build(self): self.output += subprocess.check_output(self.ninja_command) + def run_target(self, target): + self.output += subprocess.check_output(self.ninja_command + [target]) + def setconf(self, arg): self.output += subprocess.check_output(self.mconf_command + [arg, self.builddir]) @@ -173,5 +176,10 @@ class LinuxlikeTests(unittest.TestCase): self.assertEqual(intro[0]['install_filename'], '/usr/local/libtest/libstat.a') self.assertEqual(intro[1]['install_filename'], '/usr/local/bin/prog') + def test_run_target_files_path(self): + testdir = os.path.join(self.common_test_dir, '58 run target') + self.init(testdir) + self.run_target('check_exists') + if __name__ == '__main__': unittest.main() diff --git a/test cases/common/58 run target/check_exists.py b/test cases/common/58 run target/check_exists.py new file mode 100755 index 0000000..62cbe23 --- /dev/null +++ b/test cases/common/58 run target/check_exists.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +import os +import sys + +if not os.path.isfile(sys.argv[1]): + raise Exception("Couldn't find {!r}".format(sys.argv[1])) diff --git a/test cases/common/58 run target/meson.build b/test cases/common/58 run target/meson.build index 5824c74..0540b80 100644 --- a/test cases/common/58 run target/meson.build +++ b/test cases/common/58 run target/meson.build @@ -35,8 +35,8 @@ python3 = find_program('python3') run_target('py3hi', command : [python3, '-c', 'print("I am Python3.")']) -run_target('ct_in_arg', - command : ['echo', hex, files('helloprinter.c')]) +run_target('check_exists', + command : [find_program('check_exists.py'), files('helloprinter.c')]) # What if the output of a custom_target is the command to # execute. Obviously this will not work as hex is not an |