Debian Codegraph @

vendored-meson/meson/test cases/common/41 test args/meson.build

raw
1 project('test features', 'c')
2
3 e1 = executable('cmd_args', 'cmd_args.c')
4 e2 = executable('envvars', 'envvars.c')
5 e3 = executable('env2vars', 'env2vars.c')
6
7 env = environment()
8 env.set('first', 'val1')
9 env.set('second', 'val2')
10 env.set('third', 'val3', 'and_more', separator: ':')
11 env.append('PATH', 'fakepath', separator: ':')
12
13 # Make sure environment objects are copied on assignment and we can
14 # change the copy without affecting the original environment object.
15 env2 = env
16 env2.set('first', 'something-else')
17
18 test('command line arguments', e1, args : ['first', 'second'])
19 test('environment variables', e2, env : env)
20 test('environment variables 2', e3, env : env2)
21
22 # https://github.com/mesonbuild/meson/issues/2211#issuecomment-327741571
23 env_array = ['MESONTESTING=picklerror']
24 testfile = files('testfile.txt')
25 testerpy = find_program('tester.py')
26 test('file arg', testerpy, args : testfile, env : [env_array, 'TEST_LIST_FLATTENING=1'])
27
28 copy = find_program('copyfile.py')
29 tester = executable('tester', 'tester.c')
30 testfilect = custom_target('testfile',
31 input : testfile,
32 output : 'outfile.txt',
33 build_by_default : true,
34 command : [copy, '@INPUT@', '@OUTPUT@'])
35 test('custom target arg', tester, args : testfilect, env : env_array)
36
37 # https://github.com/mesonbuild/meson/issues/12327
38 env = environment()
39 env.append('PATH', 'something')
40
41 pathtester = find_program('pathtester.py')
42
43 custompathtgt = custom_target('testpathappend',
44 output : 'nothing.txt',
45 build_always : true,
46 command : [pathtester],
47 env : env)
48
49 # https://github.com/mesonbuild/meson/issues/3552
50 wrap = find_program('wrap.py')
51 test('external program arg', wrap, args : [testerpy, testfile])