summaryrefslogtreecommitdiff
path: root/tests/meson.build
blob: 370a11b33b4688ef3545520a1124353d079cde61 (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
116
117
118
119
test_utils_name = 'test-utils'

if cc.get_id() == 'msvc'
  test_utils = static_library(test_utils_name, test_utils_name + '.c',
    dependencies : [glib_dep, libsoup_dep])
else
  test_utils = library(test_utils_name, test_utils_name + '.c',
    dependencies : [glib_dep, libsoup_dep])
endif

test_resources = gnome.compile_resources('soup-tests',
  'soup-tests.gresource.xml',
  gresource_bundle : true)

# ['name', is_parallel]
tests = [
  ['cache', true],
  ['cached-resolver', true],
  ['chunk', true],
  ['chunk-io', true],
  ['coding', true],
  ['context', true],
  ['continue', true],
  ['cookies', true],
  ['date', true],
  ['forms', true],
  ['header-parsing', true],
  ['misc', true],
  ['multipart', true],
  ['no-ssl', true],
  ['ntlm', true],
  ['redirect', true],
  ['requester', true],
  ['resource', true],
  ['session', true],
  ['server-auth', true],
  ['server', true],
  ['sniffing', true],
  ['socket', true],
  ['ssl', true],
  ['streaming', true],
  ['timeout', true],
  ['tld', true],
  ['uri-parsing', true],
  ['websocket', true]
]

if have_apache
  tests += [
    ['auth', false],
    ['connection', false],
    ['range', false],
    ['proxy', true],
    ['pull-api', false],
  ]

  configure_file(output : 'httpd.conf',
    input : 'httpd.conf.in',
    configuration : cdata)

  configure_file(input : 'htdigest',
    output : 'htdigest',
    copy : true)
  configure_file(input : 'htpasswd',
    output : 'htpasswd',
    copy : true)
  configure_file(input : 'index.txt',
    output : 'index.txt',
    copy : true)
  configure_file(input : 'test-cert.pem',
    output : 'test-cert.pem',
    copy : true)
  configure_file(input : 'test-key.pem',
    output : 'test-key.pem',
    copy : true)
endif

if have_php
  configure_file(output : 'php.ini',
    input : 'php.ini.in',
    configuration : cdata)
endif

if have_php_xmlrpc
  tests += [
    ['xmlrpc-old-server', true, have_php_xmlrpc],
    ['xmlrpc-old', false, have_php_xmlrpc],
    ['xmlrpc-server', true, have_php_xmlrpc],
    ['xmlrpc', false, have_php_xmlrpc]
  ]

  configure_file(input : 'xmlrpc-server.php',
    output : 'xmlrpc-server.php',
    copy : true)
endif

env = environment()
env.set('G_TEST_SRCDIR', meson.current_source_dir())
env.set('G_TEST_BUILDDIR', meson.current_build_dir())
# See https://github.com/mesonbuild/meson/issues/4228 for the workaround below
env.prepend('LD_LIBRARY_PATH', meson.build_root() + '/libsoup')
env.set('G_DEBUG', 'gc-friendly')
env.set('MALLOC_CHECK_', '2')
# This is set by Meson if empty
env.set('MALLOC_PERTURB_', '')

foreach test: tests
  test_name = '@0@-test'.format(test[0])
  test_target = executable(test_name,
    sources : [ test_name + '.c', test_resources ],
    link_with : test_utils,
    dependencies : [glib_dep, libsoup_dep, platform_deps])
  # Increase the timeout as on some architectures the tests could be slower
  # than the default 30 seconds.
  test(test_name, test_target, env : env, is_parallel : test[1], timeout : 60)
endforeach

executable('ntlm-test-helper', 'ntlm-test-helper.c',
  dependencies : [glib_dep, libsoup_dep])