]>
git.ipfire.org Git - thirdparty/systemd.git/blob - test/hwdb-test.sh
2 # call built systemd-hwdb update on our hwdb files to ensure that they parse
5 # (C) 2016 Canonical Ltd.
6 # Author: Martin Pitt <martin.pitt@ubuntu.com>
8 # systemd is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU Lesser General Public License as published by
10 # the Free Software Foundation; either version 2.1 of the License, or
11 # (at your option) any later version.
13 # systemd is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public License
19 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 ROOTDIR
=$
(dirname $
(dirname $
(readlink
-f $0)))
24 SYSTEMD_HWDB
=${builddir:-.}/systemd-hwdb
26 if [ ! -x "$SYSTEMD_HWDB" ]; then
27 echo "$SYSTEMD_HWDB does not exist, please build first"
31 D
=$
(mktemp
--directory)
32 trap "rm -rf '$D'" EXIT INT QUIT PIPE
33 mkdir
-p "$D/etc/udev"
34 ln -s "$ROOTDIR/hwdb" "$D/etc/udev/hwdb.d"
36 # Test "good" properties" — no warnings or errors allowed
37 err
=$
("$SYSTEMD_HWDB" update
--root "$D" 2>&1 >/dev
/null
) && rc
= || rc
=$?
38 if [ -n "$err" ]; then
43 echo "$SYSTEMD_HWDB returned $rc"
47 if [ ! -e "$D/etc/udev/hwdb.bin" ]; then
48 echo "$D/etc/udev/hwdb.bin was not generated"
52 # Test "bad" properties" — warnings required, errors not allowed
53 rm -f "$D/etc/udev/hwdb.bin" "$D/etc/udev/hwdb.d"
55 ln -s "$ROOTDIR/test/hwdb" "$D/etc/udev/hwdb.d"
56 err
=$
("$SYSTEMD_HWDB" update
--root "$D" 2>&1 >/dev
/null
) && rc
= || rc
=$?
58 echo "$SYSTEMD_HWDB returned $rc"
61 if [ -n "$err" ]; then
62 echo "Expected warnings"
65 echo "$SYSTEMD_HWDB unexpectedly printed no warnings"
69 if [ ! -e "$D/etc/udev/hwdb.bin" ]; then
70 echo "$D/etc/udev/hwdb.bin was not generated"