File: meson.build

package info (click to toggle)
glib-networking 2.70.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 2,584 kB
  • sloc: ansic: 19,829; sh: 119; python: 57; makefile: 17
file content (142 lines) | stat: -rw-r--r-- 3,830 bytes parent folder | download
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
incs = [
  top_inc,
  tls_inc
]

deps = [
  gio_dep,
  glib_dep,
  gmodule_dep,
  gobject_dep,
  gnutls_dep
]

cflags = [
  '-DSRCDIR="@0@"'.format(meson.current_source_dir()),
  '-DTOP_BUILDDIR="@0@"'.format(meson.build_root())
]

envs = [
  'G_TEST_SRCDIR=' + meson.current_source_dir(),
  'G_TEST_BUILDDIR=' + meson.current_build_dir(),
]

if backends.contains('gnutls')
  mock_pkcs11_module = shared_module('mock-pkcs11',
    sources: 'mock-pkcs11.c',
    name_prefix: '',
    gnu_symbol_visibility: 'hidden',
    dependencies: [
      gio_dep,
      gnutls_dep,
    ],
    install: enable_installed_tests,
    install_dir: installed_tests_execdir
  )
else
  mock_pkcs11_module = []
endif

if enable_installed_tests
  install_subdir('files', install_dir: installed_tests_execdir)
endif

test_programs = [
  ['certificate', [], deps, [], [mock_pkcs11_module]],
  ['file-database', [], deps, [], []],
  ['connection', ['mock-interaction.c'], deps, [], [mock_pkcs11_module]],
# DTLS tests are disabled until we fix https://gitlab.gnome.org/GNOME/glib-networking/issues/49
#  ['dtls-connection', ['mock-interaction.c', 'lossy-socket.c'], deps, [], [mock_pkcs11_module]],
]

foreach backend: backends
  foreach program: test_programs
    program_name = program[0] + '-' + backend

    test_conf = configuration_data()
    test_conf.set('installed_tests_dir', installed_tests_execdir)
    test_conf.set('program', program_name)

    if enable_installed_tests
      configure_file(
        input: test_template,
        output: program_name + '.test',
        install_dir: installed_tests_metadir,
        configuration: test_conf
      )
    endif

    test_cflags = cflags + [
      '-DBACKEND="@0@"'.format(backend),
      '-DBACKEND_IS_' + backend.to_upper(),
      '-DSIZEOF_TIME_T=@0@'.format(cc.sizeof('time_t', prefix: '#include <time.h>')),
    ]

    if backend == 'openssl'
      incs += openssl_inc
    endif

    exe = executable(
      program_name,
      [program[0] + '.c'] + program[1],
      include_directories: incs,
      dependencies: program[2],
      c_args: test_cflags,
      install: enable_installed_tests,
      install_dir: installed_tests_execdir
    )

    test_envs = envs + [
      'GIO_MODULE_DIR=' + join_paths(meson.build_root(), 'tls', backend),
      'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
      'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
    ]

    test(program_name, exe, env: test_envs, depends: program[4])

    if program[0] == 'connection'
      # Run the tests again, this time with TLS 1.3 disabled so we can test TLS 1.2.
      if backend == 'gnutls'
        test(program_name + '-tls1.2', exe, env: test_envs + ['G_TLS_GNUTLS_PRIORITY=NORMAL:%COMPAT:!VERS-TLS1.3'])
      elif backend == 'openssl'
        test(program_name + '-tls1.2', exe, env: test_envs + ['G_TLS_OPENSSL_MAX_PROTO=0x0303'])
      endif
    endif
  endforeach
endforeach

if enable_installed_tests
  test_data = files(
    'files/ca-alternative.pem',
    'files/ca-key.pem',
    'files/ca.pem',
    'files/ca-roots-bad.pem',
    'files/ca-roots.pem',
    'files/ca-verisign-sha1.pem',
    'files/chain.pem',
    'files/chain-with-verisign-md2.pem',
    'files/client2-and-key.pem',
    'files/client2-key.pem',
    'files/client2.pem',
    'files/client-and-key.pem',
    'files/client-future.pem',
    'files/client-past.pem',
    'files/client.pem',
    'files/garbage.pem',
    'files/intermediate-ca.pem',
    'files/non-ca.pem',
    'files/server-and-key.pem',
    'files/server.der',
    'files/server-intermediate-key.pem',
    'files/server-intermediate.pem',
    'files/server-key.der',
    'files/server-key.pem',
    'files/server.pem',
    'files/server-self.pem'
  )

  install_data(
    test_data,
    install_dir: join_paths(installed_tests_execdir, 'files')
  )
endif