meson.build 1.28 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
check = dependency('check', required: false)
if check.found()
  test_dependencies = [
    declare_dependency(link_with: girara),
    check
  ]

  include_directories += [ include_directories('../girara') ]

  test_sources = [
    'tests.c',
    'test_config.c',
    'test_datastructures.c',
    'test_session.c',
    'test_setting.c',
    'test_template.c',
    'test_utils.c'
  ]

  xdg_test_helper = executable('xdg_test_helper', 'xdg_test_helper.c',
    dependencies: [ glib, declare_dependency(link_with: girara) ],
Sebastian Ramacher's avatar
Sebastian Ramacher committed
22 23
    include_directories: include_directories,
    c_args: defines + flags
24 25 26 27 28
  )

  tests = executable('tests', test_sources,
    dependencies: build_dependencies + test_dependencies,
    include_directories: include_directories,
Sebastian Ramacher's avatar
Sebastian Ramacher committed
29
    c_args: defines + flags
30 31 32 33 34
  )

  env = environment()
  env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())
  env.set('HOME', '/home/test')
Sebastian Ramacher's avatar
Sebastian Ramacher committed
35 36
  test('tests-with-home', tests,
    env: env,
37 38
    timeout: 60*60,
    is_parallel: false
Sebastian Ramacher's avatar
Sebastian Ramacher committed
39
  )
40

41 42 43 44 45 46 47
  env_bin = find_program('env', required: false)
  if env_bin.found()
    env = environment()
    env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())

    test('tests-without-home', env_bin,
      args: ['-u', 'HOME', tests],
Sebastian Ramacher's avatar
Sebastian Ramacher committed
48
      env: env,
49 50
      timeout: 60*60,
      is_parallel: false
Sebastian Ramacher's avatar
Sebastian Ramacher committed
51
    )
52
  endif
53
endif