Files
libfprint/tests/test-generated-hwdb.sh
Mohammed Anas 1701d72ff9 tests: make mktemp command call work with Chimera Linux's mktemp
On Chimera Linux, which uses FreeBSD's userland tools, the original call
fails with the following error:

mktemp: mkstemp failed on /tmp/libfprint-XXXXXX.hwdb: Invalid argument

Moving the X's to the end of the template passed to `mktemp` fixes the
error, and also works with GNU's `mktemp`.
2024-01-22 15:52:46 +00:00

31 lines
707 B
Bash
Executable File

#!/bin/sh -e
if [ ! -x "$UDEV_HWDB" ]; then
echo "E: UDEV_HWDB (${UDEV_HWDB}) unset or not executable."
exit 1
fi
if [ "$UDEV_HWDB_CHECK_CONTENTS" = 1 ]; then
generated_rules=$(mktemp "${TMPDIR:-/tmp}/libfprint.hwdb.XXXXXX")
else
generated_rules=/dev/null
fi
$UDEV_HWDB > "$generated_rules"
if [ $? != 0 ]; then
echo "E: UDEV_HWDB (${UDEV_HWDB}) failed to run without error."
exit 1
fi
if [ "$UDEV_HWDB_CHECK_CONTENTS" != 1 ]; then
exit 77
fi
if ! diff -u "$MESON_SOURCE_ROOT/data/autosuspend.hwdb" "$generated_rules"; then
echo "E: Autosuspend file needs to be re-generated!"
echo " ninja -C $MESON_BUILD_ROOT sync-udev-hwdb"
exit 1
fi
rm "$generated_rules"