1 # SPDX-License-Identifier: LGPL-2.1-or-later
9 'test-fstab-generator',
14 'test-network-generator-conversion',
27 install_subdir(subdir,
28 exclude_files : '.gitattributes',
29 install_dir : testdata_dir)
32 install_data(kbd_model_map,
33 install_dir : testdata_dir + '/test-keymap-util')
35 testsuite08_dir = testdata_dir + '/testsuite-08.units'
36 install_data('testsuite-08.units/-.mount',
37 install_dir : testsuite08_dir)
38 install_data('testsuite-08.units/systemd-remount-fs.service',
39 install_dir : testsuite08_dir)
40 meson.add_install_script(meson_make_symlink,
42 testsuite08_dir + '/root.mount')
43 meson.add_install_script(meson_make_symlink,
45 testsuite08_dir + '/local-fs.target.wants/-.mount')
47 if conf.get('HAVE_ZSTD') == 1 and efi_arch != ''
48 install_subdir('test-bcd',
49 exclude_files : '.gitattributes',
50 install_dir : testdata_dir)
52 if conf.get('ENABLE_RESOLVE') == 1
53 install_subdir('test-resolve',
54 exclude_files : '.gitattributes',
55 install_dir : testdata_dir)
58 install_data('create-busybox-container',
59 install_mode : 'rwxr-xr-x',
60 install_dir : testdata_dir)
62 # The unit tests implemented as shell scripts expect to find testdata/
63 # in the directory where they are stored.
64 meson.add_install_script(meson_make_symlink,
66 unittestsdir / 'testdata')
69 test_bootctl_json_sh = find_program('test-bootctl-json.sh')
70 test_fstab_generator_sh = find_program('test-fstab-generator.sh')
71 test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh')
72 test_systemctl_enable_sh = find_program('test-systemctl-enable.sh')
73 test_systemd_tmpfiles_py = find_program('test-systemd-tmpfiles.py')
74 hwdb_test_sh = find_program('hwdb-test.sh')
76 ############################################################
78 test_sysusers_sh = configure_file(
79 input : 'test-sysusers.sh.in',
80 output : 'test-sysusers.sh',
82 if install_tests and conf.get('ENABLE_SYSUSERS') == 1
83 install_data(test_sysusers_sh,
84 install_dir : unittestsdir)
85 install_subdir('test-sysusers',
86 exclude_files : '.gitattributes',
87 install_dir : testdata_dir)
90 ############################################################
92 test_compare_versions_sh = files('test-compare-versions.sh')
94 install_data(test_compare_versions_sh,
95 install_dir : unittestsdir)
98 ############################################################
100 rule_syntax_check_py = find_program('rule-syntax-check.py')
101 if want_tests != 'false'
102 test('rule-syntax-check',
103 rule_syntax_check_py,
104 suite : 'dist-check',
108 ############################################################
111 install_data('run-unit-tests.py',
112 install_mode : 'rwxr-xr-x',
113 install_dir : testsdir)
115 install_data('test-fstab-generator.sh',
116 install_mode : 'rwxr-xr-x',
117 install_dir : unittestsdir)
119 install_data('test-network-generator-conversion.sh',
120 install_mode : 'rwxr-xr-x',
121 install_dir : unittestsdir)
124 ############################################################
126 # prepare test/sys tree
127 sys_script_py = find_program('sys-script.py')
130 command : [sys_script_py, meson.current_build_dir()],
132 build_by_default : want_tests != 'false')
135 udev_test_pl = find_program('udev-test.pl')
136 if want_tests != 'false'
142 message('Skipping udev-test because perl is not available')
145 if want_tests != 'false'
147 files('udev-test.py'),
152 ############################################################
154 rpm = find_program('rpm', required : false)
155 rpmspec = find_program('rpmspec', required : false)
156 test_rpm_macros = find_program('test-rpm-macros.sh')
158 if rpm.found() and rpmspec.found()
159 if want_tests != 'false'
160 test('test-rpm-macros',
162 suite : 'dist-check',
163 args : [project_build_root])
166 message('Skipping test-rpm-macros since rpm and/or rpmspec are not available')
169 ############################################################
171 if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
172 udev_dmi_memory_id_test = find_program('udev-dmi-memory-id-test.sh')
174 if git.found() and fs.is_dir(project_source_root / '.git')
176 env, '-u', 'GIT_WORK_TREE',
177 git, '--git-dir=@0@/.git'.format(project_source_root),
178 'ls-files', ':/test/dmidecode-dumps/*.bin',
182 sh, '-c', 'cd "$1"; echo test/dmidecode-dumps/*.bin', '_', project_source_root,
186 foreach p : out.stdout().split()
187 source = project_source_root / p
188 name = 'dmidecode_' + p.split('/')[-1].split('.')[0]
191 udev_dmi_memory_id_test,
192 suite : 'dist-check',
193 args : [udev_prog_paths['dmi_memory_id'].full_path(),
196 depends : udev_prog_paths['dmi_memory_id'])