summaryrefslogtreecommitdiff
path: root/tests/meson.build
blob: 87bf709e9902cfaccfbbbd0121bc9b52d81b64c4 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
test_programs = [
  ['test-utils', executable(
    'test-utils',
    'test-utils.c',
    '../utils.c',
    '../utils.h',
    dependencies : [selinux_dep],
    include_directories : common_include_directories,
  )],
]

executable(
  'try-syscall',
  'try-syscall.c',
  override_options: ['b_sanitize=none'],
)

test_scripts = [
  'test-run.sh',
  'test-seccomp.py',
  'test-specifying-pidns.sh',
  'test-specifying-userns.sh',
]

test_env = environment()
test_env.set('BWRAP', bwrap.full_path())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir() / '..')
test_env.set('G_TEST_SRCDIR', meson.current_source_dir() / '..')

foreach pair : test_programs
  name = pair[0]
  test_program = pair[1]
  if meson.version().version_compare('>=0.50.0')
    test(
      name,
      test_program,
      env : test_env,
      protocol : 'tap',
    )
  else
    test(
      name,
      test_program,
      env : test_env,
    )
  endif
endforeach

foreach test_script : test_scripts
  if test_script.endswith('.py')
    interpreter = python
  else
    interpreter = bash
  endif

  if meson.version().version_compare('>=0.50.0')
    test(
      test_script,
      interpreter,
      args : [files(test_script)],
      env : test_env,
      protocol : 'tap',
    )
  else
    test(
      test_script,
      interpreter,
      args : [files(test_script)],
      env : test_env,
    )
  endif
endforeach