summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2014-06-16 14:00:16 +0200
committerDidier Raboud <odyx@debian.org>2014-06-23 17:08:00 +0200
commitc87618ace11d821047e65c8caf3d105fa21a0823 (patch)
treef16e9519e08840da1ea14b60e10a297e3cbb621f /debian
parentfcd8edd79d5a9183760d6b3c9ec6b75d5df24820 (diff)
downloadcups-c87618ace11d821047e65c8caf3d105fa21a0823.tar.gz
Make the test-drivers utility more generic, install it in the cups package to be able to use it in other packages' autopkgtests
Diffstat (limited to 'debian')
-rw-r--r--debian/cups.install1
-rwxr-xr-xdebian/tests/cups5
-rwxr-xr-xdebian/tests/cups-core-drivers2
-rwxr-xr-xdebian/tests/utils/test-drivers28
4 files changed, 27 insertions, 9 deletions
diff --git a/debian/cups.install b/debian/cups.install
index c6019cb8..8f2adb79 100644
--- a/debian/cups.install
+++ b/debian/cups.install
@@ -19,3 +19,4 @@ usr/share/man/man8/cups-driverd.8.gz
usr/share/man/man8/cupsfilter.8.gz
usr/share/man/man8/cups-lpd.8.gz
../presubj usr/share/bug/cups/
+debian/tests/utils/test-drivers usr/share/cups/
diff --git a/debian/tests/cups b/debian/tests/cups
index 8dbd946f..46301381 100755
--- a/debian/tests/cups
+++ b/debian/tests/cups
@@ -2,7 +2,4 @@
set -e -u
-#Test all available drivers besides textonly (which doesn't make sense for pdf, and pdftoijs that doesn't work
-drivers=$(lpinfo -m | cut -f1 -d' ' | grep -v 'textonly' | grep -v 'pdftoijs' | sort -u)
-
-./debian/tests/utils/test-drivers adt-printer0 $drivers
+./debian/tests/utils/test-drivers
diff --git a/debian/tests/cups-core-drivers b/debian/tests/cups-core-drivers
index 95a95b9d..ba463093 100755
--- a/debian/tests/cups-core-drivers
+++ b/debian/tests/cups-core-drivers
@@ -2,4 +2,4 @@
set -e -u
-./debian/tests/utils/test-drivers adt-printer0 raw
+./debian/tests/utils/test-drivers -l 'raw' -p ./test/
diff --git a/debian/tests/utils/test-drivers b/debian/tests/utils/test-drivers
index 61a5b146..7d07087e 100755
--- a/debian/tests/utils/test-drivers
+++ b/debian/tests/utils/test-drivers
@@ -2,10 +2,30 @@
set -e -u
-DUMMY_PRINTER_NAME=$1
-shift
+DUMMY_PRINTER_NAME=test-printer0
+DRIVER_REGEXP='^.*'
+PDFS_PATH=/usr/share/cups/data/
+LPINFO_RUN=true
+DRIVERS_LIST=''
-for driver in $@; do
+while getopts 'n:r:p:l:h' flag; do
+ case "${flag}" in
+ n) DUMMY_PRINTER_NAME="${OPTARG}" ;;
+ r) DRIVER_REGEXP="${OPTARG}" ;;
+ p) PDFS_PATH="${OPTARG}" ;;
+ l) LPINFO_RUN=false; DRIVERS_LIST=${OPTARG} ;;
+ h) echo "Usage: $0 [-n printer_name] [-r '^driver_regexp'] [-p ./pdf-path] [-l drivers_list]";
+ return 1;;
+ esac
+done
+
+if $LPINFO_RUN; then
+ # textonly can't print PDF
+ # pdftoijs is currently buggy !?
+ DRIVERS_LIST=$(lpinfo -m | cut -f1 -d' ' | grep -v 'textonly' | grep -v 'pdftoijs' | grep -E $DRIVER_REGEXP)
+fi
+
+for driver in $DRIVERS_LIST; do
echo "* Driver $driver"
@@ -14,7 +34,7 @@ for driver in $@; do
/usr/sbin/lpadmin -p $DUMMY_PRINTER_NAME -E -m $driver -v file:///dev/null
echo " done."
- for file in $(find ./test -name '*.pdf') ; do
+ for file in $(find $PDFS_PATH -name '*.pdf') ; do
echo -n " - Print test job with $file: "
# Print the default testprint to it, get request id
rid=$(/usr/bin/lp -d $DUMMY_PRINTER_NAME $file | sed -e 's/^.*request id is \(.*\) (.*)$/\1/g')