meson: make each dmidecode a separate test
This allows them to be executed in parallel and also gives us better reporting. The dump files are renamed to avoid repeating "dmidecode-dump", since that string is already present in the subdirectory name.
This commit is contained in:
parent
68f18549c5
commit
2b7b142e97
|
@ -184,15 +184,23 @@ if dmi_arches.contains(host_machine.cpu_family())
|
||||||
endif
|
endif
|
||||||
|
|
||||||
foreach prog : udev_id_progs
|
foreach prog : udev_id_progs
|
||||||
executable(prog[0].split('/')[0],
|
name = prog[0].split('/')[0]
|
||||||
prog,
|
|
||||||
include_directories : includes,
|
exe = executable(
|
||||||
c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
|
name,
|
||||||
dependencies : [versiondep],
|
prog,
|
||||||
link_with : udev_link_with,
|
include_directories : includes,
|
||||||
install_rpath : udev_rpath,
|
c_args : ['-DLOG_REALM=LOG_REALM_UDEV'],
|
||||||
install : true,
|
dependencies : [versiondep],
|
||||||
install_dir : udevlibexecdir)
|
link_with : udev_link_with,
|
||||||
|
install_rpath : udev_rpath,
|
||||||
|
install : true,
|
||||||
|
install_dir : udevlibexecdir)
|
||||||
|
|
||||||
|
# TODO: let's use a dictionary instead as soon as we can depend on meson >= 0.47.
|
||||||
|
if name == 'dmi_memory_id'
|
||||||
|
dmi_memory_id_path = exe.full_path()
|
||||||
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
if install_sysconfdir
|
if install_sysconfdir
|
||||||
|
|
|
@ -124,6 +124,8 @@ else
|
||||||
message('Skipping udev-test because perl is not available')
|
message('Skipping udev-test because perl is not available')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
############################################################
|
||||||
|
|
||||||
if conf.get('ENABLE_HWDB') == 1
|
if conf.get('ENABLE_HWDB') == 1
|
||||||
hwdb_test_sh = find_program('hwdb-test.sh')
|
hwdb_test_sh = find_program('hwdb-test.sh')
|
||||||
if want_tests != 'false'
|
if want_tests != 'false'
|
||||||
|
@ -133,11 +135,29 @@ if conf.get('ENABLE_HWDB') == 1
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if want_tests != false and dmi_arches.contains(host_machine.cpu_family())
|
############################################################
|
||||||
|
|
||||||
|
if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family())
|
||||||
udev_dmi_memory_id_test = find_program('udev-dmi-memory-id-test.sh')
|
udev_dmi_memory_id_test = find_program('udev-dmi-memory-id-test.sh')
|
||||||
test('udev-dmi-memory-id-test',
|
|
||||||
udev_dmi_memory_id_test,
|
if git.found()
|
||||||
timeout : 90)
|
out = run_command(
|
||||||
|
git,
|
||||||
|
'--git-dir=@0@/.git'.format(project_source_root),
|
||||||
|
'ls-files', ':/test/dmidecode-dumps/*.bin')
|
||||||
|
else
|
||||||
|
out = run_command(
|
||||||
|
'sh', '-c', 'ls @0@/test/dmidecode-dumps/*.bin'.format(project_source_root))
|
||||||
|
endif
|
||||||
|
|
||||||
|
foreach p : out.stdout().split()
|
||||||
|
source = join_paths(project_source_root, p)
|
||||||
|
name = 'dmidecode_' + p.split('/')[-1].split('.')[0]
|
||||||
|
|
||||||
|
test(name,
|
||||||
|
udev_dmi_memory_id_test,
|
||||||
|
args : [dmi_memory_id_path, source, source + '.txt'])
|
||||||
|
endforeach
|
||||||
endif
|
endif
|
||||||
|
|
||||||
subdir('fuzz')
|
subdir('fuzz')
|
||||||
|
|
|
@ -1,31 +1,17 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
#
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
export SYSTEMD_LOG_LEVEL=info
|
dmi_memory_id="$1"
|
||||||
ROOTDIR=$(dirname $(dirname $(readlink -f $0)))
|
input="$2"
|
||||||
UDEV_DMI_MEMORY_ID=./src/udev/dmi_memory_id
|
expected="$3"
|
||||||
|
|
||||||
if [ ! -x "$UDEV_DMI_MEMORY_ID" ]; then
|
output=$(mktemp --tmpdir "test-udev-dmi-memory-id.XXXXXXXXXX")
|
||||||
echo "$UDEV_DMI_MEMORY_ID does not exist, please build first"
|
trap "rm '$output'" EXIT INT QUIT PIPE
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
D=$(mktemp --tmpdir --directory "udev-dmi-memory-id.XXXXXXXXXX")
|
(
|
||||||
trap "rm -rf '$D'" EXIT INT QUIT PIPE
|
set -x
|
||||||
|
"$dmi_memory_id" -F "$input" >$output
|
||||||
for i in $ROOTDIR/test/dmidecode-dumps/*.bin ; do
|
diff -u "$output" "$expected"
|
||||||
$("$UDEV_DMI_MEMORY_ID" -F "$i" 2>&1 > "$D"/out.txt) && rc= || rc=$?
|
)
|
||||||
if [ -n "$rc" ]; then
|
|
||||||
echo "$UDEV_DMI_MEMORY_ID returned $rc"
|
|
||||||
exit $rc
|
|
||||||
fi
|
|
||||||
err=$(diff -u "$D"/out.txt "$i.txt" 2>&1) && rc= || rc=$?
|
|
||||||
if [ -n "$rc" ]; then
|
|
||||||
echo "Parsing DMI memory information from \"$i\" didn't match expected:"
|
|
||||||
echo "$err"
|
|
||||||
exit $rc
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
Loading…
Reference in New Issue