summaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-10-31 15:49:49 +0100
committerDylan Baker <dylan@pnwbakers.com>2025-11-03 08:47:12 -0800
commit0514719b3cfadf0c80d10dc6652154c7c2a86bce (patch)
tree80694e7b71d62590b53c71260132d22b4eb60a9a /test cases
parentd00f840c573103c2d51aed2b169386f7acfe7026 (diff)
downloadmeson-0514719b3cfadf0c80d10dc6652154c7c2a86bce.tar.gz
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 <pbonzini@redhat.com>
Diffstat (limited to 'test cases')
-rw-r--r--test cases/unit/131 custom target index test/meson.build16
1 files changed, 16 insertions, 0 deletions
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'])