summaryrefslogtreecommitdiff
path: root/src/libmbim-glib/test/meson.build
blob: 196be6403738d589a77ea454de639be95fac0ec5 (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
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2021 IƱigo Martinez <inigomartinez@gmail.com>

test_units = [
  'uuid',
  'cid',
  'message',
  'fragment',
  'message-parser',
  'message-builder',
  'proxy-helpers',
]

test_env = {
  'G_DEBUG': 'gc-friendly',
  'MALLOC_CHECK_': '2',
  'G_TEST_SRCDIR': meson.current_source_dir(),
  'G_TEST_BUILDDIR': meson.current_build_dir(),
}

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

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

  test(
    test_unit,
    exe,
    env: test_env,
  )
endforeach

if get_option('fuzzer')
  fuzzer_name = 'test-message-fuzzer'
  exe = executable(
    fuzzer_name,
    sources: fuzzer_name + '.c',
    include_directories: top_inc,
    dependencies: libmbim_glib_core_dep,
    c_args: '-DLIBMBIM_GLIB_COMPILATION',
    link_args : '-fsanitize=fuzzer',
  )
endif