summaryrefslogtreecommitdiff
path: root/test/hwdb-test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/hwdb-test.sh')
-rwxr-xr-xtest/hwdb-test.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/hwdb-test.sh b/test/hwdb-test.sh
index bfdafce998..5373930df4 100755
--- a/test/hwdb-test.sh
+++ b/test/hwdb-test.sh
@@ -33,6 +33,7 @@ trap "rm -rf '$D'" EXIT INT QUIT PIPE
mkdir -p "$D/etc/udev"
ln -s "$ROOTDIR/hwdb" "$D/etc/udev/hwdb.d"
+# Test "good" properties" — no warnings or errors allowed
err=$("$SYSTEMD_HWDB" update --root "$D" 2>&1 >/dev/null) && rc= || rc=$?
if [ -n "$err" ]; then
echo "$err"
@@ -47,3 +48,25 @@ if [ ! -e "$D/etc/udev/hwdb.bin" ]; then
echo "$D/etc/udev/hwdb.bin was not generated"
exit 1
fi
+
+# Test "bad" properties" — warnings required, errors not allowed
+rm -f "$D/etc/udev/hwdb.bin" "$D/etc/udev/hwdb.d"
+
+ln -s "$ROOTDIR/test/hwdb" "$D/etc/udev/hwdb.d"
+err=$("$SYSTEMD_HWDB" update --root "$D" 2>&1 >/dev/null) && rc= || rc=$?
+if [ -n "$rc" ]; then
+ echo "$SYSTEMD_HWDB returned $rc"
+ exit $rc
+fi
+if [ -n "$err" ]; then
+ echo "Expected warnings"
+ echo "$err"
+else
+ echo "$SYSTEMD_HWDB unexpectedly printed no warnings"
+ exit 1
+fi
+
+if [ ! -e "$D/etc/udev/hwdb.bin" ]; then
+ echo "$D/etc/udev/hwdb.bin was not generated"
+ exit 1
+fi