summaryrefslogtreecommitdiff
path: root/tests/meson.build
blob: 6ebebe370e5015e505219e0c8e5c94ddcc8e3509 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#################
# Tests Library #
#################

sources = files(
  'dummy-provider.c',
)

tests_incs = [
  include_directories('../src'),
  include_directories('.'),
  incs,
]

libgtd_tests = static_library(
           'gtd_tests',
              sources : sources,
  include_directories : tests_incs,
         dependencies : endeavour_deps,
               c_args : cflags,
)

tests_libs = [
  libgtd,
  libgtd_tests,
]


################
# Static tests #
################

static_test_env = [
  'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
  'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
  'G_DEBUG=gc-friendly',
  'GSETTINGS_BACKEND=memory',
  'GSETTINGS_SCHEMA_DIR=@0@'.format(join_paths(meson.project_build_root(),'data')),
  'PYTHONDONTWRITEBYTECODE=yes',
  'MALLOC_CHECK_=2',
  'MALLOC_PERTURB_=$((${RANDOM:-256} % 256))',
]

static_test_cflags = [
  '-DTEST_DATA_DIR="@0@/data"'.format(meson.current_source_dir()),
]

static_tests = [
  'test-model-filter',
  'test-model-sort',
  'test-task-list',
  'test-task-model',
]

foreach static_test : static_tests

  source = ['@0@.c'.format(static_test)]

  static_test_program = executable(
              static_test,
                   source,
                  c_args : static_test_cflags,
            dependencies : endeavour_deps,
                     pie : true,
               link_with : tests_libs,
     include_directories : tests_incs,
  )

  test(static_test, static_test_program, env: static_test_env)
endforeach



#####################
# Interactive tests #
#####################

interactive_tests = [
  'test-animation',
  'test-colorbutton',
  'test-filter-sort',
  'test-star-widget',
  'test-task-model',
  'test-widget',
]

foreach interactive_test : interactive_tests

  interactive_test_name = 'interactive-@0@'.format(interactive_test)

  source = ['interactive/@0@.c'.format(interactive_test)]

  interactive_test_program = executable(
  interactive_test_name,
                 source,
   include_directories: tests_incs,
          dependencies: endeavour_deps,
                c_args: cflags,
             link_with: tests_libs,
  )
endforeach