diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2016-12-12 16:03:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-12 16:03:52 +0100 |
commit | 142a1afbb9ae02dc69394e0e258624e9ce21f562 (patch) | |
tree | 709fe437503fa4828b7b7feee06953ab82962ad7 /test | |
parent | e3e30d2a44ba6e204c92d2afa28d402f6e9ba263 (diff) | |
parent | 7a100dce9db33006888156876ff8aeb27e77eed2 (diff) | |
download | systemd-142a1afbb9ae02dc69394e0e258624e9ce21f562.tar.gz |
Merge pull request #4771 from keszybz/udev-property-ordering
Udev property ordering
Diffstat (limited to 'test')
-rwxr-xr-x | test/hwdb-test.sh | 31 | ||||
-rw-r--r-- | test/hwdb/10-bad.hwdb | 26 |
2 files changed, 56 insertions, 1 deletions
diff --git a/test/hwdb-test.sh b/test/hwdb-test.sh index 4638328059..5373930df4 100755 --- a/test/hwdb-test.sh +++ b/test/hwdb-test.sh @@ -32,11 +32,40 @@ D=$(mktemp --directory) trap "rm -rf '$D'" EXIT INT QUIT PIPE mkdir -p "$D/etc/udev" ln -s "$ROOTDIR/hwdb" "$D/etc/udev/hwdb.d" -err=$("$SYSTEMD_HWDB" update --root "$D" 2>&1 >/dev/null) + +# 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" + exit ${rc:-1} +fi +if [ -n "$rc" ]; then + echo "$SYSTEMD_HWDB returned $rc" + exit $rc +fi + +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 diff --git a/test/hwdb/10-bad.hwdb b/test/hwdb/10-bad.hwdb new file mode 100644 index 0000000000..0e1e147323 --- /dev/null +++ b/test/hwdb/10-bad.hwdb @@ -0,0 +1,26 @@ +BAD:1:no properties + +BAD:2:no properties +BAD:2:no properties + +BAD:3:no properties +BAD:3:no properties +BAD:3:no properties + +GOOD:5:bad property + NO_VALUE + +GOOD:6:bad property + =NO_NAME + NO_VALUE= + +BAD:7:match at wrong place + X=Y +BAD:7:match at wrong place + +BAD:8:match at wrong place + X=Y +BAD:8:match at wrong place + Z=z + +BAD:8:match at EOF |