aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/216 custom target input extracted objects/check_object.py16
-rw-r--r--test cases/common/216 custom target input extracted objects/libdir/gen.py6
-rw-r--r--test cases/common/216 custom target input extracted objects/libdir/meson.build22
-rw-r--r--test cases/common/216 custom target input extracted objects/meson.build32
4 files changed, 68 insertions, 8 deletions
diff --git a/test cases/common/216 custom target input extracted objects/check_object.py b/test cases/common/216 custom target input extracted objects/check_object.py
index bafcf2c..d521b43 100644
--- a/test cases/common/216 custom target input extracted objects/check_object.py
+++ b/test cases/common/216 custom target input extracted objects/check_object.py
@@ -3,11 +3,15 @@
import sys, os
if __name__ == '__main__':
- if len(sys.argv) != 3:
- print(sys.argv[0], 'object', 'output')
+ if len(sys.argv) < 4:
+ print(sys.argv[0], 'n output objects...')
sys.exit(1)
- elif os.path.exists(sys.argv[1]):
- with open(sys.argv[2], 'wb') as out:
- pass
- else:
+ if len(sys.argv) != int(sys.argv[1]) + 3:
+ print(f'expected {sys.argv[1]} objects, got {len(sys.argv) - 3}')
sys.exit(1)
+ for i in sys.argv[3:]:
+ print('testing', i)
+ if not os.path.exists(i):
+ sys.exit(1)
+ with open(sys.argv[2], 'wb') as out:
+ pass
diff --git a/test cases/common/216 custom target input extracted objects/libdir/gen.py b/test cases/common/216 custom target input extracted objects/libdir/gen.py
new file mode 100644
index 0000000..095fffd
--- /dev/null
+++ b/test cases/common/216 custom target input extracted objects/libdir/gen.py
@@ -0,0 +1,6 @@
+#! /usr/bin/env python3
+import sys
+with open(sys.argv[1], 'r') as f:
+ for l in f:
+ l = l.rstrip()
+ print(l.replace(sys.argv[2], sys.argv[3]))
diff --git a/test cases/common/216 custom target input extracted objects/libdir/meson.build b/test cases/common/216 custom target input extracted objects/libdir/meson.build
index 7f83311..93a7bcc 100644
--- a/test cases/common/216 custom target input extracted objects/libdir/meson.build
+++ b/test cases/common/216 custom target input extracted objects/libdir/meson.build
@@ -1 +1,21 @@
-objlib = static_library('object', 'source.c', override_options : ['unity=off'])
+gen_py = find_program('gen.py')
+ctsrc = custom_target('custom_target sources',
+ output: 'ct-source.c',
+ input: 'source.c',
+ command: [ gen_py, '@INPUT@', 'func1', 'func2' ], capture: true)
+
+gen = generator(gen_py, arguments: ['@INPUT@', 'func1', 'func3'],
+ output: 'gen-@PLAINNAME@',
+ capture: true)
+gensrc = gen.process('source.c')
+
+
+gen = generator(gen_py, arguments: ['@INPUT@', 'func1', 'func4'],
+ output: 'gen-@PLAINNAME@',
+ capture: true)
+sublibsrc = gen.process('source.c')
+subobjlib = static_library('subobject', sublibsrc)
+
+objlib = static_library('object', 'source.c', ctsrc, gensrc,
+ objects: subobjlib.extract_all_objects(recursive: false),
+ override_options : ['unity=off'])
diff --git a/test cases/common/216 custom target input extracted objects/meson.build b/test cases/common/216 custom target input extracted objects/meson.build
index 8f8b22f..654b76d 100644
--- a/test cases/common/216 custom target input extracted objects/meson.build
+++ b/test cases/common/216 custom target input extracted objects/meson.build
@@ -14,5 +14,35 @@ subdir('libdir')
custom_target('check',
input: objlib.extract_objects('source.c'),
output: 'objcheck',
- command: [checker, '@INPUT@', '@OUTPUT@'],
+ command: [checker, '1', '@OUTPUT@', '@INPUT@'],
+ build_by_default: true)
+
+custom_target('checkct',
+ input: objlib.extract_objects(ctsrc),
+ output: 'objcheck-ct',
+ command: [checker, '1', '@OUTPUT@', '@INPUT@'],
+ build_by_default: true)
+
+custom_target('checkcti',
+ input: objlib.extract_objects(ctsrc[0]),
+ output: 'objcheck-cti',
+ command: [checker, '1', '@OUTPUT@', '@INPUT@'],
+ build_by_default: true)
+
+custom_target('checkgen',
+ input: objlib.extract_objects(gensrc),
+ output: 'objcheck-gen',
+ command: [checker, '1', '@OUTPUT@', '@INPUT@'],
+ build_by_default: true)
+
+custom_target('checkall',
+ input: objlib.extract_all_objects(recursive: false),
+ output: 'objcheck-all',
+ command: [checker, '3', '@OUTPUT@', '@INPUT@'],
+ build_by_default: true)
+
+custom_target('checkall-recursive',
+ input: objlib.extract_all_objects(recursive: true),
+ output: 'objcheck-all-recursive',
+ command: [checker, '4', '@OUTPUT@', '@INPUT@'],
build_by_default: true)