summaryrefslogtreecommitdiff
path: root/gdata/tests/meson.build
blob: 22648ea8b323fe6cc5a0915746f6e9fc8d55f3e1 (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
102
tests_execdir = gdata_libexecdir / 'installed-tests' / gdata_name
tests_metadir = gdata_datadir / 'installed-tests' / gdata_name

tests_sources = files(
  'common.c',
  'gdata-dummy-authorizer.c',
)

common_deps = [
  libgdata_dep,
  libuhttpmock_dep,
]

# The empty objects may be used in future for keeping custom
# arguments for each test
tests = {
  'authorization': {},
  'buffer': {},
  'calendar': {},
  'contacts': {},
  'documents': {
    'dependencies': [gdk_pixbuf_dep],
    'should_fail': true,
  },
  'general': {},
  'oauth2-authorizer': {},
  'perf': {},
  'picasaweb': {
    'dependencies': [gdk_pixbuf_dep],
    'should_fail': true,
  },
  'streams': {},
  'tasks': {},
  'youtube': {},
}

test_env = environment()
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())

foreach test_name, extra_args: tests
  should_fail = extra_args.get('should_fail', false)
  exe = executable(
    test_name,
    test_name + '.c',
    c_args: common_c_args + ['-DG_LOG_DOMAIN="@0@"'.format(gdata_name)],
    include_directories: top_inc_dir,
    dependencies: common_deps + extra_args.get('dependencies', []),
    sources: tests_sources,
    install: install_tests and not should_fail,
    install_dir: tests_execdir,
  )

  test(
    test_name,
    exe,
    env: test_env,
    should_fail: should_fail,
  )
endforeach

if install_tests
  foreach test_name, extra_args: tests
    should_fail = extra_args.get('should_fail', false)
    tests_conf = {
      'TEST_TYPE': 'session',
      'TEST_ABS_PATH': gdata_prefix / tests_execdir / test_name,
    }

    configure_file (
      input: 'template.test.in',
      output: test_name + '.test',
      configuration: tests_conf,
      install: not should_fail,
      install_dir: tests_metadir,
    )
  endforeach

  install_subdir(
    'traces',
    install_dir: tests_execdir,
  )

  test_data = [
    'cert.pem',
    'key.pem',
    'photo.jpg',
    'sample.ogg',
    'test.doc',
    'test.ods',
    'test.odt',
    'test.ppt',
    'test_updated.odt',
    'test_updated_file.ppt',
    'test.xls',
  ]

  install_data(
    test_data,
    install_dir: tests_execdir,
  )
endif