From 0514719b3cfadf0c80d10dc6652154c7c2a86bce Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 31 Oct 2025 15:49:49 +0100 Subject: backends: add CustomTargetIndexes to meson-{test,benchmark}-prereq If a CustomTargetIndex is passed as an argument to a test, running meson test (with no test glob) does not automatically build the custom_target before running the test, because CustomTargetIndex outputs are not added as prerequisites to the meson-test-prereq and meson-benchmark-prereq targets. Fixes: #14743 Signed-off-by: Paolo Bonzini --- test cases/unit/131 custom target index test/meson.build | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test cases/unit/131 custom target index test/meson.build (limited to 'test cases') diff --git a/test cases/unit/131 custom target index test/meson.build b/test cases/unit/131 custom target index test/meson.build new file mode 100644 index 000000000..adbbb4df4 --- /dev/null +++ b/test cases/unit/131 custom target index test/meson.build @@ -0,0 +1,16 @@ +# testcase by blue42u +project('test') +python3 = find_program('python3') + +gen_code = ''' +import sys, pathlib +pathlib.Path(sys.argv[1]).write_text("foo") +pathlib.Path(sys.argv[2]).write_text("bar")''' +foobar_txt = custom_target(command: [python3, '-c', gen_code, '@OUTPUT@'], output: ['foo.txt', 'bar.txt']) + +test_code = ''' +import sys, pathlib +sys.exit(0 if pathlib.Path(sys.argv[1]).read_text() == sys.argv[2] else 4)''' + +test('foo.txt', python3, args: ['-c', test_code, foobar_txt[0], 'foo']) +test('bar.txt', python3, args: ['-c', test_code, foobar_txt[1], 'bar']) -- cgit v1.2.3