summaryrefslogtreecommitdiffstats
path: root/tests/meson.build
blob: 1647b30f1abedc8589cf648c3434aff6b43e9e5a (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
# tests
# SPDX-License-Identifier: GPL-3.0-or-later

## unit tests
build_unit_tests = false
if get_option('unit_tests') != 'disabled'
  message('--- unit_tests dependencies ---')
  cmocka = dependency('cmocka', required: get_option('unit_tests') == 'enabled')
  if cmocka.found()
    build_unit_tests = true
    subdir('unit')
  endif
  message('-------------------------------')
endif

build_extra_tests = get_option('extra_tests') == 'enabled'
build_config_tests = get_option('config_tests') == 'enabled'
if get_option('config_tests') == 'auto'
  build_config_tests = build_extra_tests
endif

## config tests
if build_config_tests
  message('--- config_tests dependencies ---')
  cqueues = run_command('luajit', '-l', 'cqueues', '-e', 'os.exit(0)')  # luajit -l $(1) -e "os.exit(0)"
  if cqueues.returncode() != 0
    error('missing luajit package: cqueues')
  endif
  basexx = run_command('luajit', '-l', 'basexx', '-e', 'os.exit(0)')  # luajit -l $(1) -e "os.exit(0)"
  if basexx.returncode() != 0
    error('missing luajit package: basexx')
  endif
  ffi = run_command('luajit', '-l', 'ffi', '-e', 'os.exit(0)')  # luajit -l $(1) -e "os.exit(0)"
  if ffi.returncode() != 0
    error('missing luajit package: ffi')
  endif
  message('---------------------------------')

  subdir('config')
endif

## extra tests
if build_extra_tests
  message('--- extra_tests dependencies ---')
  python3 = find_program('python3')
  py3_deps = []

  subdir('pytests')
  subdir('integration')
  if build_dnstap
    subdir('dnstap')
  endif

  foreach py3_dep : py3_deps
    py3_import = run_command(python3, '-c', 'import @0@'.format(py3_dep[0]))
    if py3_import.returncode() != 0
      error('missing python3 dependency: @0@'.format(py3_dep[1]))
    endif
  endforeach
  message('--------------------------------')
endif