add testcase for previous commit

pull/10493/head
Paolo Bonzini 3 years ago committed by Dylan Baker
parent e4a8f4dbd6
commit e559ea0b7c
  1. 16
      test cases/common/216 custom target input extracted objects/check_object.py
  2. 6
      test cases/common/216 custom target input extracted objects/libdir/gen.py
  3. 22
      test cases/common/216 custom target input extracted objects/libdir/meson.build
  4. 32
      test cases/common/216 custom target input extracted objects/meson.build

@ -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

@ -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]))

@ -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'])

@ -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)

Loading…
Cancel
Save