summaryrefslogtreecommitdiff
path: root/server/tests/meson.build
blob: 3e0606cd39095804519a0c354f0b3c8cadc69af5 (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
103
104
105
106
107
108
109
110
111
112
113
114
115
test_lib_include = [spice_server_include, include_directories('.')]
test_lib_deps = [spice_server_deps, spice_common.get_variable('gio2_deps')]
if host_machine.system() != 'windows'
  test_lib_deps += [dependency('gio-unix-2.0')]
endif

test_lib_sources = [
  'basic-event-loop.c',
  'basic-event-loop.h',
  'test-display-base.cpp',
  'test-display-base.h',
  'test-glib-compat.h',
  'win-alarm.c',
  'win-alarm.h',
  'vmc-emu.cpp',
  'vmc-emu.h',
]

test_libs = []
test_libs += static_library('testlib', test_lib_sources,
                            link_with: spice_server_static_lib,
                            include_directories : test_lib_include,
                            dependencies : test_lib_deps,
                            install : false)

stat_test_libs = {'testlib_stat1' : ['1', '0', '0'],
                  'testlib_stat2' : ['2', '0', '1'],
                  'testlib_stat3' : ['3', '1', '0'],
                  'testlib_stat4' : ['4', '1', '1']}
foreach lib, params : stat_test_libs
  test_libs += static_library(lib, 'stat-test.c',
                              c_args : ['-DTEST_NAME=stat_test@0@'.format(params[0]),
                                        '-DTEST_COMPRESS_STAT=@0@'.format(params[1]),
                                        '-DTEST_RED_WORKER_STAT=@0@'.format(params[2])],
                              include_directories : test_lib_include,
                              dependencies : test_lib_deps,
                              install : false)
endforeach

tests = [
  ['test-codecs-parsing', true],
  ['test-dispatcher', true, 'cpp'],
  ['test-options', true],
  ['test-stat', true],
  ['test-agent-msg-filter', true],
  ['test-loop', true],
  ['test-qxl-parsing', true, 'cpp'],
  ['test-leaks', true],
  ['test-vdagent', true],
  ['test-fail-on-null-core-interface', true],
  ['test-empty-success', true],
  ['test-channel', true, 'cpp'],
  ['test-stream-device', true, 'cpp'],
  ['test-set-ticket', true],
  ['test-listen', true],
  ['test-record', true],
  ['test-display-no-ssl', false],
  ['test-display-streaming', false],
  ['test-playback', false],
  ['test-display-resolution-changes', false],
  ['test-two-servers', false],
  ['test-display-width-stride', false],
]

if spice_server_has_sasl
  tests += [['test-sasl', true]]
endif

if spice_server_has_smartcard == true
  tests += [['test-smartcard', true, 'cpp']]
endif

if host_machine.system() != 'windows'
  tests += [
    ['test-stream', true],
    ['test-stat-file', true],
    ['test-websocket', false],
  ]
endif

if spice_server_has_gstreamer
  tests += [['test-gst', false, 'cpp']]
  if get_option('extra-checks')
    test('test-video-encoders', files('test-video-encoders'))
  endif
endif

foreach t : tests
  test_name = t[0]
  is_test = t[1]
  if t.length() > 2
    language = t[2]
  else
    language = 'c'
  endif
  exe = executable(test_name,
                   sources : '@0@.@1@'.format(test_name, language),
                   link_with : test_libs,
                   include_directories : test_lib_include,
                   c_args : ['-DSPICE_TOP_SRCDIR="@0@"'.format(meson.source_root())],
                   cpp_args : ['-DSPICE_TOP_SRCDIR="@0@"'.format(meson.source_root())],
                   dependencies : test_lib_deps,
                   install : false)

  if is_test
    test(test_name, exe)
  endif
endforeach

executable('spice-server-replay',
           sources : ['replay.c', join_paths('..', 'event-loop.c'), 'basic-event-loop.c', 'basic-event-loop.h'],
           link_with : spice_server_shared_lib,
           include_directories : test_lib_include,
           dependencies : test_lib_deps,
           install : false)