meson.build 2.46 KB
Newer Older
Sebastian Ramacher's avatar
Sebastian Ramacher committed
1
check = dependency('check', required: get_option('tests'))
2 3 4 5 6 7 8 9 10 11
if check.found()
  test_dependencies = [
    declare_dependency(link_with: girara),
    check
  ]

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

  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
12 13
    include_directories: include_directories,
    c_args: defines + flags
14 15
  )

Sebastian Ramacher's avatar
Sebastian Ramacher committed
16 17 18 19 20 21 22 23 24 25
  config = executable('test_config', ['test_config.c', 'tests.c'],
    dependencies: build_dependencies + test_dependencies,
    include_directories: include_directories,
    c_args: defines + flags
  )
  test('config', config,
    timeout: 60*60,
    is_parallel: false
  )

Sebastian Ramacher's avatar
Sebastian Ramacher committed
26
  datastructures = executable('test_datastructures', ['test_datastructures.c', 'tests.c'],
Sebastian Ramacher's avatar
Sebastian Ramacher committed
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
    dependencies: build_dependencies + test_dependencies,
    include_directories: include_directories,
    c_args: defines + flags
  )
  test('datastructures', datastructures,
    timeout: 60*60
  )

  session = executable('test_session', ['test_session.c', 'tests.c'],
    dependencies: build_dependencies + test_dependencies,
    include_directories: include_directories,
    c_args: defines + flags
  )
  test('session', session,
    timeout: 60*60,
    is_parallel: false
  )

  setting = executable('test_setting', ['test_setting.c', 'tests.c'],
    dependencies: build_dependencies + test_dependencies,
    include_directories: include_directories,
    c_args: defines + flags
  )
  test('setting', setting,
    timeout: 60*60,
    is_parallel: false
  )

Sebastian Ramacher's avatar
Sebastian Ramacher committed
55
  template = executable('test_template', ['test_template.c', 'tests.c'],
Sebastian Ramacher's avatar
Sebastian Ramacher committed
56 57 58 59 60 61 62 63
    dependencies: build_dependencies + test_dependencies,
    include_directories: include_directories,
    c_args: defines + flags
  )
  test('template', template,
    timeout: 60*60
  )

Sebastian Ramacher's avatar
Sebastian Ramacher committed
64
  utils = executable('test_utils', ['test_utils.c', 'tests.c'],
65 66
    dependencies: build_dependencies + test_dependencies,
    include_directories: include_directories,
Sebastian Ramacher's avatar
Sebastian Ramacher committed
67
    c_args: defines + flags
68 69 70 71 72
  )

  env = environment()
  env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())
  env.set('HOME', '/home/test')
Sebastian Ramacher's avatar
Sebastian Ramacher committed
73
  test('utils-with-home', utils,
Sebastian Ramacher's avatar
Sebastian Ramacher committed
74
    env: env,
Sebastian Ramacher's avatar
Sebastian Ramacher committed
75
    timeout: 60*60
Sebastian Ramacher's avatar
Sebastian Ramacher committed
76
  )
77

78
  env_bin = find_program('env', required: false, native: true)
79 80 81 82
  if env_bin.found()
    env = environment()
    env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())

Sebastian Ramacher's avatar
Sebastian Ramacher committed
83 84
    test('utils-without-home', env_bin,
      args: ['-u', 'HOME', utils],
Sebastian Ramacher's avatar
Sebastian Ramacher committed
85
      env: env,
Sebastian Ramacher's avatar
Sebastian Ramacher committed
86
      timeout: 60*60
Sebastian Ramacher's avatar
Sebastian Ramacher committed
87
    )
88
  endif
89
endif