summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-06-26 01:52:26 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-08-03 13:37:16 +0200
commit130c87b16a572169a3c4978391ca53fc37a19afe (patch)
treec0fc9759cc8b5516b1f512c952feeddd7ff464e7
parenttest: rename udev-rule-runner -> test-udev-rule-runner (diff)
downloadsystemd-130c87b16a572169a3c4978391ca53fc37a19afe.tar.xz
systemd-130c87b16a572169a3c4978391ca53fc37a19afe.zip
meson: merge declarations of normal and test executables
Diffstat (limited to '')
-rw-r--r--meson.build241
-rw-r--r--src/analyze/meson.build6
-rw-r--r--src/boot/efi/meson.build11
-rw-r--r--src/busctl/meson.build5
-rw-r--r--src/core/meson.build10
-rw-r--r--src/coredump/meson.build15
-rw-r--r--src/import/meson.build21
-rw-r--r--src/journal/meson.build96
-rw-r--r--src/libsystemd-network/meson.build43
-rw-r--r--src/libsystemd/meson.build4
-rw-r--r--src/libudev/meson.build12
-rw-r--r--src/locale/meson.build19
-rw-r--r--src/login/meson.build45
-rw-r--r--src/machine/meson.build19
-rw-r--r--src/network/meson.build72
-rw-r--r--src/nspawn/meson.build32
-rw-r--r--src/oom/meson.build17
-rw-r--r--src/resolve/meson.build98
-rw-r--r--src/shutdown/meson.build5
-rw-r--r--src/test/meson.build255
-rw-r--r--src/timesync/meson.build21
-rw-r--r--src/tmpfiles/meson.build5
-rw-r--r--src/udev/meson.build115
-rw-r--r--src/xdg-autostart-generator/meson.build5
-rw-r--r--test/meson.build10
25 files changed, 521 insertions, 661 deletions
diff --git a/meson.build b/meson.build
index fbf50a6ca0..320302f15d 100644
--- a/meson.build
+++ b/meson.build
@@ -2172,8 +2172,8 @@ man_page_depends = []
############################################################
-tests = []
simple_tests = []
+libsystemd_tests = []
fuzzers = []
simple_fuzzers = []
catalogs = []
@@ -2303,6 +2303,27 @@ install_libudev_static = static_library(
############################################################
+runtest_env = custom_target(
+ 'systemd-runtest.env',
+ output : 'systemd-runtest.env',
+ command : [sh, '-c',
+ '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
+ project_source_root / 'test',
+ project_build_root / 'catalog')],
+ depends : catalogs,
+ build_by_default : true)
+
+test_cflags = ['-DTEST_CODE=1']
+# We intentionally do not do inline initializations with definitions for a
+# bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
+# use the variable unexpectedly. This triggers a lot of maybe-uninitialized
+# false positives when the combination of -O2 and -flto is used. Suppress them.
+if '-O2' in c_args and '-flto=auto' in c_args
+ test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
+endif
+
+############################################################
+
executable_template = {
'include_directories' : includes,
'link_with' : libshared,
@@ -2322,6 +2343,17 @@ executable_additional_kwargs = {
'dependencies' : userspace,
}
+test_template = executable_template + {
+ 'build_by_default' : want_tests != 'false',
+ 'install' : install_tests,
+ 'install_dir' : unittestsdir,
+}
+
+test_additional_kwargs = {
+ 'c_args' : test_cflags,
+ 'link_depends' : runtest_env,
+}
+
nss_template = {
'version' : '2',
'include_directories' : includes,
@@ -2475,8 +2507,22 @@ alias_target('devel', libsystemd_pc, libudev_pc, systemd_pc, udev_pc)
############################################################
+foreach test : simple_tests
+ executables += test_template + { 'sources' : [test] }
+endforeach
+
+foreach test : libsystemd_tests
+ executables += test_template + test
+endforeach
+
foreach dict : executables
- name = dict.get('name')
+ name = dict.get('name', '')
+ if name == ''
+ name = fs.stem(dict.get('sources')[0])
+ assert(name.split('-')[0] == 'test')
+ endif
+
+ is_test = name.startswith('test-')
build = true
foreach cond : dict.get('conditions', [])
@@ -2491,9 +2537,11 @@ foreach dict : executables
kwargs = {}
foreach key, val : dict
- if key in ['name', 'dbus', 'public', 'conditions']
+ if key in ['name', 'dbus', 'public', 'conditions',
+ 'type', 'suite', 'timeout', 'parallel']
continue
endif
+
kwargs += { key : val }
endforeach
@@ -2501,6 +2549,13 @@ foreach dict : executables
kwargs += { key : [ kwargs.get(key, []), val ]}
endforeach
+ if is_test
+ kwargs += { 'install_dir' : kwargs.get('install_dir') / dict.get('type', '') }
+ foreach key, val : test_additional_kwargs
+ kwargs += { key : [ kwargs.get(key, []), val ] }
+ endforeach
+ endif
+
exe = executable(
name,
kwargs : kwargs,
@@ -2516,20 +2571,34 @@ foreach dict : executables
public_programs += exe
endif
endif
+
+ if is_test
+ type = dict.get('type', '')
+ suite = dict.get('suite', '')
+ if suite == ''
+ suite = fs.name(fs.parent(dict.get('sources')[0]))
+ if suite.startswith('sd-')
+ suite = 'libsystemd'
+ endif
+ endif
+
+ if type == 'manual'
+ message('@0@/@1@ is a manual test'.format(suite, name))
+ elif type == 'unsafe' and want_tests != 'unsafe'
+ message('@0@/@1@ is an unsafe test'.format(suite, name))
+ elif dict.get('build_by_default')
+ test(name, exe,
+ env : test_env,
+ timeout : dict.get('timeout', 30),
+ suite : suite,
+ is_parallel : dict.get('parallel', true))
+ endif
+ endif
endforeach
############################################################
-# only static linking apart from libdl, to make sure that the
-# module is linked to all libraries that it uses.
-test_dlopen = executable(
- 'test-dlopen',
- test_dlopen_c,
- include_directories : includes,
- link_with : [libbasic],
- dependencies : [libdl,
- userspace],
- build_by_default : want_tests != 'false')
+test_dlopen = executables_by_name.get('test-dlopen')
foreach dict : modules
name = dict.get('name')
@@ -2606,152 +2675,6 @@ endif
subdir('rules.d')
subdir('test')
-runtest_env = custom_target(
- 'systemd-runtest.env',
- output : 'systemd-runtest.env',
- command : [sh, '-c',
- '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format(
- project_source_root / 'test',
- project_build_root / 'catalog')],
- depends : catalogs,
- build_by_default : true)
-
-test_cflags = ['-DTEST_CODE=1']
-# We intentionally do not do inline initializations with definitions for a
-# bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
-# use the variable unexpectedly. This triggers a lot of maybe-uninitialized
-# false positives when the combination of -O2 and -flto is used. Suppress them.
-if '-O2' in c_args and '-flto=auto' in c_args
- test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
-endif
-
-foreach test : simple_tests
- tests += { 'sources' : [test] }
-endforeach
-
-TESTS = {}
-foreach test : tests
- sources = test.get('sources')
- condition = test.get('condition', '')
- type = test.get('type', '')
- base = test.get('base', {})
- deps = [
- base.get('dependencies', []),
- test.get('dependencies', []),
- ]
-
- name = fs.name(sources[0])
- if name.endswith('.cc')
- deps += [versiondep]
- else
- deps += [userspace]
- endif
- name = fs.stem(name)
-
- suite = fs.name(fs.parent(sources[0])).replace('sd-', '')
-
- if condition != '' and conf.get(condition) == 0
- message('Not compiling @0@ because @1@ is not true'.format(name, condition))
- continue
- endif
-
- exe = executable(
- name,
- sources,
- include_directories : [base.get('includes', []), test.get('includes', includes)],
- link_with : [base.get('link_with', []), test.get('link_with', libshared)],
- dependencies : deps,
- c_args : [test_cflags, test.get('c_args', [])],
- build_by_default : want_tests != 'false',
- install_rpath : pkglibdir,
- install : install_tests,
- install_dir : unittestsdir / type,
- link_depends : runtest_env)
-
- if type == 'manual'
- message('@0@ is a manual test'.format(name))
- elif type == 'unsafe' and want_tests != 'unsafe'
- message('@0@ is an unsafe test'.format(name))
- elif want_tests != 'false'
- test(name, exe,
- env : test_env,
- timeout : test.get('timeout', 30),
- suite : suite,
- is_parallel : test.get('parallel', true))
- endif
-
- TESTS += { name : exe }
-endforeach
-
-exe = executable(
- 'test-libsystemd-sym',
- test_libsystemd_sym_c,
- include_directories : includes,
- link_with : [libsystemd],
- dependencies : userspace,
- build_by_default : want_tests != 'false',
- install : install_tests,
- install_dir : unittestsdir)
-if want_tests != 'false'
- test('test-libsystemd-sym', exe)
-endif
-
-exe = executable(
- 'test-libsystemd-static-sym',
- test_libsystemd_sym_c,
- include_directories : includes,
- link_with : [install_libsystemd_static],
- dependencies : [
- # threads is already included in dependencies on the library,
- # but does not seem to get propagated. Add here as a work-around.
- threads,
- userspace,
- ],
- build_by_default : want_tests != 'false' and static_libsystemd != 'false',
- install : install_tests and static_libsystemd != 'false',
- install_dir : unittestsdir)
-if want_tests != 'false' and static_libsystemd != 'false'
- test('test-libsystemd-static-sym', exe)
-endif
-
-exe = executable(
- 'test-libudev-sym',
- test_libudev_sym_c,
- include_directories : libudev_includes,
- c_args : ['-Wno-deprecated-declarations'] + test_cflags,
- link_with : [libudev],
- dependencies : userspace,
- build_by_default : want_tests != 'false',
- install : install_tests,
- install_dir : unittestsdir)
-if want_tests != 'false'
- test('test-libudev-sym', exe)
-endif
-
-exe = executable(
- 'test-libudev-static-sym',
- test_libudev_sym_c,
- include_directories : libudev_includes,
- c_args : ['-Wno-deprecated-declarations'] + test_cflags,
- link_with : [install_libudev_static],
- dependencies : userspace,
- build_by_default : want_tests != 'false' and static_libudev != 'false',
- install : install_tests and static_libudev != 'false',
- install_dir : unittestsdir)
-if want_tests != 'false' and static_libudev != 'false'
- test('test-libudev-static-sym', exe)
-endif
-
-if want_tests != 'false'
- exe = TESTS.get('test-udev-rule-runner')
- test('test-udev',
- test_udev_py,
- args : ['-v'],
- env : ['UDEV_RULE_RUNNER=' + exe.full_path()],
- depends : exe,
- timeout : 180)
-endif
-
############################################################
foreach fuzzer : simple_fuzzers
diff --git a/src/analyze/meson.build b/src/analyze/meson.build
index 2bbcf26d1c..1a9b68f6d2 100644
--- a/src/analyze/meson.build
+++ b/src/analyze/meson.build
@@ -46,14 +46,10 @@ executables += [
'dependencies' : libseccomp,
'install' : conf.get('ENABLE_ANALYZE') == 1,
},
-]
-
-tests += [
- {
+ core_test_template + {
'sources' : files(
'test-verify.c',
'analyze-verify-util.c',
),
- 'base' : test_core_base,
},
]
diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
index b687537031..7adcc178a6 100644
--- a/src/boot/efi/meson.build
+++ b/src/boot/efi/meson.build
@@ -23,17 +23,16 @@ if efi_arch != ''
libshared,
],
}
+ efi_test_template = test_template + efitest_base
- tests += [
- {
+ executables += [
+ efi_test_template + {
'sources' : files('test-bcd.c'),
'dependencies' : libzstd,
- 'condition' : 'HAVE_ZSTD',
- 'base' : efitest_base,
+ 'conditions' : ['HAVE_ZSTD'],
},
- {
+ efi_test_template + {
'sources' : files('test-efi-string.c'),
- 'base' : efitest_base,
},
]
fuzzers += [
diff --git a/src/busctl/meson.build b/src/busctl/meson.build
index 012d58c3a8..6b3a479b21 100644
--- a/src/busctl/meson.build
+++ b/src/busctl/meson.build
@@ -11,10 +11,7 @@ executables += [
'public' : true,
'sources' : busctl_sources,
},
-]
-
-tests += [
- {
+ test_template + {
'sources' : files(
'test-busctl-introspect.c',
'busctl-introspect.c',
diff --git a/src/core/meson.build b/src/core/meson.build
index 9f04a9e019..a99136be0f 100644
--- a/src/core/meson.build
+++ b/src/core/meson.build
@@ -203,9 +203,13 @@ meson.add_install_script(meson_make_symlink,
############################################################
-test_core_base = {
- 'link_with' : [libcore, libshared],
- 'includes' : core_includes,
+core_test_template = test_template + {
+ 'link_with' : [
+ libcore,
+ libshared,
+ ],
+ 'include_directories' : core_includes,
+ 'suite' : 'core',
}
fuzzers += [
diff --git a/src/coredump/meson.build b/src/coredump/meson.build
index 89468b1fbc..ba313ce42e 100644
--- a/src/coredump/meson.build
+++ b/src/coredump/meson.build
@@ -33,15 +33,7 @@ executables += [
'link_with' : common_link_with,
'dependencies' : common_dependencies,
},
-]
-
-if conf.get('ENABLE_COREDUMP') == 1 and install_sysconfdir_samples
- install_data('coredump.conf',
- install_dir : pkgsysconfdir)
-endif
-
-tests += [
- {
+ test_template + {
'sources' : files(
'test-coredump-vacuum.c',
'coredump-vacuum.c',
@@ -49,3 +41,8 @@ tests += [
'type' : 'manual',
},
]
+
+if conf.get('ENABLE_COREDUMP') == 1 and install_sysconfdir_samples
+ install_data('coredump.conf',
+ install_dir : pkgsysconfdir)
+endif
diff --git a/src/import/meson.build b/src/import/meson.build
index 9d63e613cf..3f0acf8358 100644
--- a/src/import/meson.build
+++ b/src/import/meson.build
@@ -100,6 +100,15 @@ executables += [
'link_with' : common_libs,
'dependencies' : common_deps,
},
+ test_template + {
+ 'sources' : files(
+ 'test-qcow2.c',
+ 'qcow2-util.c',
+ ),
+ 'dependencies' : libz,
+ 'conditions' : ['HAVE_ZLIB'],
+ 'type' : 'manual',
+ },
]
if conf.get('ENABLE_IMPORTD') == 1
@@ -114,15 +123,3 @@ if conf.get('ENABLE_IMPORTD') == 1
install_dir : libexecdir)
# TODO: shouldn't this be in pkgdatadir?
endif
-
-tests += [
- {
- 'sources' : files(
- 'test-qcow2.c',
- 'qcow2-util.c',
- ),
- 'dependencies' : libz,
- 'condition' : 'HAVE_ZLIB',
- 'type' : 'manual',
- },
-]
diff --git a/src/journal/meson.build b/src/journal/meson.build
index 0c99684770..90170599a7 100644
--- a/src/journal/meson.build
+++ b/src/journal/meson.build
@@ -41,6 +41,13 @@ else
]
endif
+journal_test_template = test_template + {
+ 'link_with' : [
+ libjournal_core,
+ libshared,
+ ],
+}
+
executables += [
libexec_template + {
'name' : 'systemd-journald',
@@ -80,6 +87,43 @@ executables += [
threads,
],
},
+ journal_test_template + {
+ 'sources' : files('test-journal-append.c'),
+ 'type' : 'manual',
+ },
+ journal_test_template + {
+ 'sources' : files('test-journal-config.c'),
+ 'dependencies' : [
+ liblz4,
+ libselinux,
+ libxz,
+ ],
+ },
+ journal_test_template + {
+ 'sources' : files('test-journal-flush.c'),
+ },
+ journal_test_template + {
+ 'sources' : files('test-journal-interleaving.c'),
+ },
+ journal_test_template + {
+ 'sources' : files('test-journal-stream.c'),
+ },
+ journal_test_template + {
+ 'sources' : files('test-journal-syslog.c'),
+ 'dependencies' : [
+ liblz4,
+ libselinux,
+ libxz,
+ threads,
+ ],
+ },
+ journal_test_template + {
+ 'sources' : files('test-journal-verify.c'),
+ 'timeout' : 90,
+ },
+ journal_test_template + {
+ 'sources' : files('test-journal.c'),
+ },
]
if install_sysconfdir_samples
@@ -109,58 +153,6 @@ endif
############################################################
-test_journal_base = {
- 'link_with' : [libjournal_core, libshared],
-}
-
-tests += [
- {
- 'sources' : files('test-journal-config.c'),
- 'dependencies' : [
- liblz4,
- libselinux,
- libxz,
- ],
- 'base' : test_journal_base,
- },
- {
- 'sources' : files('test-journal-flush.c'),
- 'base' : test_journal_base,
- },
- {
- 'sources' : files('test-journal-interleaving.c'),
- 'base' : test_journal_base,
- },
- {
- 'sources' : files('test-journal-stream.c'),
- 'base' : test_journal_base,
- },
- {
- 'sources' : files('test-journal-syslog.c'),
- 'dependencies' : [
- liblz4,
- libselinux,
- libxz,
- threads,
- ],
- 'base' : test_journal_base,
- },
- {
- 'sources' : files('test-journal-verify.c'),
- 'base' : test_journal_base,
- 'timeout' : 90,
- },
- {
- 'sources' : files('test-journal.c'),
- 'base' : test_journal_base,
- },
- {
- 'sources' : files('test-journal-append.c'),
- 'base' : test_journal_base,
- 'type' : 'manual',
- },
-]
-
fuzzer_journald_base = {
'link_with' : [libjournal_core, libshared],
'dependencies' : [libselinux],
diff --git a/src/libsystemd-network/meson.build b/src/libsystemd-network/meson.build
index ac4a15b474..74041f6abd 100644
--- a/src/libsystemd-network/meson.build
+++ b/src/libsystemd-network/meson.build
@@ -39,56 +39,49 @@ libsystemd_network_includes = [includes, include_directories('.')]
############################################################
-test_libsystemd_network_base = {
- 'link_with' : [libshared, libsystemd_network],
+network_test_template = test_template + {
+ 'link_with' : [
+ libshared,
+ libsystemd_network,
+ ],
+ 'suite' : 'network',
}
-tests += [
- {
+executables += [
+ network_test_template + {
'sources' : files('test-acd.c'),
- 'base' : test_libsystemd_network_base,
'type' : 'manual',
},
- {
+ network_test_template + {
'sources' : files('test-dhcp-client.c'),
- 'base' : test_libsystemd_network_base,
},
- {
+ network_test_template + {
'sources' : files('test-dhcp-option.c'),
- 'base' : test_libsystemd_network_base,
},
- {
+ network_test_template + {
'sources' : files('test-dhcp-server.c'),
- 'base' : test_libsystemd_network_base,
},
- {
+ network_test_template + {
'sources' : files('test-dhcp6-client.c'),
- 'base' : test_libsystemd_network_base,
},
- {
+ network_test_template + {
'sources' : files('test-ipv4ll-manual.c'),
- 'base' : test_libsystemd_network_base,
'type' : 'manual',
},
- {
+ network_test_template + {
'sources' : files('test-ipv4ll.c'),
- 'base' : test_libsystemd_network_base,
},
- {
+ network_test_template + {
'sources' : files('test-lldp-rx.c'),
- 'base' : test_libsystemd_network_base,
},
- {
+ network_test_template + {
'sources' : files('test-ndisc-ra.c'),
- 'base' : test_libsystemd_network_base,
},
- {
+ network_test_template + {
'sources' : files('test-ndisc-rs.c'),
- 'base' : test_libsystemd_network_base,
},
- {
+ network_test_template + {
'sources' : files('test-sd-dhcp-lease.c'),
- 'base' : test_libsystemd_network_base,
},
]
diff --git a/src/libsystemd/meson.build b/src/libsystemd/meson.build
index 8da73a131e..bcf8e1faf8 100644
--- a/src/libsystemd/meson.build
+++ b/src/libsystemd/meson.build
@@ -154,7 +154,7 @@ simple_tests += files(
'sd-journal/test-mmap-cache.c',
)
-tests += [
+libsystemd_tests += [
{
'sources' : files('sd-journal/test-journal-enum.c'),
'timeout' : 360,
@@ -176,7 +176,7 @@ simple_tests += files(
'sd-netlink/test-netlink.c',
)
-tests += [
+libsystemd_tests += [
{
'sources' : files('sd-bus/test-bus-address.c'),
'dependencies' : threads
diff --git a/src/libudev/meson.build b/src/libudev/meson.build
index 3787602a6b..7f999197af 100644
--- a/src/libudev/meson.build
+++ b/src/libudev/meson.build
@@ -42,15 +42,3 @@ libudev_pc = custom_target(
install : pkgconfiglibdir != 'no',
install_tag : 'devel',
install_dir : pkgconfiglibdir)
-
-############################################################
-
-tests += [
- {
- 'sources' : files('test-libudev.c'),
- 'link_with' : [
- libshared,
- libudev_basic,
- ],
- },
-]
diff --git a/src/locale/meson.build b/src/locale/meson.build
index e7e059a0ab..3d3aa589c3 100644
--- a/src/locale/meson.build
+++ b/src/locale/meson.build
@@ -33,6 +33,14 @@ executables += [
'conditions' : ['ENABLE_LOCALED'],
'sources' : files('localectl.c'),
},
+ test_template + {
+ 'sources' : files(
+ 'test-localed-util.c',
+ 'localed-util.c',
+ 'xkbcommon-util.c',
+ ),
+ 'dependencies' : libxkbcommon_deps,
+ },
]
# If you know a way that allows the same variables to be used
@@ -52,14 +60,3 @@ if conf.get('ENABLE_LOCALED') == 1
'language-fallback-map',
install_dir : pkgdatadir)
endif
-
-tests += [
- {
- 'sources' : files(
- 'test-localed-util.c',
- 'localed-util.c',
- 'xkbcommon-util.c',
- ),
- 'dependencies' : libxkbcommon_deps,
- },
-]
diff --git a/src/login/meson.build b/src/login/meson.build
index c641cc700e..9804a36ce1 100644
--- a/src/login/meson.build
+++ b/src/login/meson.build
@@ -82,8 +82,28 @@ executables += [
'conditions' : ['ENABLE_LOGIND'],
'sources' : files('user-runtime-dir.c'),
},
+ test_template + {
+ 'sources' : files('test-inhibit.c'),
+ 'type' : 'manual',
+ },
+ test_template + {
+ 'sources' : files('test-login-tables.c'),
+ 'link_with' : [
+ liblogind_core,
+ libshared,
+ ],
+ 'dependencies' : threads,
+ },
+ test_template + {
+ 'sources' : files('test-session-properties.c'),
+ 'type' : 'manual',
+ },
]
+simple_tests += files(
+ 'test-login-shared.c'
+)
+
modules += [
pam_template + {
'name' : 'pam_systemd',
@@ -122,28 +142,3 @@ if enable_logind
install_data('org.freedesktop.login1.policy',
install_dir : polkitpolicydir)
endif
-
-############################################################
-
-simple_tests += files(
- 'test-login-shared.c'
-)
-
-tests += [
- {
- 'sources' : files('test-inhibit.c'),
- 'type' : 'manual',
- },
- {
- 'sources' : files('test-login-tables.c'),
- 'link_with' : [
- liblogind_core,
- libshared,
- ],
- 'dependencies' : threads,
- },
- {
- 'sources' : files('test-session-properties.c'),
- 'type' : 'manual',
- },
-]
diff --git a/src/machine/meson.build b/src/machine/meson.build
index 2adc1bd37b..b3a1ffce8f 100644
--- a/src/machine/meson.build
+++ b/src/machine/meson.build
@@ -41,6 +41,14 @@ executables += [
threads,
],
},
+ test_template + {
+ 'sources' : files('test-machine-tables.c'),
+ 'link_with': [
+ libmachine_core,
+ libshared
+ ],
+ 'dependencies': threads,
+ },
]
if conf.get('ENABLE_MACHINED') == 1
@@ -51,14 +59,3 @@ if conf.get('ENABLE_MACHINED') == 1
install_data('org.freedesktop.machine1.policy',
install_dir : polkitpolicydir)
endif
-
-tests += [
- {
- 'sources' : files('test-machine-tables.c'),
- 'link_with': [
- libmachine_core,
- libshared
- ],
- 'dependencies': threads,
- },
-]
diff --git a/src/network/meson.build b/src/network/meson.build
index dc33f85a96..c5607a9b31 100644
--- a/src/network/meson.build
+++ b/src/network/meson.build
@@ -150,6 +150,14 @@ libnetworkd_core = static_library(
link_with : networkd_link_with,
build_by_default : false)
+network_test_template = test_template + {
+ 'link_with' : [
+ libnetworkd_core,
+ libsystemd_network,
+ ],
+ 'include_directories' : network_includes,
+}
+
executables += [
libexec_template + {
'name' : 'systemd-networkd',
@@ -187,6 +195,32 @@ executables += [
'sources' : network_generator_sources,
'link_with' : networkd_link_with,
},
+ test_template + {
+ 'sources' : files(
+ 'generator/test-network-generator.c',
+ 'generator/network-generator.c',
+ ),
+ 'suite' : 'network',
+ },
+ network_test_template + {
+ 'sources' : files('test-network-tables.c'),
+ 'dependencies' : threads,
+ },
+ network_test_template + {
+ 'sources' : files('test-network.c'),
+ 'dependencies' : threads,
+ },
+ network_test_template + {
+ 'sources' : files('test-networkd-address.c'),
+ 'dependencies' : libatomic,
+ },
+ network_test_template + {
+ 'sources' : files('test-networkd-conf.c'),
+ 'dependencies' : libatomic,
+ },
+ network_test_template + {
+ 'sources' : files('test-networkd-util.c'),
+ },
]
if conf.get('ENABLE_NETWORKD') == 1
@@ -227,41 +261,3 @@ fuzzers += [
'base' : fuzzer_network_base,
},
]
-
-test_network_base = {
- 'link_with' : [libnetworkd_core, libsystemd_network],
- 'includes' : network_includes,
-}
-
-tests += [
- {
- 'sources' : files(
- 'generator/test-network-generator.c',
- 'generator/network-generator.c',
- )
- },
- {
- 'sources' : files('test-network-tables.c'),
- 'dependencies' : threads,
- 'base' : test_network_base,
- },
- {
- 'sources' : files('test-network.c'),
- 'dependencies' : threads,
- 'base' : test_network_base,
- },
- {
- 'sources' : files('test-networkd-address.c'),
- 'dependencies' : libatomic,
- 'base' : test_network_base,
- },
- {
- 'sources' : files('test-networkd-conf.c'),
- 'dependencies' : libatomic,
- 'base' : test_network_base,
- },
- {
- 'sources' : files('test-networkd-util.c'),
- 'base' : test_network_base,
- },
-]
diff --git a/src/nspawn/meson.build b/src/nspawn/meson.build
index 024a19a66b..b6628c6751 100644
--- a/src/nspawn/meson.build
+++ b/src/nspawn/meson.build
@@ -40,6 +40,12 @@ nspawn_libs = [
libshared,
]
+nspawn_common_template = {
+ 'link_with' : nspawn_libs,
+ 'dependencies' : libseccomp,
+}
+nspawn_test_template = test_template + nspawn_common_template
+
executables += [
executable_template + {
'name' : 'systemd-nspawn',
@@ -51,33 +57,15 @@ executables += [
libseccomp,
],
},
-]
-
-############################################################
-
-tests += [
- {
+ nspawn_test_template + {
'sources' : files('test-nspawn-tables.c'),
- 'link_with' : [
- libnspawn_core,
- libshared,
- ],
- 'dependencies' : libseccomp,
},
- {
+ nspawn_test_template + {
'sources' : files('test-nspawn-util.c'),
- 'link_with' : [
- libnspawn_core,
- libshared,
- ],
- 'dependencies' : libseccomp,
},
- {
+ test_template + {
'sources' : files('test-patch-uid.c'),
- 'link_with' : [
- libnspawn_core,
- libshared,
- ],
+ 'link_with' : nspawn_libs,
'dependencies' : libacl,
'type' : 'manual',
},
diff --git a/src/oom/meson.build b/src/oom/meson.build
index b475fbf12c..d2f4c076e3 100644
--- a/src/oom/meson.build
+++ b/src/oom/meson.build
@@ -21,6 +21,13 @@ executables += [
'conditions' : ['ENABLE_OOMD'],
'sources' : files('oomctl.c'),
},
+ test_template + {
+ 'sources' : files(
+ 'test-oomd-util.c',
+ 'oomd-util.c',
+ ),
+ 'dependencies' : libatomic,
+ },
]
if conf.get('ENABLE_OOMD') == 1
@@ -35,13 +42,3 @@ if conf.get('ENABLE_OOMD') == 1
install_dir : pkgsysconfdir)
endif
endif
-
-tests += [
- {
- 'sources' : files(
- 'test-oomd-util.c',
- 'oomd-util.c',
- ),
- 'dependencies' : libatomic,
- },
-]
diff --git a/src/resolve/meson.build b/src/resolve/meson.build
index 4cc2459b21..e8881fb3b3 100644
--- a/src/resolve/meson.build
+++ b/src/resolve/meson.build
@@ -123,6 +123,18 @@ link_with = [
libsystemd_resolve_core,
]
+resolve_common_template = {
+ 'link_with' : [
+ libshared,
+ libsystemd_resolve_core,
+ ],
+ 'dependencies' : [
+ lib_openssl_or_gcrypt,
+ libm,
+ ],
+}
+resolve_test_template = test_template + resolve_common_template
+
executables += [
libexec_template + {
'name' : 'systemd-resolved',
@@ -147,6 +159,42 @@ executables += [
threads,
],
},
+ resolve_test_template + {
+ 'sources' : files('test-resolve-tables.c'),
+ },
+ resolve_test_template + {
+ 'sources' : files('test-dns-packet.c'),
+ },
+ resolve_test_template + {
+ 'sources' : files(
+ 'test-resolved-etc-hosts.c',
+ 'resolved-etc-hosts.c',
+ ),
+ },
+ resolve_test_template + {
+ 'sources' : files('test-resolved-packet.c'),
+ },
+ resolve_test_template + {
+ 'sources' : files('test-dnssec.c'),
+ 'conditions' : ['HAVE_OPENSSL_OR_GCRYPT'],
+ },
+ resolve_test_template + {
+ 'sources' : files('test-dnssec-complex.c'),
+ 'type' : 'manual',
+ },
+ test_template + {
+ 'sources' : [
+ files('test-resolved-stream.c'),
+ basic_dns_sources,
+ systemd_resolved_sources,
+ ],
+ 'dependencies' : [
+ lib_openssl_or_gcrypt,
+ libm,
+ systemd_resolved_dependencies,
+ ],
+ 'include_directories' : resolve_includes,
+ },
]
if conf.get('ENABLE_RESOLVE') == 1
@@ -178,56 +226,6 @@ custom_target(
############################################################
-test_resolve_base = {
- 'link_with' : [libsystemd_resolve_core, libshared],
- 'dependencies' : [lib_openssl_or_gcrypt, libm],
-}
-
-tests += [
- {
- 'sources' : files('test-resolve-tables.c'),
- 'base' : test_resolve_base,
- },
- {
- 'sources' : files('test-dns-packet.c'),
- 'base' : test_resolve_base,
- },
- {
- 'sources' : files(
- 'test-resolved-etc-hosts.c',
- 'resolved-etc-hosts.c',
- ),
- 'base' : test_resolve_base,
- },
- {
- 'sources' : files('test-resolved-packet.c'),
- 'base' : test_resolve_base,
- },
- {
- 'sources' : files('test-dnssec.c'),
- 'base' : test_resolve_base,
- 'condition' : 'HAVE_OPENSSL_OR_GCRYPT',
- },
- {
- 'sources' : files('test-dnssec-complex.c'),
- 'base' : test_resolve_base,
- 'type' : 'manual',
- },
- {
- 'sources' : [
- files('test-resolved-stream.c'),
- basic_dns_sources,
- systemd_resolved_sources,
- ],
- 'dependencies' : [
- lib_openssl_or_gcrypt,
- libm,
- systemd_resolved_dependencies,
- ],
- 'includes' : resolve_includes,
- },
-]
-
fuzzer_resolve_base = {
'link_with' : [libsystemd_resolve_core, libshared],
'dependencies' : [lib_openssl_or_gcrypt, libm],
diff --git a/src/shutdown/meson.build b/src/shutdown/meson.build
index 0b16c431b4..219f9fd308 100644
--- a/src/shutdown/meson.build
+++ b/src/shutdown/meson.build
@@ -28,10 +28,7 @@ executables += [
'build_by_default' : have_standalone_binaries,
'install' : have_standalone_binaries,
},
-]
-
-tests += [
- {
+ test_template + {
'sources' : files(
'test-umount.c',
'detach-swap.c',
diff --git a/src/test/meson.build b/src/test/meson.build
index 0d4dfa7f7e..0f7dc8f9d2 100644
--- a/src/test/meson.build
+++ b/src/test/meson.build
@@ -39,8 +39,6 @@ test_libudev_sym_c = custom_target(
capture : true,
build_by_default : want_tests != 'false')
-test_dlopen_c = files('test-dlopen.c')
-
############################################################
simple_tests += files(
@@ -195,49 +193,49 @@ common_test_dependencies = [
threads,
]
-tests += [
- {
+executables += [
+ test_template + {
'sources' : files('test-acl-util.c'),
- 'condition' : 'HAVE_ACL',
+ 'conditions' : ['HAVE_ACL'],
},
- {
+ test_template + {
'sources' : files('test-af-list.c') +
generated_gperf_headers,
},
- {
+ test_template + {
'sources' : files('test-arphrd-util.c') +
generated_gperf_headers,
},
- {
+ test_template + {
'sources' : files('test-ask-password-api.c'),
'type' : 'manual',
},
- {
+ test_template + {
'sources' : files('test-async.c'),
'timeout' : 120,
},
- {
+ test_template + {
'sources' : files('test-boot-timestamps.c'),
- 'condition' : 'ENABLE_EFI',
+ 'conditions' : ['ENABLE_EFI'],
},
- {
+ test_template + {
'sources' : files('test-btrfs.c'),
'type' : 'manual',
},
- {
+ test_template + {
'sources' : files('test-cap-list.c') +
generated_gperf_headers,
'dependencies' : libcap,
},
- {
+ test_template + {
'sources' : files('test-capability.c'),
'dependencies' : libcap,
},
- {
+ test_template + {
'sources' : files('test-chase-manual.c'),
'type' : 'manual',
},
- {
+ test_template + {
'sources' : files('test-compress-benchmark.c'),
'link_with' : [
libbasic_compress,
@@ -245,144 +243,152 @@ tests += [
],
'timeout' : 90,
},
- {
+ test_template + {
'sources' : files('test-compress.c'),
'link_with' : [
libbasic_compress,
libshared,
],
},
- {
+ test_template + {
'sources' : files('test-cryptolib.c'),
- 'link_with' : libshared,
'dependencies' : lib_openssl_or_gcrypt,
- 'condition' : 'HAVE_OPENSSL_OR_GCRYPT',
+ 'conditions' : ['HAVE_OPENSSL_OR_GCRYPT'],
},
- {
+ test_template + {
'sources' : files('test-dlopen-so.c'),
'dependencies' : libp11kit_cflags
},
- {
+ test_template + {
+ # only static linking apart from libdl, to make sure that the
+ # module is linked to all libraries that it uses.
+ 'sources' : files('test-dlopen.c'),
+ 'link_with' : libbasic,
+ 'dependencies' : libdl,
+ 'install' : false,
+ 'type' : 'manual',
+ },
+ test_template + {
'sources' : files('test-errno-list.c') +
generated_gperf_headers,
},
- {
+ test_template + {
'sources' : files('test-fd-util.c'),
'dependencies' : libseccomp,
},
- {
+ test_template + {
'sources' : files(
- 'test-hashmap.c',
- 'test-hashmap-plain.c',
- ) + [
- test_hashmap_ordered_c,
- ],
+ 'test-hashmap.c',
+ 'test-hashmap-plain.c',
+ ) + [
+ test_hashmap_ordered_c,
+ ],
'timeout' : 180,
},
- {
+ test_template + {
'sources' : files('test-ip-protocol-list.c') +
shared_generated_gperf_headers,
},
- {
+ test_template + {
'sources' : files('test-ipcrm.c'),
'type' : 'unsafe',
},
- {
+ test_template + {
'sources' : files('test-json.c'),
'dependencies' : libm,
},
- {
+ test_template + {
'sources' : files('test-libcrypt-util.c'),
'dependencies' : libcrypt,
'timeout' : 120,
},
- {
+ test_template + {
'sources' : files('test-libmount.c'),
'dependencies' : [
libmount,
threads,
],
},
- {
+ test_template + {
'sources' : files('test-loopback.c'),
'dependencies' : common_test_dependencies,
},
- {
+ test_template + {
'sources' : files('test-math-util.c'),
'dependencies' : libm,
},
- {
+ test_template + {
'sources' : files('test-mempress.c'),
'dependencies' : threads,
},
- {
+ test_template + {
'sources' : files('test-mount-util.c'),
'dependencies' : libmount,
},
- {
+ test_template + {
'sources' : files('test-netlink-manual.c'),
'dependencies' : libkmod,
- 'condition' : 'HAVE_KMOD',
+ 'conditions' : ['HAVE_KMOD'],
'type' : 'manual',
},
- {
+ test_template + {
'sources' : files('test-nscd-flush.c'),
- 'condition' : 'ENABLE_NSCD',
+ 'conditions' : ['ENABLE_NSCD'],
'type' : 'manual',
},
- {
+ test_template + {
'sources' : files(
'test-nss-hosts.c',
'nss-test-util.c',
),
'dependencies' : libdl,
- 'condition' : 'ENABLE_NSS',
+ 'conditions' : ['ENABLE_NSS'],
'timeout' : 120,
},
- {
+ test_template + {
'sources' : files(
'test-nss-users.c',
'nss-test-util.c',
),
'dependencies' : libdl,
- 'condition' : 'ENABLE_NSS',
+ 'conditions' : ['ENABLE_NSS'],
},
- {
+ test_template + {
'sources' : files('test-parse-util.c'),
'dependencies' : libm,
},
- {
+ test_template + {
'sources' : files('test-process-util.c'),
'dependencies' : threads,
},
- {
+ test_template + {
'sources' : files('test-qrcode-util.c'),
'dependencies' : libdl,
},
- {
+ test_template + {
'sources' : files('test-random-util.c'),
'dependencies' : libm,
'timeout' : 120,
},
- {
+ test_template + {
'sources' : files('test-sbat.c'),
- 'condition' : 'ENABLE_BOOTLOADER',
+ 'conditions' : ['ENABLE_BOOTLOADER'],
'c_args' : '-I@0@'.format(efi_config_h_dir),
},
- {
+ test_template + {
'sources' : files('test-seccomp.c'),
'dependencies' : libseccomp,
- 'condition' : 'HAVE_SECCOMP',
+ 'conditions' : ['HAVE_SECCOMP'],
},
- {
+ test_template + {
'sources' : files('test-set-disable-mempool.c'),
'dependencies' : threads,
},
- {
+ test_template + {
'sources' : files('test-sizeof.c'),
'link_with' : libbasic,
},
- {
+ test_template + {
'sources' : files('test-tables.c'),
'link_with' : [
libcore,
@@ -399,175 +405,190 @@ tests += [
libxz,
threads,
],
- 'includes' : [
+ 'include_directories' : [
core_includes,
journal_includes,
udev_includes,
],
},
- {
+ test_template + {
'sources' : files('test-time-util.c'),
'timeout' : 120,
},
- {
+ test_template + {
'sources' : files('test-utmp.c'),
- 'condition' : 'ENABLE_UTMP',
+ 'conditions' : ['ENABLE_UTMP'],
},
- {
+ test_template + {
'sources' : files('test-varlink.c'),
'dependencies' : threads,
},
- {
+ test_template + {
'sources' : files('test-watchdog.c'),
'type' : 'unsafe',
},
+ # Symbol tests
+ test_template + {
+ 'name' : 'test-libsystemd-sym',
+ 'sources' : test_libsystemd_sym_c,
+ 'link_with' : libsystemd,
+ 'suite' : 'libsystemd',
+ },
+ test_template + {
+ 'name' : 'test-libsystemd-static-sym',
+ 'sources' : test_libsystemd_sym_c,
+ 'link_with' : install_libsystemd_static,
+ 'build_by_default' : want_tests != 'false' and static_libsystemd != 'false',
+ 'install' : install_tests and static_libsystemd != 'false',
+ 'suite' : 'libsystemd',
+ },
+ test_template + {
+ 'name' : 'test-libudev-sym',
+ 'sources' : test_libudev_sym_c,
+ 'include_directories' : libudev_includes,
+ 'c_args' : ['-Wno-deprecated-declarations'] + test_cflags,
+ 'link_with' : libudev,
+ 'suite' : 'libudev',
+ },
+ test_template + {
+ 'name' : 'test-libudev-static-sym',
+ 'sources' : test_libudev_sym_c,
+ 'include_directories' : libudev_includes,
+ 'c_args' : ['-Wno-deprecated-declarations'] + test_cflags,
+ 'link_with' : install_libudev_static,
+ 'build_by_default' : want_tests != 'false' and static_libudev != 'false',
+ 'install' : install_tests and static_libudev != 'false',
+ 'suite' : 'libudev',
+ },
# Tests that link to libcore, i.e. tests for pid1 code.
- {
+ core_test_template + {
'sources' : files('test-bpf-devices.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-bpf-firewall.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-bpf-foreign-programs.c'),
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-bpf-lsm.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-cgroup-cpu.c'),
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-cgroup-mask.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-cgroup-unit-default.c'),
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-chown-rec.c'),
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-core-unit.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-emergency-action.c'),
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-engine.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-execute.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
'timeout' : 360,
},
- {
+ core_test_template + {
'sources' : files('test-install.c'),
- 'base' : test_core_base,
'type' : 'manual',
},
- {
+ core_test_template + {
'sources' : files('test-job-type.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-load-fragment.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-loop-block.c'),
'dependencies' : [threads, libblkid],
- 'base' : test_core_base,
'parallel' : false,
},
- {
+ core_test_template + {
'sources' : files('test-manager.c'),
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-namespace.c'),
'dependencies' : [
libblkid,
threads,
],
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-ns.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
'type' : 'manual',
},
- {
+ core_test_template + {
'sources' : files('test-path.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
'timeout' : 120,
},
- {
+ core_test_template + {
'sources' : files('test-sched-prio.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-socket-bind.c'),
'dependencies' : libdl,
- 'condition' : 'BPF_FRAMEWORK',
- 'base' : test_core_base,
+ 'conditions' : ['BPF_FRAMEWORK'],
},
- {
+ core_test_template + {
'sources' : files('test-unit-name.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-unit-serialize.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
- {
+ core_test_template + {
'sources' : files('test-watch-pid.c'),
'dependencies' : common_test_dependencies,
- 'base' : test_core_base,
},
# Tests from other directories that have link_with deps that were not defined earlier
- {
+ test_template + {
'sources' : files('../libsystemd/sd-bus/test-bus-error.c'),
'link_with' : [
libshared_static,
libsystemd_static,
],
},
- {
+ test_template + {
'sources' : files('../libsystemd/sd-device/test-sd-device-thread.c'),
'link_with' : libsystemd,
'dependencies' : threads,
},
- {
+ test_template + {
'sources' : files('../libudev/test-udev-device-thread.c'),
'link_with' : libudev,
'dependencies' : threads,
},
+ test_template + {
+ 'sources' : files('../libudev/test-libudev.c'),
+ 'link_with' : [
+ libshared,
+ libudev_basic,
+ ],
+ },
]
diff --git a/src/timesync/meson.build b/src/timesync/meson.build
index 54ae6a9e73..27367e311e 100644
--- a/src/timesync/meson.build
+++ b/src/timesync/meson.build
@@ -50,6 +50,14 @@ executables += [
'sources' : files('wait-sync.c'),
'link_with' : libtimesyncd_core,
},
+ test_template + {
+ 'sources' : files('test-timesync.c'),
+ 'link_with' : [
+ libshared,
+ libtimesyncd_core,
+ ],
+ 'dependencies' : libm,
+ },
]
custom_target(
@@ -70,16 +78,3 @@ if conf.get('ENABLE_TIMESYNCD') == 1
install_data('org.freedesktop.timesync1.policy',
install_dir : polkitpolicydir)
endif
-
-############################################################
-
-tests += [
- {
- 'sources' : files('test-timesync.c'),
- 'link_with' : [
- libshared,
- libtimesyncd_core,
- ],
- 'dependencies' : libm,
- },
-]
diff --git a/src/tmpfiles/meson.build b/src/tmpfiles/meson.build
index 892c09b168..8a24a21a27 100644
--- a/src/tmpfiles/meson.build
+++ b/src/tmpfiles/meson.build
@@ -29,10 +29,7 @@ executables += [
'build_by_default' : have_standalone_binaries,
'install' : have_standalone_binaries,
},
-]
-
-tests += [
- {
+ test_template + {
'sources' : files(
'test-offline-passwd.c',
'offline-passwd.c',
diff --git a/src/udev/meson.build b/src/udev/meson.build
index 9807648592..b99e313722 100644
--- a/src/udev/meson.build
+++ b/src/udev/meson.build
@@ -116,6 +116,14 @@ libudevd_core = static_library(
userspace],
build_by_default : false)
+udev_dependencies = [
+ libacl,
+ libblkid,
+ libidn,
+ libkmod,
+ threads,
+]
+
udev_plugin_template = executable_template + {
'public' : true,
'link_with' : udev_link_with,
@@ -123,19 +131,25 @@ udev_plugin_template = executable_template + {
'install_dir' : udevlibexecdir,
}
+udev_common_template = {
+ 'link_with' : [
+ libshared,
+ libudevd_core,
+ ],
+ 'dependencies' : [
+ libacl,
+ threads,
+ ],
+}
+udev_test_template = test_template + udev_common_template
+
executables += [
executable_template + {
'name' : 'udevadm',
'public' : true,
'sources' : udevadm_sources,
'link_with' : [libudevd_core],
- 'dependencies' : [
- libacl,
- libblkid,
- libidn,
- libkmod,
- threads,
- ],
+ 'dependencies' : udev_dependencies,
'install_rpath' : udev_rpath,
},
udev_plugin_template + {
@@ -180,6 +194,38 @@ executables += [
'name' : 'v4l_id',
'sources' : files('v4l_id/v4l_id.c'),
},
+ test_template + {
+ 'sources' : files(
+ 'fido_id/test-fido-id-desc.c',
+ 'fido_id/fido_id_desc.c',
+ ),
+ 'suite' : 'udev',
+ },
+ udev_test_template + {
+ 'sources' : files('test-udev-builtin.c'),
+ },
+ udev_test_template + {
+ 'sources' : files('test-udev-format.c'),
+ },
+ udev_test_template + {
+ 'sources' : files('test-udev-manager.c'),
+ },
+ udev_test_template + {
+ 'sources' : files('test-udev-node.c'),
+ },
+ udev_test_template + {
+ 'sources' : files('test-udev-rule-runner.c'),
+ 'dependencies' : udev_dependencies + [
+ libselinux,
+ ],
+ 'type' : 'manual',
+ },
+ udev_test_template + {
+ 'sources' : files('test-udev-rules.c'),
+ },
+ udev_test_template + {
+ 'sources' : files('test-udev-spawn.c'),
+ },
]
meson.add_install_script(meson_make_symlink,
@@ -233,58 +279,3 @@ fuzzers += [
),
},
]
-
-test_libudev_base = {
- 'link_with' : [libudevd_core, libshared],
- 'dependencies' : [threads, libacl],
-}
-
-tests += [
- {
- 'sources' : files(
- 'fido_id/test-fido-id-desc.c',
- 'fido_id/fido_id_desc.c',
- ),
- },
- {
- 'sources' : files('test-udev-builtin.c'),
- 'base' : test_libudev_base,
- },
- {
- 'sources' : files('test-udev-format.c'),
- 'base' : test_libudev_base,
- },
- {
- 'sources' : files('test-udev-manager.c'),
- 'base' : test_libudev_base,
- },
- {
- 'sources' : files('test-udev-node.c'),
- 'base' : test_libudev_base,
- },
- {
- 'sources' : files('test-udev-rule-runner.c'),
- 'link_with' : [
- libshared,
- libudevd_core,
- ],
- 'dependencies' : [
- libacl,
- libblkid,
- libkmod,
- librt,
- libselinux,
- threads,
- ],
- 'includes' : udev_includes,
- 'type' : 'manual',
- },
- {
- 'sources' : files('test-udev-rules.c'),
- 'base' : test_libudev_base,
- },
- {
- 'sources' : files('test-udev-spawn.c'),
- 'base' : test_libudev_base,
- },
-]
diff --git a/src/xdg-autostart-generator/meson.build b/src/xdg-autostart-generator/meson.build
index 8eea9322ae..238dde8fd0 100644
--- a/src/xdg-autostart-generator/meson.build
+++ b/src/xdg-autostart-generator/meson.build
@@ -17,10 +17,7 @@ executables += [
'conditions' : ['ENABLE_XDG_AUTOSTART'],
'sources' : files('xdg-autostart-condition.c'),
},
-]
-
-tests += [
- {
+ test_template + {
'sources' : files(
'test-xdg-autostart.c',
'xdg-autostart-service.c',
diff --git a/test/meson.build b/test/meson.build
index 99f50828a3..a5bcc128cc 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -229,7 +229,15 @@ endif
sys_script_py = files('sys-script.py')
test_udev_py = files('test-udev.py')
-
+if want_tests != 'false'
+ exe = executables_by_name.get('test-udev-rule-runner')
+ test('test-udev',
+ test_udev_py,
+ args : ['-v'],
+ env : ['UDEV_RULE_RUNNER=' + exe.full_path()],
+ depends : exe,
+ timeout : 180)
+endif
if install_tests
install_data(
sys_script_py,