diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2021-11-13 00:58:23 +0100 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2021-11-25 21:10:18 +0530 |
commit | 9abebfb64986f683dd224d4e9740dd0db0832de7 (patch) | |
tree | af2e720663b90b812ed9dfb2f442e85527f2368f | |
parent | f54d83cf270b9c3e98d7845529c57102505bff1c (diff) | |
download | meson-9abebfb64986f683dd224d4e9740dd0db0832de7.zip meson-9abebfb64986f683dd224d4e9740dd0db0832de7.tar.gz meson-9abebfb64986f683dd224d4e9740dd0db0832de7.tar.bz2 |
interpreter: disallow RunTarget in test
Fixes the following error in the testcase:
File "/usr/lib/python3.10/site-packages/mesonbuild/backend/ninjabackend.py", line 548, in generate
self.generate_tests()
File "/usr/lib/python3.10/site-packages/mesonbuild/backend/ninjabackend.py", line 1093, in generate_tests
self.serialize_tests()
File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 567, in serialize_tests
self.write_test_file(datafile)
File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 943, in write_test_file
self.write_test_serialisation(self.build.get_tests(), datafile)
File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 1017, in write_test_serialisation
pickle.dump(self.create_test_serialisation(tests), datafile)
File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 1002, in create_test_serialisation
cmd_args.append(self.construct_target_rel_path(a, t.workdir))
File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 1021, in construct_target_rel_path
return self.get_target_filename(a)
File "/usr/lib/python3.10/site-packages/mesonbuild/backend/backends.py", line 253, in get_target_filename
assert(isinstance(t, build.BuildTarget))
4 files changed, 19 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 5f3ea04..a0a5c4c 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -192,7 +192,7 @@ known_build_target_kwargs = ( ) TEST_KWARGS: T.List[KwargInfo] = [ - KwargInfo('args', ContainerTypeInfo(list, (str, mesonlib.File, build.Target)), + KwargInfo('args', ContainerTypeInfo(list, (str, mesonlib.File, build.BuildTarget, build.CustomTarget)), listify=True, default=[]), KwargInfo('should_fail', bool, default=False), KwargInfo('timeout', int, default=30), diff --git a/test cases/failing/116 run_target in test/meson.build b/test cases/failing/116 run_target in test/meson.build new file mode 100644 index 0000000..db7cb30 --- /dev/null +++ b/test cases/failing/116 run_target in test/meson.build @@ -0,0 +1,4 @@ +project('trivial test', 'c') +exe = executable('trivialprog', 'trivial.c') +runt = run_target('invalid', command: ['echo', 'run_target']) +test('runtest', exe, args: runt) diff --git a/test cases/failing/116 run_target in test/test.json b/test cases/failing/116 run_target in test/test.json new file mode 100644 index 0000000..c273a3b --- /dev/null +++ b/test cases/failing/116 run_target in test/test.json @@ -0,0 +1,8 @@ +{ + "stdout": [ + { + "line": "test cases/failing/116 run_target in test/meson.build:4:0: ERROR: test keyword argument 'args' was of type 'list' but should have been list[str,File,BuildTarget,CustomTarget]" + } + ] +} + diff --git a/test cases/failing/116 run_target in test/trivial.c b/test cases/failing/116 run_target in test/trivial.c new file mode 100644 index 0000000..96612d4 --- /dev/null +++ b/test cases/failing/116 run_target in test/trivial.c @@ -0,0 +1,6 @@ +#include<stdio.h> + +int main(void) { + printf("Trivial test is working.\n"); + return 0; +} |