summaryrefslogtreecommitdiff
path: root/test/rules-test.sh
diff options
context:
space:
mode:
authorMartin Pitt <martin.pitt@ubuntu.com>2010-09-21 12:45:52 +0200
committerMartin Pitt <martin.pitt@ubuntu.com>2010-09-21 12:45:52 +0200
commitb2ad12eb0291832134bf3757f98abfeeec2fb166 (patch)
tree9b088e654df08400c537fedbb22f417ea3a77b0a /test/rules-test.sh
parentc112a41a43ccede3b22bf242bcf8da455ca57c98 (diff)
Add automatic rules syntax check
Add test/rule-syntax-check.py, a script for checking the syntax of all udev rules files passed as command line arguments. Add a wrapper test/rules-test.sh which calls rule-syntax-check.py on all udev rules that we ship, but does nothing if Python is not available. Integrate this into make check/distcheck.
Diffstat (limited to 'test/rules-test.sh')
-rwxr-xr-xtest/rules-test.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/rules-test.sh b/test/rules-test.sh
new file mode 100755
index 0000000000..9d5a07c19e
--- /dev/null
+++ b/test/rules-test.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# Call the udev rule syntax checker on all rules that we ship
+#
+# (C) 2010 Canonical Ltd.
+# Author: Martin Pitt <martin.pitt@ubuntu.com>
+
+set -e
+
+[ -n "$srcdir" ] || srcdir=`dirname $0`/..
+
+# skip if we don't have python
+type python >/dev/null 2>&1 || {
+ echo "$0: No python installed, skipping udev rule syntax check"
+ exit 0
+}
+
+$srcdir/test/rule-syntax-check.py `find $srcdir/rules -type f`