]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/meson.build
test: rewrite udev-test.pl in Python
[thirdparty/systemd.git] / test / meson.build
1 # SPDX-License-Identifier: LGPL-2.1-or-later
2
3 if install_tests
4 foreach subdir : [
5 'auxv',
6 'journal-data',
7 'units',
8 'test-execute',
9 'test-fstab-generator',
10 'test-path',
11 'test-path-util',
12 'test-umount',
13 'test-network',
14 'test-network-generator-conversion',
15 'testsuite-03.units',
16 'testsuite-04.units',
17 'testsuite-06.units',
18 'testsuite-10.units',
19 'testsuite-11.units',
20 'testsuite-16.units',
21 'testsuite-28.units',
22 'testsuite-30.units',
23 'testsuite-52.units',
24 'testsuite-63.units',
25 'testsuite-80.units',
26 ]
27 install_subdir(subdir,
28 exclude_files : '.gitattributes',
29 install_dir : testdata_dir)
30 endforeach
31
32 install_data(kbd_model_map,
33 install_dir : testdata_dir + '/test-keymap-util')
34
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,
41 './-.mount',
42 testsuite08_dir + '/root.mount')
43 meson.add_install_script(meson_make_symlink,
44 '../-.mount',
45 testsuite08_dir + '/local-fs.target.wants/-.mount')
46
47 if conf.get('HAVE_ZSTD') == 1 and efi_arch != ''
48 install_subdir('test-bcd',
49 exclude_files : '.gitattributes',
50 install_dir : testdata_dir)
51 endif
52 if conf.get('ENABLE_RESOLVE') == 1
53 install_subdir('test-resolve',
54 exclude_files : '.gitattributes',
55 install_dir : testdata_dir)
56 endif
57
58 install_data('create-busybox-container',
59 install_mode : 'rwxr-xr-x',
60 install_dir : testdata_dir)
61
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,
65 testdata_dir,
66 unittestsdir / 'testdata')
67 endif
68
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')
75
76 ############################################################
77
78 test_sysusers_sh = configure_file(
79 input : 'test-sysusers.sh.in',
80 output : 'test-sysusers.sh',
81 configuration : conf)
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)
88 endif
89
90 ############################################################
91
92 test_compare_versions_sh = files('test-compare-versions.sh')
93 if install_tests
94 install_data(test_compare_versions_sh,
95 install_dir : unittestsdir)
96 endif
97
98 ############################################################
99
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',
105 args : all_rules)
106 endif
107
108 ############################################################
109
110 if install_tests
111 install_data('run-unit-tests.py',
112 install_mode : 'rwxr-xr-x',
113 install_dir : testsdir)
114
115 install_data('test-fstab-generator.sh',
116 install_mode : 'rwxr-xr-x',
117 install_dir : unittestsdir)
118
119 install_data('test-network-generator-conversion.sh',
120 install_mode : 'rwxr-xr-x',
121 install_dir : unittestsdir)
122 endif
123
124 ############################################################
125
126 # prepare test/sys tree
127 sys_script_py = find_program('sys-script.py')
128 custom_target(
129 'sys',
130 command : [sys_script_py, meson.current_build_dir()],
131 output : 'sys',
132 build_by_default : want_tests != 'false')
133
134 if perl.found()
135 udev_test_pl = find_program('udev-test.pl')
136 if want_tests != 'false'
137 test('udev-test.pl',
138 udev_test_pl,
139 timeout : 180)
140 endif
141 else
142 message('Skipping udev-test because perl is not available')
143 endif
144
145 if want_tests != 'false'
146 test('udev-test.py',
147 files('udev-test.py'),
148 args : ['-v'],
149 timeout : 180)
150 endif
151
152 ############################################################
153
154 rpm = find_program('rpm', required : false)
155 rpmspec = find_program('rpmspec', required : false)
156 test_rpm_macros = find_program('test-rpm-macros.sh')
157
158 if rpm.found() and rpmspec.found()
159 if want_tests != 'false'
160 test('test-rpm-macros',
161 test_rpm_macros,
162 suite : 'dist-check',
163 args : [project_build_root])
164 endif
165 else
166 message('Skipping test-rpm-macros since rpm and/or rpmspec are not available')
167 endif
168
169 ############################################################
170
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')
173
174 if git.found() and fs.is_dir(project_source_root / '.git')
175 out = run_command(
176 env, '-u', 'GIT_WORK_TREE',
177 git, '--git-dir=@0@/.git'.format(project_source_root),
178 'ls-files', ':/test/dmidecode-dumps/*.bin',
179 check: true)
180 else
181 out = run_command(
182 sh, '-c', 'cd "$1"; echo test/dmidecode-dumps/*.bin', '_', project_source_root,
183 check: true)
184 endif
185
186 foreach p : out.stdout().split()
187 source = project_source_root / p
188 name = 'dmidecode_' + p.split('/')[-1].split('.')[0]
189
190 test(name,
191 udev_dmi_memory_id_test,
192 suite : 'dist-check',
193 args : [udev_prog_paths['dmi_memory_id'].full_path(),
194 source,
195 source + '.txt'],
196 depends : udev_prog_paths['dmi_memory_id'])
197 endforeach
198 endif
199
200 subdir('fuzz')