aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/tests/rtdl/meson.build
blob: 1331899e1626b926545fa64af1b25b9f8f74fbe8 (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
rtdl_test_cases = [
	'dl_iterate_phdr',
	'dladdr_local',
	'ld_library_path',
	'noload-promote',
	'rtld_next',
	'soname',
	'preinit',
	'scope1',
	'scope2',
	'scope3',
	'scope4',
	'scope5',
	'tls_align',
]

foreach test_name : rtdl_test_cases 
	test_rpath = meson.build_root() / 'tests' / 'rtdl' / test_name / ''
	test_rpath += ':$ORIGIN/' # Workaround old and buggy qemu-user on CI

	test_env = []
	test_link_with = []
	test_depends = []
	test_native_env = []
	test_native_link_with = []
	test_native_depends = []
	test_additional_link_args = []

	# Build the needed DSOs for the test. This sets the variables above.
	subdir(test_name)

	exec = executable('rtdl-' + test_name, [test_name / 'test.c', test_sources],
		link_with: test_link_with,
		dependencies: libc_dep,
		build_rpath: test_rpath,
		override_options: test_override_options,
		c_args: test_c_args,
		link_args: test_link_args + test_additional_link_args,
	)
	test(test_name, exec, env: test_env, suite: 'rtdl', depends: test_depends)

	if build_tests_host_libc and not host_libc_excluded_test_cases.contains(test_name)
		exec = executable('host-libc-' + test_name, test_name / 'test.c',
			link_with: test_native_link_with,
			dependencies: rtlib_deps,
			build_rpath: test_rpath,
			# Don't use ASan here, due to a bug that breaks dlopen() + DT_RUNPATH:
			# https://bugzilla.redhat.com/show_bug.cgi?id=1449604
			override_options: 'b_sanitize=undefined',
			c_args: ['-D_GNU_SOURCE', '-DUSE_HOST_LIBC'],
			link_args: ['-ldl'] + test_additional_link_args,
			native: true,
		)
		test(test_name, exec, env: test_native_env, suite: ['host-libc', 'rtdl'], depends: test_native_depends)
	endif
endforeach