summaryrefslogtreecommitdiffstats
path: root/test cases/failing/124 subproject sandbox violation/meson.build
blob: d41994c46a103d5dd8e63d05c0b8fa7469465305 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
project('subproject-sandbox-violation')

sub1_d = subproject('subproj1').get_variable('d')
sub1_mustfail = sub1_d.get_variable('dir') / '..' / 'file.txt'

sub2_d = subproject('subproj2').get_variable('d')
sub2_mustfail = sub2_d.get_variable('dir') / 'file.txt'

main_d = declare_dependency(
    variables: [
        'dir=@0@'.format(meson.current_source_dir()),
    ]
)
main_mustfail = main_d.get_variable('dir') / 'subprojects/subproj3/file.txt'

if get_option('failmode') == 'parent-dir'
    mustfail = sub1_mustfail
elif get_option('failmode') == 'not-installed'
    mustfail = sub2_mustfail
elif get_option('failmode') == 'root-subdir'
    mustfail = main_mustfail
endif

custom_target(
    'mustfail',
    input: mustfail,
    output: 'file.txt',
    command: [
        'python3', '-c',
        'import os; shutil.copy(sys.argv[1], sys.argv[2])',
        '@INPUT@',
        '@OUTPUT@'
    ],
)