summaryrefslogtreecommitdiff
path: root/tests/meson.build
blob: c7467781a8a7b928e1092d1789a4b948eb263c81 (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
tests = []

subdir('common')

subdir('gvdb')
subdir('libtracker-common')
subdir('libtracker-data')

if enable_fts
  subdir('libtracker-fts')
endif

subdir('libtracker-miner')
subdir('libtracker-sparql')
subdir('tracker-steroids')

if get_option('functional_tests')
  subdir('functional-tests')
endif

subdir('services')

test_bus_conf_file = configure_file(
  input: 'test-bus.conf.in',
  output: 'test-bus.conf',
  configuration: conf)

foreach t: tests
  test_name = t.get('name')
  test_exe = t.get('exe')
  test_suite = t.get('suite', [])
  test_timeout = t.get('timeout', 30)

  # This flag marks unit tests which can't run alongside other unit tests. It
  # generally indicates a bug or design flaw in that test.
  test_is_parallel = t.get('is_parallel', true)

  # This flag marks unit tests which need to contact a D-Bus session bus. This
  # is a sign of a bad unit test -- anything which uses D-Bus belongs in the
  # functional-tests directory.
  test_requires_dbus = t.get('requires_dbus', false)

  test_env = environment()
  test_env.set('GSETTINGS_SCHEMA_DIR', join_paths(build_root, 'data'))
  test_env.set('TRACKER_LANGUAGE_STOP_WORDS_DIR', join_paths(source_root, 'src', 'libtracker-common', 'stop-words'))
  test_env.set('TRACKER_TEST_DOMAIN_ONTOLOGY_RULE', join_paths(source_root, 'src', 'tracker-store', 'default.rule'))
  test_env.set('TRACKER_DB_ONTOLOGIES_DIR', join_paths(source_root, 'src', 'ontologies', 'nepomuk'))
  test_env.set('LANG', 'en_US.UTF8')

  if test_requires_dbus
    test(test_name, dbus_run_session,
      env: test_env,
      args: ['--config-file=@0@'.format(join_paths(meson.current_build_dir(), 'test-bus.conf')),
             '--',
             test_exe],
      suite: test_suite,
      timeout: test_timeout,
      is_parallel: test_is_parallel)
  else
    test(test_name, test_exe,
      env: test_env,
      timeout: test_timeout,
      suite: test_suite,
      is_parallel: test_is_parallel)
  endif
endforeach