From 11f2e07071d062f31a69de531faa0a5d68b1f5bc Mon Sep 17 00:00:00 2001 From: Charles Brunet Date: Fri, 23 Feb 2024 11:40:15 -0500 Subject: Allow using CustomTarget as test executable Fixes #6567 --- .../common/273 customtarget exe for test/generate.py | 14 ++++++++++++++ .../common/273 customtarget exe for test/meson.build | 14 ++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test cases/common/273 customtarget exe for test/generate.py create mode 100644 test cases/common/273 customtarget exe for test/meson.build (limited to 'test cases') diff --git a/test cases/common/273 customtarget exe for test/generate.py b/test cases/common/273 customtarget exe for test/generate.py new file mode 100644 index 000000000..e66f1db70 --- /dev/null +++ b/test cases/common/273 customtarget exe for test/generate.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 + +import os +import sys + +program = '''#!/usr/bin/env python3 + +raise SystemExit({}) +''' + +for i, a in enumerate(sys.argv[1:]): + with open(a, 'w') as f: + print(program.format(i), file=f) + os.chmod(a, 0o755) diff --git a/test cases/common/273 customtarget exe for test/meson.build b/test cases/common/273 customtarget exe for test/meson.build new file mode 100644 index 000000000..089d70dee --- /dev/null +++ b/test cases/common/273 customtarget exe for test/meson.build @@ -0,0 +1,14 @@ +project('test customtarget') + +ct1 = custom_target( + command: ['generate.py', '@OUTPUT@'], + output: 'a.py', +) +ct2 = custom_target( + command: ['generate.py', '@OUTPUT@'], + output: ['b.py', 'c.py'], +) + +test('using_custom_target', ct1) +test('using_custom_target_index', ct2[0]) +test('using_custom_target_index_1', ct2[1], should_fail: true) -- cgit v1.2.3