aboutsummaryrefslogtreecommitdiff
path: root/src/tests/meson.build
blob: a9216c24d97237f696098f4265fd396421816ff6 (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
73
74
75
76
77
78
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2021 Iñigo Martinez <inigomartinez@gmail.com>

test_units = {
  'at-serial-port': libport_dep,
  'cbm-part': libhelpers_dep,
  'charsets': libhelpers_dep,
  'error-helpers': libhelpers_dep,
  'kernel-device-helpers': libkerneldevice_dep,
  'modem-helpers': libhelpers_dep,
  'port-scheduler': libport_dep,
  'sms-part-3gpp': libhelpers_dep,
  'sms-part-cdma': libhelpers_dep,
  'sms-list': libsms_dep,
  'udev-rules': libkerneldevice_dep,
}

deps = [
  libport_dep,
  libqcdm_dep,
  util_dep,
]

test_units += {'qcdm-serial-port': deps}

if enable_qmi
  test_units += {'modem-helpers-qmi': libkerneldevice_dep}
endif

if enable_mbim
  test_units += {'modem-helpers-mbim': libkerneldevice_dep}
endif

c_args = [
  '-DTEST_SERVICES="@0@"'.format(build_root / 'data/tests'),
  '-DTESTUDEVRULESDIR="@0@"'.format(src_dir),
]

foreach test_unit, test_deps: test_units
  test_name = 'test-' + test_unit

  exe = executable(
    test_name,
    sources: test_name + '.c',
    include_directories: top_inc,
    dependencies: test_deps,
    c_args: c_args,
  )

  test(test_name, exe)
endforeach

# base call test
exe = executable(
  'test-base-call',
  sources: [ 'test-base-call.c', 'fake-modem.c', 'fake-call.c' ],
  include_directories: top_inc,
  dependencies: libmmbase_dep,
  c_args: c_args,
)

test('test-base-call', exe)


if get_option('fuzzer')
  fuzzer_tests = ['test-sms-part-3gpp-fuzzer',
                  'test-sms-part-3gpp-tr-fuzzer',
                  'test-sms-part-cdma-fuzzer']
  foreach fuzzer_test: fuzzer_tests
    exe = executable(
      fuzzer_test,
      sources: fuzzer_test + '.c',
      include_directories: top_inc,
      dependencies: libhelpers_dep,
      link_args : '-fsanitize=fuzzer',
    )
  endforeach
endif