]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/meson.build
test: rewrite udev-test.pl in Python
[thirdparty/systemd.git] / test / meson.build
CommitLineData
db9ecf05 1# SPDX-License-Identifier: LGPL-2.1-or-later
3a726fcd 2
a18c7865 3if install_tests
2f809d29
ZJS
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',
3ceb96e0 13 'test-network',
2f809d29
ZJS
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
80769cb6 31
be0cc2ce
FB
32 install_data(kbd_model_map,
33 install_dir : testdata_dir + '/test-keymap-util')
34
a18c7865
ZJS
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')
4ff3f251 46
e8509329 47 if conf.get('HAVE_ZSTD') == 1 and efi_arch != ''
db7f5ab6
JJ
48 install_subdir('test-bcd',
49 exclude_files : '.gitattributes',
50 install_dir : testdata_dir)
51 endif
a18c7865
ZJS
52 if conf.get('ENABLE_RESOLVE') == 1
53 install_subdir('test-resolve',
082c6761 54 exclude_files : '.gitattributes',
a18c7865
ZJS
55 install_dir : testdata_dir)
56 endif
c8475239 57
a18c7865
ZJS
58 install_data('create-busybox-container',
59 install_mode : 'rwxr-xr-x',
60 install_dir : testdata_dir)
c18cc7f7
FB
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')
4ff3f251
ZJS
67endif
68
50f2c32c 69test_bootctl_json_sh = find_program('test-bootctl-json.sh')
8cc8a073 70test_fstab_generator_sh = find_program('test-fstab-generator.sh')
fbaa1137 71test_network_generator_conversion_sh = find_program('test-network-generator-conversion.sh')
50c5f5a3 72test_systemctl_enable_sh = find_program('test-systemctl-enable.sh')
0703d2f6 73test_systemd_tmpfiles_py = find_program('test-systemd-tmpfiles.py')
ecd1bfdd 74hwdb_test_sh = find_program('hwdb-test.sh')
0703d2f6
YW
75
76############################################################
77
bd7e6aa7
ZJS
78test_sysusers_sh = configure_file(
79 input : 'test-sysusers.sh.in',
80 output : 'test-sysusers.sh',
097c072d 81 configuration : conf)
bd7e6aa7
ZJS
82if install_tests and conf.get('ENABLE_SYSUSERS') == 1
83 install_data(test_sysusers_sh,
26c2b302 84 install_dir : unittestsdir)
bd7e6aa7 85 install_subdir('test-sysusers',
082c6761 86 exclude_files : '.gitattributes',
bd7e6aa7
ZJS
87 install_dir : testdata_dir)
88endif
89
90############################################################
91
4e8295f4
ZJS
92test_compare_versions_sh = files('test-compare-versions.sh')
93if install_tests
94 install_data(test_compare_versions_sh,
26c2b302 95 install_dir : unittestsdir)
4e8295f4
ZJS
96endif
97
98############################################################
99
6b97bf22 100rule_syntax_check_py = find_program('rule-syntax-check.py')
938be089
ZJS
101if want_tests != 'false'
102 test('rule-syntax-check',
103 rule_syntax_check_py,
14056a52 104 suite : 'dist-check',
938be089
ZJS
105 args : all_rules)
106endif
6b97bf22
ZJS
107
108############################################################
109
3762f8e3
ZJS
110if install_tests
111 install_data('run-unit-tests.py',
112 install_mode : 'rwxr-xr-x',
113 install_dir : testsdir)
14055702 114
8cc8a073
YW
115 install_data('test-fstab-generator.sh',
116 install_mode : 'rwxr-xr-x',
26c2b302 117 install_dir : unittestsdir)
8cc8a073 118
b322e683
YW
119 install_data('test-network-generator-conversion.sh',
120 install_mode : 'rwxr-xr-x',
26c2b302 121 install_dir : unittestsdir)
3762f8e3
ZJS
122endif
123
124############################################################
125
b7191b2a
ZJS
126# prepare test/sys tree
127sys_script_py = find_program('sys-script.py')
128custom_target(
129 'sys',
130 command : [sys_script_py, meson.current_build_dir()],
131 output : 'sys',
fd1939fb 132 build_by_default : want_tests != 'false')
b7191b2a 133
b1ffacb6
ZJS
134if perl.found()
135 udev_test_pl = find_program('udev-test.pl')
938be089 136 if want_tests != 'false'
f2c02d23 137 test('udev-test.pl',
bb0e9604
FS
138 udev_test_pl,
139 timeout : 180)
938be089 140 endif
b1ffacb6
ZJS
141else
142 message('Skipping udev-test because perl is not available')
143endif
fdf666bc 144
f2c02d23
ZJS
145if want_tests != 'false'
146 test('udev-test.py',
147 files('udev-test.py'),
148 args : ['-v'],
149 timeout : 180)
150endif
151
2b7b142e
ZJS
152############################################################
153
55c09511
FS
154rpm = find_program('rpm', required : false)
155rpmspec = find_program('rpmspec', required : false)
156test_rpm_macros = find_program('test-rpm-macros.sh')
157
158if rpm.found() and rpmspec.found()
159 if want_tests != 'false'
160 test('test-rpm-macros',
161 test_rpm_macros,
14056a52 162 suite : 'dist-check',
55c09511
FS
163 args : [project_build_root])
164 endif
165else
166 message('Skipping test-rpm-macros since rpm and/or rpmspec are not available')
167endif
168
169############################################################
170
2b7b142e 171if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
4dd465cb 172 udev_dmi_memory_id_test = find_program('udev-dmi-memory-id-test.sh')
2b7b142e 173
edd84b8e 174 if git.found() and fs.is_dir(project_source_root / '.git')
2b7b142e 175 out = run_command(
0f4c4f38
ZJS
176 env, '-u', 'GIT_WORK_TREE',
177 git, '--git-dir=@0@/.git'.format(project_source_root),
68a06b3c
JJ
178 'ls-files', ':/test/dmidecode-dumps/*.bin',
179 check: true)
2b7b142e
ZJS
180 else
181 out = run_command(
ac3eda34 182 sh, '-c', 'cd "$1"; echo test/dmidecode-dumps/*.bin', '_', project_source_root,
68a06b3c 183 check: true)
2b7b142e
ZJS
184 endif
185
186 foreach p : out.stdout().split()
fce9abb2 187 source = project_source_root / p
2b7b142e
ZJS
188 name = 'dmidecode_' + p.split('/')[-1].split('.')[0]
189
190 test(name,
191 udev_dmi_memory_id_test,
14056a52 192 suite : 'dist-check',
e93ada98 193 args : [udev_prog_paths['dmi_memory_id'].full_path(),
0b5f1bd4 194 source,
e93ada98
DDM
195 source + '.txt'],
196 depends : udev_prog_paths['dmi_memory_id'])
2b7b142e 197 endforeach
4dd465cb
BN
198endif
199
c74a3f97 200subdir('fuzz')