summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2012-10-25 21:07:57 +0200
committerDidier Raboud <odyx@debian.org>2012-10-25 21:07:57 +0200
commit81ab83f382660bc7980ae954725c4ebf28764b03 (patch)
tree523268f698a63a8fd44f3491d94d140266b2403b /test
parenta75966e33dbc3e3e096338fd332f515cb313b58a (diff)
downloadcups-81ab83f382660bc7980ae954725c4ebf28764b03.tar.gz
Imported Upstream version 1.6.0upstream/1.6.0
Diffstat (limited to 'test')
-rw-r--r--test/5.1-lpadmin.sh24
-rw-r--r--test/5.2-lpc.sh6
-rw-r--r--test/5.3-lpq.sh6
-rw-r--r--test/5.4-lpstat.sh10
-rw-r--r--test/5.5-lp.sh20
-rw-r--r--test/5.6-lpr.sh20
-rw-r--r--test/5.7-lprm.sh14
-rw-r--r--test/5.8-cancel.sh12
-rw-r--r--test/5.9-lpinfo.sh12
-rw-r--r--test/Dependencies38
-rw-r--r--test/Makefile23
-rw-r--r--test/cancel-current-job.test65
-rw-r--r--test/document-a4.ps2
-rw-r--r--test/document-letter.ps2
-rw-r--r--test/get-completed-jobs.test8
-rw-r--r--test/get-jobs.test7
-rw-r--r--test/ipp-1.1.test127
-rw-r--r--test/ipp-2.0.test20
-rw-r--r--test/ipp-2.1.test4
-rw-r--r--test/ipp-2.2.test4
-rw-r--r--test/ippserver.c210
-rw-r--r--test/ipptool.c1562
-rw-r--r--test/onepage-a4.ps2
-rw-r--r--test/onepage-letter.ps2
-rwxr-xr-xtest/run-stp-tests.sh158
-rw-r--r--test/str-header.html8
-rw-r--r--test/testfile.pcl60
-rw-r--r--test/testfile.txt120
-rw-r--r--test/xmltotest.c529
29 files changed, 1825 insertions, 1250 deletions
diff --git a/test/5.1-lpadmin.sh b/test/5.1-lpadmin.sh
index f1699616..545d7365 100644
--- a/test/5.1-lpadmin.sh
+++ b/test/5.1-lpadmin.sh
@@ -1,10 +1,10 @@
#!/bin/sh
#
-# "$Id: 5.1-lpadmin.sh 8266 2009-01-19 23:10:15Z mike $"
+# "$Id: 5.1-lpadmin.sh 10448 2012-05-04 18:34:39Z mike $"
#
# Test the lpadmin command.
#
-# Copyright 2007-2009 by Apple Inc.
+# Copyright 2007-2012 by Apple Inc.
# Copyright 1997-2005 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -17,7 +17,7 @@
echo "Add Printer Test"
echo ""
echo " lpadmin -p Test3 -v file:/dev/null -E -m drv:///sample.drv/deskjet.ppd"
-../systemv/lpadmin -p Test3 -v file:/dev/null -E -m drv:///sample.drv/deskjet.ppd 2>&1
+$VALGRIND ../systemv/lpadmin -p Test3 -v file:/dev/null -E -m drv:///sample.drv/deskjet.ppd 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -29,7 +29,7 @@ echo ""
echo "Modify Printer Test"
echo ""
echo " lpadmin -p Test3 -v file:/tmp/Test3 -o PageSize=A4"
-../systemv/lpadmin -p Test3 -v file:/tmp/Test3 -o PageSize=A4 2>&1
+$VALGRIND ../systemv/lpadmin -p Test3 -v file:/tmp/Test3 -o PageSize=A4 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -41,7 +41,19 @@ echo ""
echo "Delete Printer Test"
echo ""
echo " lpadmin -x Test3"
-../systemv/lpadmin -x Test3 2>&1
+$VALGRIND ../systemv/lpadmin -x Test3 2>&1
+if test $? != 0; then
+ echo " FAILED"
+ exit 1
+else
+ echo " PASSED"
+fi
+echo ""
+
+echo "Add Shared Printer Test"
+echo ""
+echo " lpadmin -p Test3 -E -v ipp://localhost:8631/printers/Test2 -m raw"
+$VALGRIND ../systemv/lpadmin -p Test3 -E -v ipp://localhost:8631/printers/Test2 -m raw 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -51,5 +63,5 @@ fi
echo ""
#
-# End of "$Id: 5.1-lpadmin.sh 8266 2009-01-19 23:10:15Z mike $".
+# End of "$Id: 5.1-lpadmin.sh 10448 2012-05-04 18:34:39Z mike $".
#
diff --git a/test/5.2-lpc.sh b/test/5.2-lpc.sh
index b6908052..1079900b 100644
--- a/test/5.2-lpc.sh
+++ b/test/5.2-lpc.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# "$Id: 5.2-lpc.sh 6649 2007-07-11 21:46:42Z mike $"
+# "$Id: 5.2-lpc.sh 10097 2011-11-02 05:35:38Z mike $"
#
# Test the lpc command.
#
@@ -17,7 +17,7 @@
echo "LPC Test"
echo ""
echo " lpc status"
-../berkeley/lpc status 2>&1
+$VALGRIND ../berkeley/lpc status 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -27,5 +27,5 @@ fi
echo ""
#
-# End of "$Id: 5.2-lpc.sh 6649 2007-07-11 21:46:42Z mike $".
+# End of "$Id: 5.2-lpc.sh 10097 2011-11-02 05:35:38Z mike $".
#
diff --git a/test/5.3-lpq.sh b/test/5.3-lpq.sh
index 05f66a99..24f2a24a 100644
--- a/test/5.3-lpq.sh
+++ b/test/5.3-lpq.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# "$Id: 5.3-lpq.sh 8144 2008-11-19 19:23:12Z mike $"
+# "$Id: 5.3-lpq.sh 10097 2011-11-02 05:35:38Z mike $"
#
# Test the lpq command.
#
@@ -17,7 +17,7 @@
echo "LPQ Test"
echo ""
echo " lpq -P Test1"
-../berkeley/lpq -P Test1 2>&1
+$VALGRIND ../berkeley/lpq -P Test1 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -27,5 +27,5 @@ fi
echo ""
#
-# End of "$Id: 5.3-lpq.sh 8144 2008-11-19 19:23:12Z mike $".
+# End of "$Id: 5.3-lpq.sh 10097 2011-11-02 05:35:38Z mike $".
#
diff --git a/test/5.4-lpstat.sh b/test/5.4-lpstat.sh
index 31818919..3d5d956e 100644
--- a/test/5.4-lpstat.sh
+++ b/test/5.4-lpstat.sh
@@ -1,10 +1,10 @@
#!/bin/sh
#
-# "$Id: 5.4-lpstat.sh 8498 2009-04-13 17:03:15Z mike $"
+# "$Id: 5.4-lpstat.sh 10097 2011-11-02 05:35:38Z mike $"
#
# Test the lpstat command.
#
-# Copyright 2007-2009 by Apple Inc.
+# Copyright 2007-2011 by Apple Inc.
# Copyright 1997-2005 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -17,7 +17,7 @@
echo "LPSTAT Test"
echo ""
echo " lpstat -t"
-../systemv/lpstat -t 2>&1
+$VALGRIND ../systemv/lpstat -t 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -29,7 +29,7 @@ echo ""
echo "LPSTAT Test"
echo ""
echo " lpstat -H"
-server="`../systemv/lpstat -H 2>&1`"
+server="`$VALGRIND ../systemv/lpstat -H 2>&1`"
if test $? != 0 -o "x$server" != xlocalhost:8631; then
echo " FAILED ($server)"
exit 1
@@ -39,5 +39,5 @@ fi
echo ""
#
-# End of "$Id: 5.4-lpstat.sh 8498 2009-04-13 17:03:15Z mike $".
+# End of "$Id: 5.4-lpstat.sh 10097 2011-11-02 05:35:38Z mike $".
#
diff --git a/test/5.5-lp.sh b/test/5.5-lp.sh
index 942d11ba..c8834ca9 100644
--- a/test/5.5-lp.sh
+++ b/test/5.5-lp.sh
@@ -1,10 +1,10 @@
#!/bin/sh
#
-# "$Id: 5.5-lp.sh 10090 2011-10-25 22:39:56Z mike $"
+# "$Id: 5.5-lp.sh 10448 2012-05-04 18:34:39Z mike $"
#
# Test the lp command.
#
-# Copyright 2007-2011 by Apple Inc.
+# Copyright 2007-2012 by Apple Inc.
# Copyright 1997-2005 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -17,7 +17,7 @@
echo "LP Default Test"
echo ""
echo " lp testfile.pdf"
-../systemv/lp testfile.pdf 2>&1
+$VALGRIND ../systemv/lp testfile.pdf 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -28,8 +28,8 @@ echo ""
echo "LP Destination Test"
echo ""
-echo " lp -d Test2 testfile.jpg"
-../systemv/lp -d Test2 testfile.jpg 2>&1
+echo " lp -d Test3 -o fit-to-page testfile.jpg"
+$VALGRIND ../systemv/lp -d Test3 -o fit-to-page testfile.jpg 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -41,7 +41,7 @@ echo ""
echo "LP Options Test"
echo ""
echo " lp -d Test1 -P 1-4 -o job-sheets=classified,classified testfile.pdf"
-../systemv/lp -d Test1 -P 1-4 -o job-sheets=classified,classified testfile.pdf 2>&1
+$VALGRIND ../systemv/lp -d Test1 -P 1-4 -o job-sheets=classified,classified testfile.pdf 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -58,12 +58,12 @@ i=0
while test $i -lt $1; do
j=1
while test $j -le $2; do
- ../systemv/lp -d test-$j testfile.jpg 2>&1
+ $VALGRIND ../systemv/lp -d test-$j testfile.jpg 2>&1
j=`expr $j + 1`
done
- ../systemv/lp -d Test1 testfile.jpg 2>&1 &
- ../systemv/lp -d Test2 testfile.jpg 2>&1 &
+ $VALGRIND ../systemv/lp -d Test1 testfile.jpg 2>&1 &
+ $VALGRIND ../systemv/lp -d Test2 testfile.jpg 2>&1 &
lppid=$!
i=`expr $i + 1`
@@ -80,5 +80,5 @@ echo ""
./waitjobs.sh
#
-# End of "$Id: 5.5-lp.sh 10090 2011-10-25 22:39:56Z mike $".
+# End of "$Id: 5.5-lp.sh 10448 2012-05-04 18:34:39Z mike $".
#
diff --git a/test/5.6-lpr.sh b/test/5.6-lpr.sh
index b49e5dc9..fa40b740 100644
--- a/test/5.6-lpr.sh
+++ b/test/5.6-lpr.sh
@@ -1,10 +1,10 @@
#!/bin/sh
#
-# "$Id: 5.6-lpr.sh 10090 2011-10-25 22:39:56Z mike $"
+# "$Id: 5.6-lpr.sh 10448 2012-05-04 18:34:39Z mike $"
#
# Test the lpr command.
#
-# Copyright 2007-2011 by Apple Inc.
+# Copyright 2007-2012 by Apple Inc.
# Copyright 1997-2005 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -17,7 +17,7 @@
echo "LPR Default Test"
echo ""
echo " lpr testfile.pdf"
-../berkeley/lpr testfile.pdf 2>&1
+$VALGRIND ../berkeley/lpr testfile.pdf 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -28,8 +28,8 @@ echo ""
echo "LPR Destination Test"
echo ""
-echo " lpr -P Test2 testfile.jpg"
-../berkeley/lpr -P Test2 testfile.jpg 2>&1
+echo " lpr -P Test3 -o fit-to-page testfile.jpg"
+$VALGRIND ../berkeley/lpr -P Test3 -o fit-to-page testfile.jpg 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -41,7 +41,7 @@ echo ""
echo "LPR Options Test"
echo ""
echo " lpr -P Test1 -o number-up=4 -o job-sheets=standard,none testfile.pdf"
-../berkeley/lpr -P Test1 -o number-up=4 -o job-sheets=standard,none testfile.pdf 2>&1
+$VALGRIND ../berkeley/lpr -P Test1 -o number-up=4 -o job-sheets=standard,none testfile.pdf 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -58,12 +58,12 @@ i=0
while test $i -lt $1; do
j=1
while test $j -le $2; do
- ../berkeley/lpr -P test-$j testfile.jpg 2>&1
+ $VALGRIND ../berkeley/lpr -P test-$j testfile.jpg 2>&1
j=`expr $j + 1`
done
- ../berkeley/lpr -P Test1 testfile.jpg 2>&1 &
- ../berkeley/lpr -P Test2 testfile.jpg 2>&1 &
+ $VALGRIND ../berkeley/lpr -P Test1 testfile.jpg 2>&1 &
+ $VALGRIND ../berkeley/lpr -P Test2 testfile.jpg 2>&1 &
lprpid=$!
i=`expr $i + 1`
@@ -80,5 +80,5 @@ echo ""
./waitjobs.sh
#
-# End of "$Id: 5.6-lpr.sh 10090 2011-10-25 22:39:56Z mike $".
+# End of "$Id: 5.6-lpr.sh 10448 2012-05-04 18:34:39Z mike $".
#
diff --git a/test/5.7-lprm.sh b/test/5.7-lprm.sh
index bcb72116..acaaca99 100644
--- a/test/5.7-lprm.sh
+++ b/test/5.7-lprm.sh
@@ -1,10 +1,10 @@
#!/bin/sh
#
-# "$Id: 5.7-lprm.sh 7409 2008-03-29 00:26:03Z mike $"
+# "$Id: 5.7-lprm.sh 10097 2011-11-02 05:35:38Z mike $"
#
# Test the lprm command.
#
-# Copyright 2007 by Apple Inc.
+# Copyright 2007-2011 by Apple Inc.
# Copyright 1997-2005 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -17,9 +17,9 @@
echo "LPRM Current Test"
echo ""
echo " lpr -o job-hold-until=indefinite testfile.jpg"
-../berkeley/lpr -o job-hold-until=indefinite testfile.jpg 2>&1
+$VALGRIND ../berkeley/lpr -o job-hold-until=indefinite testfile.jpg 2>&1
echo " lprm"
-../berkeley/lprm 2>&1
+$VALGRIND ../berkeley/lprm 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -31,9 +31,9 @@ echo ""
echo "LPRM Destination Test"
echo ""
echo " lpr -P Test1 -o job-hold-until=indefinite testfile.jpg"
-../berkeley/lpr -P Test1 -o job-hold-until=indefinite testfile.jpg 2>&1
+$VALGRIND ../berkeley/lpr -P Test1 -o job-hold-until=indefinite testfile.jpg 2>&1
echo " lprm Test1"
-../berkeley/lprm Test1 2>&1
+$VALGRIND ../berkeley/lprm Test1 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -43,5 +43,5 @@ fi
echo ""
#
-# End of "$Id: 5.7-lprm.sh 7409 2008-03-29 00:26:03Z mike $".
+# End of "$Id: 5.7-lprm.sh 10097 2011-11-02 05:35:38Z mike $".
#
diff --git a/test/5.8-cancel.sh b/test/5.8-cancel.sh
index 7cf31b0d..4b4a08d1 100644
--- a/test/5.8-cancel.sh
+++ b/test/5.8-cancel.sh
@@ -1,10 +1,10 @@
#!/bin/sh
#
-# "$Id: 5.8-cancel.sh 7409 2008-03-29 00:26:03Z mike $"
+# "$Id: 5.8-cancel.sh 10097 2011-11-02 05:35:38Z mike $"
#
# Test the cancel command.
#
-# Copyright 2007-2008 by Apple Inc.
+# Copyright 2007-2011 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -17,9 +17,9 @@
echo "Cancel Destination Test"
echo ""
echo " lp -d Test1 -o job-hold-until=indefinite testfile.jpg"
-../systemv/lp -d Test1 -o job-hold-until=indefinite testfile.jpg 2>&1
+$VALGRIND ../systemv/lp -d Test1 -o job-hold-until=indefinite testfile.jpg 2>&1
echo " cancel Test1"
-../systemv/cancel Test1 2>&1
+$VALGRIND ../systemv/cancel Test1 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -31,7 +31,7 @@ echo ""
echo "Cancel All Test"
echo ""
echo " cancel -a"
-../systemv/cancel -a 2>&1
+$VALGRIND ../systemv/cancel -a 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -41,5 +41,5 @@ fi
echo ""
#
-# End of "$Id: 5.8-cancel.sh 7409 2008-03-29 00:26:03Z mike $".
+# End of "$Id: 5.8-cancel.sh 10097 2011-11-02 05:35:38Z mike $".
#
diff --git a/test/5.9-lpinfo.sh b/test/5.9-lpinfo.sh
index 1902aeb9..3ecaf254 100644
--- a/test/5.9-lpinfo.sh
+++ b/test/5.9-lpinfo.sh
@@ -1,10 +1,10 @@
#!/bin/sh
#
-# "$Id: 5.9-lpinfo.sh 7711 2008-07-02 04:39:27Z mike $"
+# "$Id: 5.9-lpinfo.sh 10097 2011-11-02 05:35:38Z mike $"
#
# Test the lpinfo command.
#
-# Copyright 2007-2008 by Apple Inc.
+# Copyright 2007-2011 by Apple Inc.
# Copyright 1997-2005 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -17,7 +17,7 @@
echo "LPINFO Devices Test"
echo ""
echo " lpinfo -v"
-../systemv/lpinfo -v 2>&1
+$VALGRIND ../systemv/lpinfo -v 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -29,7 +29,7 @@ echo ""
echo "LPINFO Drivers Test"
echo ""
echo " lpinfo -m"
-../systemv/lpinfo -m 2>&1
+$VALGRIND ../systemv/lpinfo -m 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -41,7 +41,7 @@ echo ""
echo "LPINFO Drivers Test"
echo ""
echo " lpinfo -m | grep -q sample.drv"
-../systemv/lpinfo -m | grep -q sample.drv 2>&1
+$VALGRIND ../systemv/lpinfo -m | grep -q sample.drv 2>&1
if test $? != 0; then
echo " FAILED"
exit 1
@@ -51,5 +51,5 @@ fi
echo ""
#
-# End of "$Id: 5.9-lpinfo.sh 7711 2008-07-02 04:39:27Z mike $".
+# End of "$Id: 5.9-lpinfo.sh 10097 2011-11-02 05:35:38Z mike $".
#
diff --git a/test/Dependencies b/test/Dependencies
index 32891447..69b96a6f 100644
--- a/test/Dependencies
+++ b/test/Dependencies
@@ -1,20 +1,18 @@
-# DO NOT DELETE THIS LINE -- make depend depends on it.
-
-ippserver.o: ../cups/cups-private.h ../cups/cups.h ../cups/file.h
-ippserver.o: ../cups/versioning.h ../cups/ipp.h ../cups/http.h
-ippserver.o: ../cups/array.h ../cups/language.h ../cups/string-private.h
-ippserver.o: ../config.h ../cups/debug-private.h ../cups/versioning.h
-ippserver.o: ../cups/ppd-private.h ../cups/ppd.h ../cups/cups.h
-ippserver.o: ../cups/pwg-private.h ../cups/http-private.h ../cups/http.h
-ippserver.o: ../cups/md5-private.h ../cups/ipp-private.h ../cups/ipp.h
-ippserver.o: ../cups/language-private.h ../cups/transcode.h
-ippserver.o: ../cups/thread-private.h
-ipptool.o: ../cups/cups-private.h ../cups/cups.h ../cups/file.h
-ipptool.o: ../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h
-ipptool.o: ../cups/language.h ../cups/string-private.h ../config.h
-ipptool.o: ../cups/debug-private.h ../cups/versioning.h ../cups/ppd-private.h
-ipptool.o: ../cups/ppd.h ../cups/cups.h ../cups/pwg-private.h
-ipptool.o: ../cups/http-private.h ../cups/http.h ../cups/md5-private.h
-ipptool.o: ../cups/ipp-private.h ../cups/ipp.h ../cups/language-private.h
-ipptool.o: ../cups/transcode.h ../cups/thread-private.h
-ipptool.o: ../cups/file-private.h ../cups/cups-private.h
+ippserver.o: ippserver.c ../cups/cups-private.h ../cups/string-private.h \
+ ../config.h ../cups/debug-private.h ../cups/versioning.h \
+ ../cups/ipp-private.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+ ../cups/http-private.h ../cups/md5-private.h \
+ ../cups/language-private.h ../cups/transcode.h ../cups/language.h \
+ ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
+ ../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
+ipptool.o: ipptool.c ../cups/cups-private.h ../cups/string-private.h \
+ ../config.h ../cups/debug-private.h ../cups/versioning.h \
+ ../cups/ipp-private.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+ ../cups/http-private.h ../cups/md5-private.h \
+ ../cups/language-private.h ../cups/transcode.h ../cups/language.h \
+ ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
+ ../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
+ ../cups/file-private.h
+xmltotest.o: xmltotest.c ../config.h ../cups/cups.h ../cups/file.h \
+ ../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
+ ../cups/language.h
diff --git a/test/Makefile b/test/Makefile
index 0acc0b4c..e6a5ec1d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,9 +1,9 @@
#
-# "$Id: Makefile 10317 2012-03-01 00:05:55Z mike $"
+# "$Id: Makefile 10456 2012-05-07 22:41:42Z mike $"
#
# IPP test makefile for CUPS.
#
-# Copyright 2007-2010 by Apple Inc.
+# Copyright 2007-2012 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -32,6 +32,7 @@ DATAFILES = \
onepage-letter.pdf \
onepage-letter.ps \
testfile.jpg \
+ testfile.pcl \
testfile.pdf \
testfile.ps \
testfile.txt
@@ -46,7 +47,8 @@ TESTFILES = \
ipp-2.2.test
OBJS = \
ippserver.o \
- ipptool.o
+ ipptool.o \
+ xmltotest.o
TARGETS = \
ippserver \
ipptool \
@@ -87,7 +89,7 @@ clean:
#
depend:
- makedepend -Y -I.. -fDependencies $(OBJS:.o=.c) >/dev/null 2>&1
+ $(CC) -MM $(ALL_CFLAGS) $(OBJS:.o=.c) >Dependencies
#
@@ -194,6 +196,17 @@ ipptool-static: ipptool.o ../cups/$(LIBCUPSSTATIC)
#
+# xmltotest
+#
+
+xmltotest: xmltotest.o ../cups/$(LIBUPSSTATIC)
+ echo Linking $@...
+ $(CC) $(LDFLAGS) -o $@ xmltotest.o ../cups/$(LIBCUPSSTATIC) \
+ $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ) \
+ $(LIBMXML)
+
+
+#
# Dependencies...
#
@@ -201,5 +214,5 @@ include Dependencies
#
-# End of "$Id: Makefile 10317 2012-03-01 00:05:55Z mike $".
+# End of "$Id: Makefile 10456 2012-05-07 22:41:42Z mike $".
#
diff --git a/test/cancel-current-job.test b/test/cancel-current-job.test
new file mode 100644
index 00000000..cb37f220
--- /dev/null
+++ b/test/cancel-current-job.test
@@ -0,0 +1,65 @@
+#
+# "$Id: get-jobs.test 9702 2011-04-20 21:16:08Z mike $"
+#
+# Cancel the currently printing job.
+#
+# Copyright 2007-2012 by Apple Inc.
+# Copyright 2001-2006 by Easy Software Products. All rights reserved.
+#
+# These coded instructions, statements, and computer programs are the
+# property of Apple Inc. and are protected by Federal copyright
+# law. Distribution and use rights are outlined in the file "LICENSE.txt"
+# which should have been included with this file. If this file is
+# file is missing or damaged, see the license at "http://www.cups.org/".
+#
+# Usage:
+#
+# ./ipptool printer-uri cancel-current-jobs.test
+#
+
+
+{
+ # The name of the test...
+ NAME "Get current job"
+
+ # The operation to use
+ OPERATION Get-Jobs
+
+ # Attributes, starting in the operation group...
+ GROUP operation-attributes-tag
+ ATTR charset attributes-charset utf-8
+ ATTR language attributes-natural-language en
+ ATTR uri printer-uri $uri
+ ATTR integer limit 1
+ ATTR name requesting-user-name $user
+ ATTR keyword requested-attributes job-id,job-state
+
+ # What statuses are OK?
+ STATUS successful-ok
+
+ EXPECT job-id OF-TYPE integer COUNT 1
+
+ # What attributes to display
+ DISPLAY job-id
+ DISPLAY job-state
+}
+
+{
+ SKIP-IF-NOT-DEFINED job-id
+ NAME "Cancel current job"
+ OPERATION Cancel-Job
+ GROUP operation-attributes-tag
+ ATTR charset attributes-charset utf-8
+ ATTR language attributes-natural-language en
+ ATTR uri printer-uri $uri
+ ATTR integer job-id $job-id
+ ATTR name requesting-user-name $user
+
+ # What statuses are OK?
+ STATUS successful-ok
+}
+
+
+#
+# End of "$Id: get-jobs.test 9702 2011-04-20 21:16:08Z mike $".
+#
diff --git a/test/document-a4.ps b/test/document-a4.ps
index e3db4b99..a9794591 100644
--- a/test/document-a4.ps
+++ b/test/document-a4.ps
@@ -1,7 +1,7 @@
%!PS-Adobe-3.0
%XpdfVersion: 3.03
%%Creator: Scribus 1.4.0.rc5
-%%Title:
+%%Title:
%%LanguageLevel: 3
%%DocumentSuppliedResources: (atend)
%%DocumentMedia: plain 595 842 0 () ()
diff --git a/test/document-letter.ps b/test/document-letter.ps
index 29b15856..7f627f43 100644
--- a/test/document-letter.ps
+++ b/test/document-letter.ps
@@ -1,7 +1,7 @@
%!PS-Adobe-3.0
%XpdfVersion: 3.03
%%Creator: Scribus 1.4.0.rc5
-%%Title:
+%%Title:
%%LanguageLevel: 3
%%DocumentSuppliedResources: (atend)
%%DocumentMedia: plain 612 792 0 () ()
diff --git a/test/get-completed-jobs.test b/test/get-completed-jobs.test
index 7b5696c4..07311364 100644
--- a/test/get-completed-jobs.test
+++ b/test/get-completed-jobs.test
@@ -1,9 +1,9 @@
#
-# "$Id: get-completed-jobs.test 9086 2010-04-07 18:46:04Z mike $"
+# "$Id: get-completed-jobs.test 10286 2012-02-15 05:04:50Z mike $"
#
# Get list of completed jobs.
#
-# Copyright 2007-2010 by Apple Inc.
+# Copyright 2007-2012 by Apple Inc.
# Copyright 2001-2006 by Easy Software Products. All rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -32,7 +32,7 @@
ATTR uri printer-uri $uri
ATTR keyword which-jobs completed
ATTR keyword requested-attributes
- job-id,job-state,job-name,job-originating-user-name,job-media-sheets-completed
+ job-id,job-state,job-state-reasons,job-name,job-originating-user-name,job-media-sheets-completed
# What statuses are OK?
STATUS successful-ok
@@ -47,5 +47,5 @@
#
-# End of "$Id: get-completed-jobs.test 9086 2010-04-07 18:46:04Z mike $".
+# End of "$Id: get-completed-jobs.test 10286 2012-02-15 05:04:50Z mike $".
#
diff --git a/test/get-jobs.test b/test/get-jobs.test
index c7a07f6e..7c2353b5 100644
--- a/test/get-jobs.test
+++ b/test/get-jobs.test
@@ -1,5 +1,5 @@
#
-# "$Id: get-jobs.test 10233 2012-02-06 18:55:39Z mike $"
+# "$Id: get-jobs.test 10286 2012-02-15 05:04:50Z mike $"
#
# Get list of not-completed jobs.
#
@@ -31,8 +31,7 @@
ATTR language attributes-natural-language en
ATTR uri printer-uri $uri
ATTR keyword requested-attributes
- job-id,job-state,job-name,job-originating-user-name,job-media-sheets,job-media-sheets-completed,job-impressions,job-impressions-completed
- ATTR name requesting-user-name $user
+ job-id,job-state,job-state-reasons,job-name,job-originating-user-name,job-media-sheets,job-media-sheets-completed,job-impressions,job-impressions-completed
# What statuses are OK?
STATUS successful-ok
@@ -50,5 +49,5 @@
#
-# End of "$Id: get-jobs.test 10233 2012-02-06 18:55:39Z mike $".
+# End of "$Id: get-jobs.test 10286 2012-02-15 05:04:50Z mike $".
#
diff --git a/test/ipp-1.1.test b/test/ipp-1.1.test
index c9444a41..e89a275e 100644
--- a/test/ipp-1.1.test
+++ b/test/ipp-1.1.test
@@ -1,9 +1,9 @@
#
-# "$Id: ipp-1.1.test 10058 2011-10-05 15:03:34Z mike $"
+# "$Id: ipp-1.1.test 10461 2012-05-11 23:01:21Z mike $"
#
# IPP/1.1 test suite.
#
-# Copyright 2007-2011 by Apple Inc.
+# Copyright 2007-2012 by Apple Inc.
# Copyright 2001-2006 by Easy Software Products. All rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -15,6 +15,9 @@
# Usage:
#
# ./ipptool -f filename [-d document-uri=SOMEURI] -t printer-uri ipp-1.1.test
+# ./ipptool -f filename -d NOPRINT=1 -t printer-uri ipp-1.1.test
+#
+# The latter form disables all but the basic file printing.
#
# Regular expressions for URI schemes:
@@ -95,7 +98,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR uri printer-uri $uri
STATUS successful-ok
- EXPECT printer-uri-supported OF-TYPE uri WITH-VALUE "$IPP_URI_SCHEME"
+ EXPECT printer-uri-supported OF-TYPE uri WITH-ALL-VALUES "$IPP_URI_SCHEME"
}
@@ -153,7 +156,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS client-error-document-format-not-supported
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -325,7 +328,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
EXPECT printer-state OF-TYPE enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5
EXPECT printer-state-reasons OF-TYPE keyword IN-GROUP printer-attributes-tag
EXPECT printer-up-time OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0
- EXPECT printer-uri-supported OF-TYPE uri IN-GROUP printer-attributes-tag SAME-COUNT-AS uri-security-supported WITH-VALUE "$IPP_URI_SCHEME"
+ EXPECT printer-uri-supported OF-TYPE uri IN-GROUP printer-attributes-tag SAME-COUNT-AS uri-security-supported WITH-ALL-VALUES "$IPP_URI_SCHEME"
EXPECT queued-job-count OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
EXPECT uri-authentication-supported OF-TYPE keyword IN-GROUP printer-attributes-tag
EXPECT uri-security-supported OF-TYPE keyword IN-GROUP printer-attributes-tag SAME-COUNT-AS uri-authentication-supported
@@ -348,7 +351,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
- EXPECT printer-uri-supported OF-TYPE uri IN-GROUP printer-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
+ EXPECT printer-uri-supported OF-TYPE uri IN-GROUP printer-attributes-tag WITH-ALL-VALUES "$IPP_URI_SCHEME"
EXPECT !printer-name
}
@@ -668,7 +671,8 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR name requesting-user-name $user
STATUS successful-ok
- EXPECT job-state OF-TYPE unknown|enum IN-GROUP job-attributes-tag COUNT 1 WITH-VALUE >6,<10 REPEAT-NO-MATCH
+ EXPECT job-state OF-TYPE unknown|enum IN-GROUP job-attributes-tag COUNT 1 WITH-VALUE >6 REPEAT-NO-MATCH REPEAT-LIMIT 30
+ DISPLAY job-state
}
@@ -829,7 +833,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS client-error-document-format-not-supported
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -941,7 +945,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1258,7 +1262,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS client-error-document-format-not-supported
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1274,6 +1278,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
# Test PDF output
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
@@ -1295,7 +1300,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1309,6 +1314,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_DUPLEX
@@ -1332,7 +1338,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1346,6 +1352,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
@@ -1367,7 +1374,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1381,6 +1388,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_DUPLEX
@@ -1404,7 +1412,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1420,6 +1428,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
# Test PostScript output
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_POSTSCRIPT
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
@@ -1441,7 +1450,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1455,6 +1464,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_POSTSCRIPT
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_DUPLEX
@@ -1478,7 +1488,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1492,6 +1502,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_POSTSCRIPT
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
@@ -1513,7 +1524,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1527,6 +1538,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_POSTSCRIPT
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_DUPLEX
@@ -1550,7 +1562,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1566,6 +1578,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
# Test JPEG output
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_JPEG
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
@@ -1587,7 +1600,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1601,6 +1614,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_JPEG
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
@@ -1622,7 +1636,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1636,6 +1650,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_JPEG
SKIP-IF-NOT-DEFINED OPTIONAL_4X6_MEDIA
@@ -1657,7 +1672,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1671,6 +1686,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_JPEG
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
@@ -1692,7 +1708,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1706,6 +1722,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_JPEG
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
@@ -1727,7 +1744,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1741,6 +1758,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_JPEG
SKIP-IF-NOT-DEFINED OPTIONAL_4X6_MEDIA
@@ -1762,7 +1780,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1778,6 +1796,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
# Print-Job with job-sheets
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_STANDARD_SHEET
@@ -1801,7 +1820,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1815,6 +1834,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_STANDARD_SHEET
@@ -1838,7 +1858,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1852,6 +1872,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_POSTSCRIPT
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_STANDARD_SHEET
@@ -1875,7 +1896,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1889,6 +1910,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_POSTSCRIPT
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_STANDARD_SHEET
@@ -1912,7 +1934,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1928,6 +1950,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
# Test number-up output
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_2UP
@@ -1939,7 +1962,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR naturalLanguage attributes-natural-language en
ATTR uri printer-uri $uri
ATTR name requesting-user-name $user
- ATTR name job-name "A4 Test Document, 2-Up"
+ ATTR name job-name "A4 Test Document; 2-Up"
ATTR boolean ipp-attribute-fidelity false
ATTR name document-name document-a4.pdf
ATTR keyword compression none
@@ -1951,7 +1974,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -1965,6 +1988,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_2UP
@@ -1976,7 +2000,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR naturalLanguage attributes-natural-language en
ATTR uri printer-uri $uri
ATTR name requesting-user-name $user
- ATTR name job-name "US Letter Test Document, 2-Up"
+ ATTR name job-name "US Letter Test Document; 2-Up"
ATTR boolean ipp-attribute-fidelity false
ATTR name document-name document-letter.pdf
ATTR keyword compression none
@@ -1988,7 +2012,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -2002,6 +2026,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_POSTSCRIPT
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_2UP
@@ -2013,7 +2038,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR naturalLanguage attributes-natural-language en
ATTR uri printer-uri $uri
ATTR name requesting-user-name $user
- ATTR name job-name "A4 Test Document, 2-Up"
+ ATTR name job-name "A4 Test Document; 2-Up"
ATTR boolean ipp-attribute-fidelity false
ATTR name document-name document-a4.ps
ATTR keyword compression none
@@ -2025,7 +2050,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -2039,6 +2064,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_POSTSCRIPT
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_2UP
@@ -2050,7 +2076,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR naturalLanguage attributes-natural-language en
ATTR uri printer-uri $uri
ATTR name requesting-user-name $user
- ATTR name job-name "US Letter Test Document, 2-Up"
+ ATTR name job-name "US Letter Test Document; 2-Up"
ATTR boolean ipp-attribute-fidelity false
ATTR name document-name document-letter.ps
ATTR keyword compression none
@@ -2062,7 +2088,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -2078,6 +2104,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
# Test output with print-quality...
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_JPEG
SKIP-IF-NOT-DEFINED OPTIONAL_4X6_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_DRAFT_QUALITY
@@ -2089,7 +2116,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR naturalLanguage attributes-natural-language en
ATTR uri printer-uri $uri
ATTR name requesting-user-name $user
- ATTR name job-name "4x6 Color JPEG, Draft Quality"
+ ATTR name job-name "4x6 Color JPEG; Draft Quality"
ATTR boolean ipp-attribute-fidelity false
ATTR name document-name color.jpg
ATTR keyword compression none
@@ -2101,7 +2128,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -2115,6 +2142,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_JPEG
SKIP-IF-NOT-DEFINED OPTIONAL_4X6_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_NORMAL_QUALITY
@@ -2126,7 +2154,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR naturalLanguage attributes-natural-language en
ATTR uri printer-uri $uri
ATTR name requesting-user-name $user
- ATTR name job-name "4x6 Color JPEG, Normal Quality"
+ ATTR name job-name "4x6 Color JPEG; Normal Quality"
ATTR boolean ipp-attribute-fidelity false
ATTR name document-name color.jpg
ATTR keyword compression none
@@ -2138,7 +2166,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -2152,6 +2180,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_JPEG
SKIP-IF-NOT-DEFINED OPTIONAL_4X6_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_HIGH_QUALITY
@@ -2163,7 +2192,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR naturalLanguage attributes-natural-language en
ATTR uri printer-uri $uri
ATTR name requesting-user-name $user
- ATTR name job-name "4x6 Color JPEG, High Quality"
+ ATTR name job-name "4x6 Color JPEG; High Quality"
ATTR boolean ipp-attribute-fidelity false
ATTR name document-name color.jpg
ATTR keyword compression none
@@ -2175,7 +2204,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -2189,6 +2218,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_A4_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_DRAFT_QUALITY
@@ -2200,7 +2230,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR naturalLanguage attributes-natural-language en
ATTR uri printer-uri $uri
ATTR name requesting-user-name $user
- ATTR name job-name "A4 Test Document, 2-Up"
+ ATTR name job-name "A4 Test Document; 2-Up"
ATTR boolean ipp-attribute-fidelity false
ATTR name document-name document-a4.pdf
ATTR keyword compression none
@@ -2212,7 +2242,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -2226,6 +2256,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
}
{
+ SKIP-IF-DEFINED NOPRINT
SKIP-IF-NOT-DEFINED OPTIONAL_PDF
SKIP-IF-NOT-DEFINED OPTIONAL_LETTER_MEDIA
SKIP-IF-NOT-DEFINED OPTIONAL_DRAFT_QUALITY
@@ -2237,7 +2268,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
ATTR naturalLanguage attributes-natural-language en
ATTR uri printer-uri $uri
ATTR name requesting-user-name $user
- ATTR name job-name "US Letter Test Document, 2-Up"
+ ATTR name job-name "US Letter Test Document; 2-Up"
ATTR boolean ipp-attribute-fidelity false
ATTR name document-name document-letter.pdf
ATTR keyword compression none
@@ -2249,7 +2280,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -2284,7 +2315,7 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
STATUS successful-ok
STATUS server-error-job-canceled
- STATUS server-error-busy REPEAT-MATCH
+ STATUS server-error-busy REPEAT-MATCH REPEAT-LIMIT 10
EXPECT job-uri OF-TYPE uri COUNT 1 IN-GROUP job-attributes-tag WITH-VALUE "$IPP_URI_SCHEME"
EXPECT job-id OF-TYPE integer COUNT 1 IN-GROUP job-attributes-tag
@@ -2315,5 +2346,5 @@ DEFINE IPP_URI_SCHEME "/^ipps?://.+$$/"
#
-# End of "$Id: ipp-1.1.test 10058 2011-10-05 15:03:34Z mike $".
+# End of "$Id: ipp-1.1.test 10461 2012-05-11 23:01:21Z mike $".
#
diff --git a/test/ipp-2.0.test b/test/ipp-2.0.test
index 441796a7..cb7fb66f 100644
--- a/test/ipp-2.0.test
+++ b/test/ipp-2.0.test
@@ -1,9 +1,9 @@
#
-# "$Id: ipp-2.0.test 10046 2011-10-03 21:14:02Z mike $"
+# "$Id: ipp-2.0.test 10314 2012-02-29 04:27:56Z mike $"
#
# IPP/2.0 test suite.
#
-# Copyright 2007-2011 by Apple Inc.
+# Copyright 2007-2012 by Apple Inc.
# Copyright 2001-2006 by Easy Software Products. All rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -24,7 +24,7 @@ INCLUDE "ipp-1.1.test"
# Regular expression for PWG media size names (eek!)
-DEFINE MEDIA_REGEX "/^((custom|na|asme|roc|oe)_[a-z0-9][-a-z0-9]*_([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])x([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])in|(custom|iso|jis|jpn|prc|om)_[a-z0-9][-a-z0-9]*_([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])x([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])mm)$$/"
+DEFINE MEDIA_REGEX "/^(choice(_((custom|na|asme|roc|oe|roll)_[a-z0-9][-a-z0-9]*_([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])x([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])in|(custom|iso|jis|jpn|prc|om|roll)_[a-z0-9][-a-z0-9]*_([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])x([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])mm)){2,}|(custom|na|asme|roc|oe|roll)_[a-z0-9][-a-z0-9]*_([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])x([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])in|(custom|iso|jis|jpn|prc|om|roll)_[a-z0-9][-a-z0-9]*_([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])x([1-9][0-9]*(\.[0-9]*[1-9])?|0\.[0-9]*[1-9])mm)$$/"
# Test required printer description attribute support.
@@ -50,10 +50,10 @@ DEFINE MEDIA_REGEX "/^((custom|na|asme|roc|oe)_[a-z0-9][-a-z0-9]*_([1-9][0-9]*(\
EXPECT copies-supported OF-TYPE rangeOfInteger IN-GROUP printer-attributes-tag
EXPECT finishings-default OF-TYPE enum IN-GROUP printer-attributes-tag
EXPECT finishings-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3
- EXPECT media-default OF-TYPE no-value|keyword|name IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "no-value,$MEDIA_REGEX"
- EXPECT ?media-ready OF-TYPE keyword|name IN-GROUP printer-attributes-tag WITH-VALUE "$MEDIA_REGEX"
- EXPECT media-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag WITH-VALUE "$MEDIA_REGEX"
- EXPECT orientation-requested-default OF-TYPE no-value|enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE no-value,3,4,5,6
+ EXPECT media-default OF-TYPE no-value|keyword|name IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "$MEDIA_REGEX"
+ EXPECT ?media-ready OF-TYPE keyword|name IN-GROUP printer-attributes-tag WITH-ALL-VALUES "$MEDIA_REGEX"
+ EXPECT media-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag WITH-ALL-VALUES "$MEDIA_REGEX"
+ EXPECT orientation-requested-default OF-TYPE no-value|enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5,6
EXPECT orientation-requested-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3,4,5,6
EXPECT output-bin-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag COUNT 1
EXPECT output-bin-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag
@@ -61,8 +61,8 @@ DEFINE MEDIA_REGEX "/^((custom|na|asme|roc|oe)_[a-z0-9][-a-z0-9]*_([1-9][0-9]*(\
EXPECT print-quality-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3,4,5
EXPECT printer-resolution-default OF-TYPE resolution IN-GROUP printer-attributes-tag COUNT 1
EXPECT printer-resolution-supported OF-TYPE resolution IN-GROUP printer-attributes-tag
- EXPECT sides-default OF-TYPE keyword IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
- EXPECT sides-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
+ EXPECT sides-default OF-TYPE keyword IN-GROUP printer-attributes-tag COUNT 1 WITH-ALL-VALUES "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
+ EXPECT sides-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-ALL-VALUES "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
# Optional media-col support
EXPECT ?media-col-default OF-TYPE collection IN-GROUP printer-attributes-tag COUNT 1
@@ -111,5 +111,5 @@ DEFINE MEDIA_REGEX "/^((custom|na|asme|roc|oe)_[a-z0-9][-a-z0-9]*_([1-9][0-9]*(\
#
-# End of "$Id: ipp-2.0.test 10046 2011-10-03 21:14:02Z mike $".
+# End of "$Id: ipp-2.0.test 10314 2012-02-29 04:27:56Z mike $".
#
diff --git a/test/ipp-2.1.test b/test/ipp-2.1.test
index 87a86e4e..738aefab 100644
--- a/test/ipp-2.1.test
+++ b/test/ipp-2.1.test
@@ -1,5 +1,5 @@
#
-# "$Id: ipp-2.1.test 10011 2011-09-21 06:01:35Z mike $"
+# "$Id: ipp-2.1.test 10010 2011-09-21 06:01:12Z mike $"
#
# IPP/2.1 test suite.
#
@@ -92,5 +92,5 @@ INCLUDE "ipp-2.0.test"
#
-# End of "$Id: ipp-2.1.test 10011 2011-09-21 06:01:35Z mike $".
+# End of "$Id: ipp-2.1.test 10010 2011-09-21 06:01:12Z mike $".
#
diff --git a/test/ipp-2.2.test b/test/ipp-2.2.test
index 3042ec24..1586dc17 100644
--- a/test/ipp-2.2.test
+++ b/test/ipp-2.2.test
@@ -1,5 +1,5 @@
#
-# "$Id$"
+# "$Id: ipp-2.2.test 10029 2011-09-29 23:49:56Z mike $"
#
# IPP/2.2 test suite.
#
@@ -82,5 +82,5 @@ INCLUDE "ipp-2.1.test"
#
-# End of "$Id$".
+# End of "$Id: ipp-2.2.test 10029 2011-09-29 23:49:56Z mike $".
#
diff --git a/test/ippserver.c b/test/ippserver.c
index 23880a14..ef084e37 100644
--- a/test/ippserver.c
+++ b/test/ippserver.c
@@ -1,9 +1,9 @@
/*
- * "$Id: ippserver.c 10031 2011-09-30 05:24:10Z mike $"
+ * "$Id: ippserver.c 10165 2012-01-06 20:42:45Z mike $"
*
* Sample IPP/2.0 server for CUPS.
*
- * Copyright 2010-2011 by Apple Inc.
+ * Copyright 2010-2012 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -18,7 +18,6 @@
* main() - Main entry to the sample server.
* clean_jobs() - Clean out old (completed) jobs.
* compare_jobs() - Compare two jobs.
- * copy_attribute() - Copy a single attribute.
* copy_attributes() - Copy attributes from one request to
* another.
* copy_job_attrs() - Copy job attributes to the response.
@@ -254,8 +253,6 @@ typedef struct _ipp_client_s /**** Client data ****/
static void clean_jobs(_ipp_printer_t *printer);
static int compare_jobs(_ipp_job_t *a, _ipp_job_t *b);
-static ipp_attribute_t *copy_attribute(ipp_t *to, ipp_attribute_t *attr,
- ipp_tag_t group_tag, int quickcopy);
static void copy_attributes(ipp_t *to, ipp_t *from, cups_array_t *ra,
ipp_tag_t group_tag, int quickcopy);
static void copy_job_attributes(_ipp_client_t *client,
@@ -577,191 +574,6 @@ compare_jobs(_ipp_job_t *a, /* I - First job */
/*
- * 'copy_attribute()' - Copy a single attribute.
- */
-
-static ipp_attribute_t * /* O - New attribute */
-copy_attribute(
- ipp_t *to, /* O - Destination request/response */
- ipp_attribute_t *attr, /* I - Attribute to copy */
- ipp_tag_t group_tag, /* I - Group to put the copy in */
- int quickcopy) /* I - Do a quick copy? */
-{
- int i; /* Looping var */
- ipp_attribute_t *toattr; /* Destination attribute */
-
-
- if (Verbosity && attr->name)
- {
- char buffer[2048]; /* Attribute value */
-
- _ippAttrString(attr, buffer, sizeof(buffer));
-
- fprintf(stderr, "Copying %s (%s%s) %s\n", attr->name,
- attr->num_values > 1 ? "1setOf " : "",
- ippTagString(attr->value_tag & ~IPP_TAG_COPY), buffer);
- }
-
- switch (attr->value_tag & ~IPP_TAG_COPY)
- {
- case IPP_TAG_ZERO :
- toattr = ippAddSeparator(to);
- break;
-
- case IPP_TAG_INTEGER :
- case IPP_TAG_ENUM :
- toattr = ippAddIntegers(to, group_tag, attr->value_tag,
- attr->name, attr->num_values, NULL);
-
- for (i = 0; i < attr->num_values; i ++)
- toattr->values[i].integer = attr->values[i].integer;
- break;
-
- case IPP_TAG_BOOLEAN :
- toattr = ippAddBooleans(to, group_tag, attr->name,
- attr->num_values, NULL);
-
- for (i = 0; i < attr->num_values; i ++)
- toattr->values[i].boolean = attr->values[i].boolean;
- break;
-
- case IPP_TAG_TEXT :
- case IPP_TAG_NAME :
- case IPP_TAG_KEYWORD :
- case IPP_TAG_URI :
- case IPP_TAG_URISCHEME :
- case IPP_TAG_CHARSET :
- case IPP_TAG_LANGUAGE :
- case IPP_TAG_MIMETYPE :
- toattr = ippAddStrings(to, group_tag,
- (ipp_tag_t)(attr->value_tag | quickcopy),
- attr->name, attr->num_values, NULL, NULL);
-
- if (quickcopy)
- {
- for (i = 0; i < attr->num_values; i ++)
- toattr->values[i].string.text = attr->values[i].string.text;
- }
- else
- {
- for (i = 0; i < attr->num_values; i ++)
- toattr->values[i].string.text =
- _cupsStrAlloc(attr->values[i].string.text);
- }
- break;
-
- case IPP_TAG_DATE :
- toattr = ippAddDate(to, group_tag, attr->name,
- attr->values[0].date);
- break;
-
- case IPP_TAG_RESOLUTION :
- toattr = ippAddResolutions(to, group_tag, attr->name,
- attr->num_values, IPP_RES_PER_INCH,
- NULL, NULL);
-
- for (i = 0; i < attr->num_values; i ++)
- {
- toattr->values[i].resolution.xres = attr->values[i].resolution.xres;
- toattr->values[i].resolution.yres = attr->values[i].resolution.yres;
- toattr->values[i].resolution.units = attr->values[i].resolution.units;
- }
- break;
-
- case IPP_TAG_RANGE :
- toattr = ippAddRanges(to, group_tag, attr->name,
- attr->num_values, NULL, NULL);
-
- for (i = 0; i < attr->num_values; i ++)
- {
- toattr->values[i].range.lower = attr->values[i].range.lower;
- toattr->values[i].range.upper = attr->values[i].range.upper;
- }
- break;
-
- case IPP_TAG_TEXTLANG :
- case IPP_TAG_NAMELANG :
- toattr = ippAddStrings(to, group_tag,
- (ipp_tag_t)(attr->value_tag | quickcopy),
- attr->name, attr->num_values, NULL, NULL);
-
- if (quickcopy)
- {
- for (i = 0; i < attr->num_values; i ++)
- {
- toattr->values[i].string.charset = attr->values[i].string.charset;
- toattr->values[i].string.text = attr->values[i].string.text;
- }
- }
- else
- {
- for (i = 0; i < attr->num_values; i ++)
- {
- if (!i)
- toattr->values[i].string.charset =
- _cupsStrAlloc(attr->values[i].string.charset);
- else
- toattr->values[i].string.charset =
- toattr->values[0].string.charset;
-
- toattr->values[i].string.text =
- _cupsStrAlloc(attr->values[i].string.text);
- }
- }
- break;
-
- case IPP_TAG_BEGIN_COLLECTION :
- toattr = ippAddCollections(to, group_tag, attr->name,
- attr->num_values, NULL);
-
- for (i = 0; i < attr->num_values; i ++)
- {
- toattr->values[i].collection = attr->values[i].collection;
- attr->values[i].collection->use ++;
- }
- break;
-
- case IPP_TAG_STRING :
- if (quickcopy)
- {
- toattr = ippAddOctetString(to, group_tag, attr->name, NULL, 0);
- toattr->value_tag |= quickcopy;
- toattr->values[0].unknown.data = attr->values[0].unknown.data;
- toattr->values[0].unknown.length = attr->values[0].unknown.length;
- }
- else
- toattr = ippAddOctetString(to, attr->group_tag, attr->name,
- attr->values[0].unknown.data,
- attr->values[0].unknown.length);
- break;
-
- default :
- toattr = ippAddIntegers(to, group_tag, attr->value_tag,
- attr->name, attr->num_values, NULL);
-
- for (i = 0; i < attr->num_values; i ++)
- {
- toattr->values[i].unknown.length = attr->values[i].unknown.length;
-
- if (toattr->values[i].unknown.length > 0)
- {
- if ((toattr->values[i].unknown.data =
- malloc(toattr->values[i].unknown.length)) == NULL)
- toattr->values[i].unknown.length = 0;
- else
- memcpy(toattr->values[i].unknown.data,
- attr->values[i].unknown.data,
- toattr->values[i].unknown.length);
- }
- }
- break; /* anti-compiler-warning-code */
- }
-
- return (toattr);
-}
-
-
-/*
* 'copy_attributes()' - Copy attributes from one request to another.
*/
@@ -789,7 +601,7 @@ copy_attributes(ipp_t *to, /* I - Destination request */
continue;
if (!ra || cupsArrayFind(ra, fromattr->name))
- copy_attribute(to, fromattr, fromattr->group_tag, quickcopy);
+ ippCopyAttribute(to, fromattr, quickcopy);
}
}
@@ -1215,7 +1027,7 @@ create_printer(const char *servername, /* I - Server hostname (NULL for default)
/* media-size-supported value */
ipp_t *media_col_default;
/* media-col-default value */
- ipp_value_t *media_col_value;
+ _ipp_value_t *media_col_value;
/* Current media-col-database value */
int k_supported; /* Maximum file size supported */
#ifdef HAVE_STATVFS
@@ -2084,7 +1896,7 @@ debug_attributes(const char *title, /* I - Title */
if (attr->name)
{
- _ippAttrString(attr, buffer, sizeof(buffer));
+ ippAttributeString(attr, buffer, sizeof(buffer));
fprintf(stderr, " %s (%s%s) %s\n", attr->name,
attr->num_values > 1 ? "1setOf " : "",
ippTagString(attr->value_tag), buffer);
@@ -3587,7 +3399,7 @@ ipp_send_document(_ipp_client_t *client)/* I - Client */
if (close(job->fd))
{
- int error = errno; /* Write error */
+ int error = errno; /* Write error */
job->state = IPP_JOB_ABORTED;
job->fd = -1;
@@ -4978,12 +4790,18 @@ respond_unsupported(
_ipp_client_t *client, /* I - Client */
ipp_attribute_t *attr) /* I - Atribute */
{
+ ipp_attribute_t *temp; /* Copy of attribute */
+
+
if (!client->response->attrs)
respond_ipp(client, IPP_ATTRIBUTES, "Unsupported %s %s%s value.",
attr->name, attr->num_values > 1 ? "1setOf " : "",
ippTagString(attr->value_tag));
+ else
+ ippSetStatusCode(client->response, IPP_ATTRIBUTES);
- copy_attribute(client->response, attr, IPP_TAG_UNSUPPORTED_GROUP, 0);
+ temp = ippCopyAttribute(client->response, attr, 0);
+ ippSetGroupTag(client->response, &temp, IPP_TAG_UNSUPPORTED_GROUP);
}
@@ -5433,5 +5251,5 @@ valid_job_attributes(
/*
- * End of "$Id: ippserver.c 10031 2011-09-30 05:24:10Z mike $".
+ * End of "$Id: ippserver.c 10165 2012-01-06 20:42:45Z mike $".
*/
diff --git a/test/ipptool.c b/test/ipptool.c
index 23270ee5..dac5541c 100644
--- a/test/ipptool.c
+++ b/test/ipptool.c
@@ -1,9 +1,9 @@
/*
- * "$Id: ipptool.c 10090 2011-10-25 22:39:56Z mike $"
+ * "$Id: ipptool.c 10461 2012-05-11 23:01:21Z mike $"
*
* ipptool command for CUPS.
*
- * Copyright 2007-2011 by Apple Inc.
+ * Copyright 2007-2012 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -17,6 +17,7 @@
* Contents:
*
* main() - Parse options and do tests.
+ * add_stringf() - Add a formatted string to an array.
* compare_vars() - Compare two variables.
* do_tests() - Do tests as specified in the test file.
* expand_variables() - Expand variables in a string.
@@ -33,7 +34,6 @@
* print_csv() - Print a line of CSV text.
* print_fatal_error() - Print a fatal error message.
* print_line() - Print a line of formatted or CSV text.
- * print_test_error() - Print a test error message.
* print_xml_header() - Print a standard XML plist header.
* print_xml_string() - Print an XML string with escaping.
* print_xml_trailer() - Print the XML trailer with success/fail value.
@@ -81,6 +81,13 @@ typedef enum _cups_output_e /**** Output mode ****/
_CUPS_OUTPUT_CSV /* Comma-separated values output */
} _cups_output_t;
+typedef enum _cups_with_e /**** WITH flags ****/
+{
+ _CUPS_WITH_LITERAL = 0, /* Match string is a literal value */
+ _CUPS_WITH_ALL = 1, /* Must match all values */
+ _CUPS_WITH_REGEX = 2 /* Match string is a regular expression */
+} _cups_with_t;
+
typedef struct _cups_expect_s /**** Expected attribute info ****/
{
int optional, /* Optional attribute? */
@@ -94,9 +101,10 @@ typedef struct _cups_expect_s /**** Expected attribute info ****/
*define_match, /* Variable to define on match */
*define_no_match, /* Variable to define on no-match */
*define_value; /* Variable to define with value */
- int repeat_match, /* Repeat test on match */
+ int repeat_limit, /* Maximum number of times to repeat */
+ repeat_match, /* Repeat test on match */
repeat_no_match, /* Repeat test on no match */
- with_regex, /* WITH-VALUE is a regular expression */
+ with_flags, /* WITH flags */
count; /* Expected count if > 0 */
ipp_tag_t in_group; /* IN-GROUP value */
} _cups_expect_t;
@@ -106,7 +114,8 @@ typedef struct _cups_status_s /**** Status info ****/
ipp_status_t status; /* Expected status code */
char *if_defined, /* Only if variable is defined */
*if_not_defined; /* Only if variable is not defined */
- int repeat_match, /* Repeat the test when it does not match */
+ int repeat_limit, /* Maximum number of times to repeat */
+ repeat_match, /* Repeat the test when it does not match */
repeat_no_match; /* Repeat the test when it matches */
} _cups_status_t;
@@ -171,14 +180,12 @@ const char * const URIStatusStrings[] = /* URI status strings */
* Local functions...
*/
+static void add_stringf(cups_array_t *a, const char *s, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
static int compare_vars(_cups_var_t *a, _cups_var_t *b);
static int do_tests(_cups_vars_t *vars, const char *testfile);
static void expand_variables(_cups_vars_t *vars, char *dst, const char *src,
- size_t dstsize)
-#ifdef __GNUC__
-__attribute((nonnull(1,2,3)))
-#endif /* __GNUC__ */
-;
+ size_t dstsize) __attribute__((nonnull(1,2,3)));
static int expect_matches(_cups_expect_t *expect, ipp_tag_t value_tag);
static ipp_t *get_collection(_cups_vars_t *vars, FILE *fp, int *linenum);
static char *get_filename(const char *testfile, char *dst, const char *src,
@@ -193,17 +200,9 @@ static void print_col(ipp_t *col);
static void print_csv(ipp_attribute_t *attr, int num_displayed,
char **displayed, size_t *widths);
static void print_fatal_error(const char *s, ...)
-#ifdef __GNUC__
-__attribute__ ((__format__ (__printf__, 1, 2)))
-#endif /* __GNUC__ */
-;
+ __attribute__ ((__format__ (__printf__, 1, 2)));
static void print_line(ipp_attribute_t *attr, int num_displayed,
char **displayed, size_t *widths);
-static void print_test_error(const char *s, ...)
-#ifdef __GNUC__
-__attribute__ ((__format__ (__printf__, 1, 2)))
-#endif /* __GNUC__ */
-;
static void print_xml_header(void);
static void print_xml_string(const char *element, const char *s);
static void print_xml_trailer(int success, const char *message);
@@ -213,10 +212,11 @@ static void set_variable(_cups_vars_t *vars, const char *name,
static void sigterm_handler(int sig);
#endif /* WIN32 */
static int timeout_cb(http_t *http, void *user_data);
-static void usage(void);
-static int validate_attr(ipp_attribute_t *attr, int print);
-static int with_value(char *value, int regex, ipp_attribute_t *attr,
- int report, char *matchbuf, size_t matchlen);
+static void usage(void) __attribute__((noreturn));
+static int validate_attr(cups_array_t *errors, ipp_attribute_t *attr);
+static int with_value(cups_array_t *errors, char *value, int flags,
+ ipp_attribute_t *attr, char *matchbuf,
+ size_t matchlen);
/*
@@ -419,7 +419,11 @@ main(int argc, /* I - Number of command-line args */
*/
snprintf(filename, sizeof(filename), "%s.gz", argv[i]);
- if (access(filename, 0) && filename[0] != '/')
+ if (access(filename, 0) && filename[0] != '/'
+#ifdef WIN32
+ && (!isalpha(filename[0] & 255) || filename[1] != ':')
+#endif /* WIN32 */
+ )
{
snprintf(filename, sizeof(filename), "%s/ipptool/%s",
cg->cups_datadir, argv[i]);
@@ -454,6 +458,9 @@ main(int argc, /* I - Number of command-line args */
set_variable(&vars, "filetype", "text/html");
else if (!_cups_strcasecmp(ext, ".jpg"))
set_variable(&vars, "filetype", "image/jpeg");
+ else if (!_cups_strcasecmp(ext, ".pcl") ||
+ !_cups_strcasecmp(ext, ".pcl.gz"))
+ set_variable(&vars, "filetype", "application/vnd.hp-PCL");
else if (!_cups_strcasecmp(ext, ".pdf"))
set_variable(&vars, "filetype", "application/pdf");
else if (!_cups_strcasecmp(ext, ".png"))
@@ -505,8 +512,8 @@ main(int argc, /* I - Number of command-line args */
if (Output == _CUPS_OUTPUT_PLIST && interval)
{
- _cupsLangPuts(stderr, _("ipptool: \"-i\" is incompatible with "
- "\"-X\"."));
+ _cupsLangPuts(stderr, _("ipptool: \"-i\" and \"-n\" are "
+ "incompatible with -X\"."));
usage();
}
break;
@@ -529,8 +536,8 @@ main(int argc, /* I - Number of command-line args */
if (Output == _CUPS_OUTPUT_PLIST && repeat)
{
- _cupsLangPuts(stderr, _("ipptool: \"-n\" is incompatible with "
- "\"-X\"."));
+ _cupsLangPuts(stderr, _("ipptool: \"-i\" and \"-n\" are "
+ "incompatible with -X\"."));
usage();
}
break;
@@ -618,7 +625,11 @@ main(int argc, /* I - Number of command-line args */
usage();
}
- if (access(argv[i], 0) && argv[i][0] != '/')
+ if (access(argv[i], 0) && argv[i][0] != '/'
+#ifdef WIN32
+ && (!isalpha(argv[i][0] & 255) || argv[i][1] != ':')
+#endif /* WIN32 */
+ )
{
snprintf(testname, sizeof(testname), "%s/ipptool/%s", cg->cups_datadir,
argv[i]);
@@ -681,6 +692,42 @@ main(int argc, /* I - Number of command-line args */
/*
+ * 'add_stringf()' - Add a formatted string to an array.
+ */
+
+static void
+add_stringf(cups_array_t *a, /* I - Array */
+ const char *s, /* I - Printf-style format string */
+ ...) /* I - Additional args as needed */
+{
+ char buffer[10240]; /* Format buffer */
+ va_list ap; /* Argument pointer */
+
+
+ /*
+ * Don't bother is the array is NULL...
+ */
+
+ if (!a)
+ return;
+
+ /*
+ * Format the message...
+ */
+
+ va_start(ap, s);
+ vsnprintf(buffer, sizeof(buffer), s, ap);
+ va_end(ap);
+
+ /*
+ * Add it to the array...
+ */
+
+ cupsArrayAdd(a, buffer);
+}
+
+
+/*
* 'compare_vars()' - Compare two variables.
*/
@@ -708,6 +755,9 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
show_header = 1, /* Show the test header? */
ignore_errors, /* Ignore test failures? */
skip_previous = 0, /* Skip on previous test failure? */
+ repeat_count, /* Repeat count */
+ repeat_interval, /* Repeat interval */
+ repeat_prev, /* Previous repeat interval */
repeat_test; /* Repeat a test? */
http_t *http = NULL; /* HTTP connection to server */
FILE *fp = NULL; /* Test file */
@@ -744,7 +794,9 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
int num_displayed = 0; /* Number of displayed attributes */
char *displayed[200]; /* Displayed attributes */
size_t widths[200]; /* Width of columns */
- cups_array_t *a; /* Duplicate attribute array */
+ cups_array_t *a, /* Duplicate attribute array */
+ *errors = NULL; /* Errors array */
+ const char *error; /* Current error */
/*
@@ -789,6 +841,8 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
CUPS_SRAND(time(NULL));
+ errors = cupsArrayNew3(NULL, NULL, NULL, 0, (cups_acopy_func_t)strdup,
+ (cups_afree_func_t)free);
pass = 1;
linenum = 1;
request_id = (CUPS_RAND() % 1000) * 137 + 1;
@@ -1122,14 +1176,17 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
_cups_strcasecmp(token, "IF-NOT-DEFINED") &&
_cups_strcasecmp(token, "IN-GROUP") &&
_cups_strcasecmp(token, "OF-TYPE") &&
+ _cups_strcasecmp(token, "REPEAT-LIMIT") &&
_cups_strcasecmp(token, "REPEAT-MATCH") &&
_cups_strcasecmp(token, "REPEAT-NO-MATCH") &&
_cups_strcasecmp(token, "SAME-COUNT-AS") &&
+ _cups_strcasecmp(token, "WITH-ALL-VALUES") &&
_cups_strcasecmp(token, "WITH-VALUE"))
last_expect = NULL;
if (_cups_strcasecmp(token, "IF-DEFINED") &&
_cups_strcasecmp(token, "IF-NOT-DEFINED") &&
+ _cups_strcasecmp(token, "REPEAT-LIMIT") &&
_cups_strcasecmp(token, "REPEAT-MATCH") &&
_cups_strcasecmp(token, "REPEAT-NO-MATCH"))
last_status = NULL;
@@ -1156,7 +1213,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
if ((tempcol = realloc(lastcol, sizeof(ipp_attribute_t) +
(lastcol->num_values + 1) *
- sizeof(ipp_value_t))) == NULL)
+ sizeof(_ipp_value_t))) == NULL)
{
print_fatal_error("Unable to allocate memory on line %d.", linenum);
pass = 0;
@@ -1509,21 +1566,22 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
}
expand_variables(vars, token, temp, sizeof(token));
+ attrptr = NULL;
switch (value)
{
case IPP_TAG_BOOLEAN :
if (!_cups_strcasecmp(token, "true"))
- ippAddBoolean(request, group, attr, 1);
+ attrptr = ippAddBoolean(request, group, attr, 1);
else
- ippAddBoolean(request, group, attr, atoi(token));
+ attrptr = ippAddBoolean(request, group, attr, atoi(token));
break;
case IPP_TAG_INTEGER :
case IPP_TAG_ENUM :
if (!strchr(token, ','))
- ippAddInteger(request, group, value, attr,
- strtol(token, &tokenptr, 0));
+ attrptr = ippAddInteger(request, group, value, attr,
+ strtol(token, &tokenptr, 0));
else
{
int values[100], /* Values */
@@ -1542,7 +1600,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
num_values ++;
}
- ippAddIntegers(request, group, value, attr, num_values, values);
+ attrptr = ippAddIntegers(request, group, value, attr, num_values, values);
}
if (!tokenptr || *tokenptr)
@@ -1568,7 +1626,9 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
}
if (ptr <= token || xres <= 0 || yres <= 0 || !ptr ||
- (_cups_strcasecmp(ptr, "dpi") && _cups_strcasecmp(ptr, "dpc") &&
+ (_cups_strcasecmp(ptr, "dpi") &&
+ _cups_strcasecmp(ptr, "dpc") &&
+ _cups_strcasecmp(ptr, "dpcm") &&
_cups_strcasecmp(ptr, "other")))
{
print_fatal_error("Bad resolution value \"%s\" on line %d.",
@@ -1578,14 +1638,15 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
}
if (!_cups_strcasecmp(ptr, "dpi"))
- ippAddResolution(request, group, attr, IPP_RES_PER_INCH,
- xres, yres);
- else if (!_cups_strcasecmp(ptr, "dpc"))
- ippAddResolution(request, group, attr, IPP_RES_PER_CM,
- xres, yres);
+ attrptr = ippAddResolution(request, group, attr, IPP_RES_PER_INCH,
+ xres, yres);
+ else if (!_cups_strcasecmp(ptr, "dpc") ||
+ !_cups_strcasecmp(ptr, "dpcm"))
+ attrptr = ippAddResolution(request, group, attr, IPP_RES_PER_CM,
+ xres, yres);
else
- ippAddResolution(request, group, attr, (ipp_res_t)0,
- xres, yres);
+ attrptr = ippAddResolution(request, group, attr, (ipp_res_t)0,
+ xres, yres);
}
break;
@@ -1610,8 +1671,8 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
goto test_exit;
}
- ippAddRanges(request, group, attr, num_vals / 2, lowers,
- uppers);
+ attrptr = ippAddRanges(request, group, attr, num_vals / 2, lowers,
+ uppers);
}
break;
@@ -1623,7 +1684,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
if (col)
{
- lastcol = ippAddCollection(request, group, attr, col);
+ attrptr = lastcol = ippAddCollection(request, group, attr, col);
ippDelete(col);
}
else
@@ -1658,7 +1719,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
case IPP_TAG_LANGUAGE :
case IPP_TAG_MIMETYPE :
if (!strchr(token, ','))
- ippAddString(request, group, value, attr, NULL, token);
+ attrptr = ippAddString(request, group, value, attr, NULL, token);
else
{
/*
@@ -1680,11 +1741,19 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
num_values ++;
}
- ippAddStrings(request, group, value, attr, num_values,
- NULL, (const char **)values);
+ attrptr = ippAddStrings(request, group, value, attr, num_values,
+ NULL, (const char **)values);
}
break;
}
+
+ if (!attrptr)
+ {
+ print_fatal_error("Unable to add attribute on line %d: %s", linenum,
+ cupsLastErrorString());
+ pass = 0;
+ goto test_exit;
+ }
}
else if (!_cups_strcasecmp(token, "FILE"))
{
@@ -1737,6 +1806,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
last_status->if_defined = NULL;
last_status->if_not_defined = NULL;
+ last_status->repeat_limit = 1000;
last_status->repeat_match = 0;
last_status->repeat_no_match = 0;
}
@@ -1764,6 +1834,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
num_expects ++;
memset(last_expect, 0, sizeof(_cups_expect_t));
+ last_expect->repeat_limit = 1000;
if (token[0] == '!')
{
@@ -1909,6 +1980,33 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
goto test_exit;
}
}
+ else if (!_cups_strcasecmp(token, "REPEAT-LIMIT"))
+ {
+ if (!get_token(fp, token, sizeof(token), &linenum))
+ {
+ print_fatal_error("Missing REPEAT-LIMIT value on line %d.", linenum);
+ pass = 0;
+ goto test_exit;
+ }
+ else if (atoi(token) <= 0)
+ {
+ print_fatal_error("Bad REPEAT-LIMIT value on line %d.", linenum);
+ pass = 0;
+ goto test_exit;
+ }
+
+ if (last_status)
+ last_status->repeat_limit = atoi(token);
+ else if (last_expect)
+ last_expect->repeat_limit = atoi(token);
+ else
+ {
+ print_fatal_error("REPEAT-LIMIT without a preceding EXPECT or STATUS "
+ "on line %d.", linenum);
+ pass = 0;
+ goto test_exit;
+ }
+ }
else if (!_cups_strcasecmp(token, "REPEAT-MATCH"))
{
if (last_status)
@@ -1998,11 +2096,15 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
goto test_exit;
}
}
- else if (!_cups_strcasecmp(token, "WITH-VALUE"))
+ else if (!_cups_strcasecmp(token, "WITH-ALL-VALUES") ||
+ !_cups_strcasecmp(token, "WITH-VALUE"))
{
+ if (!_cups_strcasecmp(token, "WITH-ALL-VALUES") && last_expect)
+ last_expect->with_flags = _CUPS_WITH_ALL;
+
if (!get_token(fp, temp, sizeof(temp), &linenum))
{
- print_fatal_error("Missing WITH-VALUE value on line %d.", linenum);
+ print_fatal_error("Missing %s value on line %d.", token, linenum);
pass = 0;
goto test_exit;
}
@@ -2024,7 +2126,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
*/
last_expect->with_value = calloc(1, tokenptr - token);
- last_expect->with_regex = 1;
+ last_expect->with_flags |= _CUPS_WITH_REGEX;
if (last_expect->with_value)
memcpy(last_expect->with_value, token + 1, tokenptr - token - 1);
@@ -2036,11 +2138,12 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
*/
last_expect->with_value = strdup(token);
+ last_expect->with_flags |= _CUPS_WITH_LITERAL;
}
}
else
{
- print_fatal_error("WITH-VALUE without a preceding EXPECT on line %d.",
+ print_fatal_error("%s without a preceding EXPECT on line %d.", token,
linenum);
pass = 0;
goto test_exit;
@@ -2146,8 +2249,14 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
goto skip_error;
}
+ repeat_count = 0;
+ repeat_interval = 1;
+ repeat_prev = 1;
+
do
{
+ repeat_count ++;
+
status = HTTP_OK;
if (transfer == _CUPS_TRANSFER_CHUNKED ||
@@ -2228,7 +2337,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
status = httpGetStatus(http);
}
- if (!Cancel && status == HTTP_ERROR &&
+ if (!Cancel && status == HTTP_ERROR && http->error != EINVAL &&
#ifdef WIN32
http->error != WSAETIMEDOUT)
#else
@@ -2240,35 +2349,65 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
}
else if (status == HTTP_ERROR)
{
- if (!Cancel)
- httpReconnect(http);
-
prev_pass = 0;
+ break;
+ }
+ else if (status != HTTP_OK)
+ {
+ httpFlush(http);
+ break;
}
}
}
+ if (!Cancel && status == HTTP_ERROR && http->error != EINVAL &&
+#ifdef WIN32
+ http->error != WSAETIMEDOUT)
+#else
+ http->error != ETIMEDOUT)
+#endif /* WIN32 */
+ {
+ if (httpReconnect(http))
+ prev_pass = 0;
+ }
+ else if (status == HTTP_ERROR)
+ {
+ if (!Cancel)
+ httpReconnect(http);
+
+ prev_pass = 0;
+ }
+ else if (status != HTTP_OK)
+ {
+ httpFlush(http);
+ prev_pass = 0;
+ }
+
/*
* Check results of request...
*/
- if (!response)
- prev_pass = pass = 0;
- else
- {
- if (http->version != HTTP_1_1)
- prev_pass = pass = 0;
+ cupsArrayClear(errors);
- if (response->state != IPP_DATA)
- prev_pass = pass = 0;
+ if (http->version != HTTP_1_1)
+ add_stringf(errors, "Bad HTTP version (%d.%d)", http->version / 100,
+ http->version % 100);
- if (response->request.status.request_id != request_id)
- prev_pass = pass = 0;
+ if (!response)
+ {
+ /*
+ * No response, log error...
+ */
- if (version &&
- (response->request.status.version[0] != (version / 10) ||
- response->request.status.version[1] != (version % 10)))
- prev_pass = pass = 0;
+ add_stringf(errors, "IPP request failed with status %s (%s)",
+ ippErrorString(cupsLastError()),
+ cupsLastErrorString());
+ }
+ else
+ {
+ /*
+ * Collect common attribute values...
+ */
if ((attrptr = ippFindAttribute(response, "job-id",
IPP_TAG_INTEGER)) != NULL)
@@ -2288,42 +2427,130 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
set_variable(vars, "notify-subscription-id", temp);
}
- attrptr = response->attrs;
- if (!attrptr || !attrptr->name ||
- attrptr->value_tag != IPP_TAG_CHARSET ||
- attrptr->group_tag != IPP_TAG_OPERATION ||
- attrptr->num_values != 1 ||
- strcmp(attrptr->name, "attributes-charset"))
- prev_pass = pass = 0;
+ /*
+ * Check response, validating groups and attributes and logging errors
+ * as needed...
+ */
- if (attrptr)
+ if (response->state != IPP_DATA)
+ add_stringf(errors,
+ "Missing end-of-attributes-tag in response "
+ "(RFC 2910 section 3.5.1)");
+
+ if (version &&
+ (response->request.status.version[0] != (version / 10) ||
+ response->request.status.version[1] != (version % 10)))
+ add_stringf(errors,
+ "Bad version %d.%d in response - expected %d.%d "
+ "(RFC 2911 section 3.1.8).",
+ response->request.status.version[0],
+ response->request.status.version[1],
+ version / 10, version % 10);
+
+ if (response->request.status.request_id != request_id)
+ add_stringf(errors,
+ "Bad request ID %d in response - expected %d "
+ "(RFC 2911 section 3.1.1)",
+ response->request.status.request_id, request_id);
+
+ attrptr = response->attrs;
+ if (!attrptr)
+ add_stringf(errors,
+ "Missing first attribute \"attributes-charset "
+ "(charset)\" in group operation-attributes-tag "
+ "(RFC 2911 section 3.1.4).");
+ else
{
- attrptr = attrptr->next;
- if (!attrptr || !attrptr->name ||
- attrptr->value_tag != IPP_TAG_LANGUAGE ||
+ if (!attrptr->name ||
+ attrptr->value_tag != IPP_TAG_CHARSET ||
attrptr->group_tag != IPP_TAG_OPERATION ||
attrptr->num_values != 1 ||
- strcmp(attrptr->name, "attributes-natural-language"))
- prev_pass = pass = 0;
- }
+ strcmp(attrptr->name, "attributes-charset"))
+ add_stringf(errors,
+ "Bad first attribute \"%s (%s%s)\" in group %s, "
+ "expected \"attributes-charset (charset)\" in "
+ "group operation-attributes-tag (RFC 2911 section "
+ "3.1.4).",
+ attrptr->name ? attrptr->name : "(null)",
+ attrptr->num_values > 1 ? "1setOf " : "",
+ ippTagString(attrptr->value_tag),
+ ippTagString(attrptr->group_tag));
+
+ attrptr = attrptr->next;
+ if (!attrptr)
+ add_stringf(errors,
+ "Missing second attribute \"attributes-natural-"
+ "language (naturalLanguage)\" in group "
+ "operation-attributes-tag (RFC 2911 section "
+ "3.1.4).");
+ else if (!attrptr->name ||
+ attrptr->value_tag != IPP_TAG_LANGUAGE ||
+ attrptr->group_tag != IPP_TAG_OPERATION ||
+ attrptr->num_values != 1 ||
+ strcmp(attrptr->name, "attributes-natural-language"))
+ add_stringf(errors,
+ "Bad first attribute \"%s (%s%s)\" in group %s, "
+ "expected \"attributes-natural-language "
+ "(naturalLanguage)\" in group "
+ "operation-attributes-tag (RFC 2911 section "
+ "3.1.4).",
+ attrptr->name ? attrptr->name : "(null)",
+ attrptr->num_values > 1 ? "1setOf " : "",
+ ippTagString(attrptr->value_tag),
+ ippTagString(attrptr->group_tag));
+ }
if ((attrptr = ippFindAttribute(response, "status-message",
- IPP_TAG_ZERO)) != NULL &&
- (attrptr->value_tag != IPP_TAG_TEXT ||
- attrptr->group_tag != IPP_TAG_OPERATION ||
- attrptr->num_values != 1 ||
- (attrptr->value_tag == IPP_TAG_TEXT &&
- strlen(attrptr->values[0].string.text) > 255)))
- prev_pass = pass = 0;
+ IPP_TAG_ZERO)) != NULL)
+ {
+ if (attrptr->value_tag != IPP_TAG_TEXT)
+ add_stringf(errors,
+ "status-message (text(255)) has wrong value tag "
+ "%s (RFC 2911 section 3.1.6.2).",
+ ippTagString(attrptr->value_tag));
+ if (attrptr->group_tag != IPP_TAG_OPERATION)
+ add_stringf(errors,
+ "status-message (text(255)) has wrong group tag "
+ "%s (RFC 2911 section 3.1.6.2).",
+ ippTagString(attrptr->group_tag));
+ if (attrptr->num_values != 1)
+ add_stringf(errors,
+ "status-message (text(255)) has %d values "
+ "(RFC 2911 section 3.1.6.2).",
+ attrptr->num_values);
+ if (attrptr->value_tag == IPP_TAG_TEXT &&
+ strlen(attrptr->values[0].string.text) > 255)
+ add_stringf(errors,
+ "status-message (text(255)) has bad length %d"
+ " (RFC 2911 section 3.1.6.2).",
+ (int)strlen(attrptr->values[0].string.text));
+ }
if ((attrptr = ippFindAttribute(response, "detailed-status-message",
- IPP_TAG_ZERO)) != NULL &&
- (attrptr->value_tag != IPP_TAG_TEXT ||
- attrptr->group_tag != IPP_TAG_OPERATION ||
- attrptr->num_values != 1 ||
- (attrptr->value_tag == IPP_TAG_TEXT &&
- strlen(attrptr->values[0].string.text) > 1023)))
- prev_pass = pass = 0;
+ IPP_TAG_ZERO)) != NULL)
+ {
+ if (attrptr->value_tag != IPP_TAG_TEXT)
+ add_stringf(errors,
+ "detailed-status-message (text(MAX)) has wrong "
+ "value tag %s (RFC 2911 section 3.1.6.3).",
+ ippTagString(attrptr->value_tag));
+ if (attrptr->group_tag != IPP_TAG_OPERATION)
+ add_stringf(errors,
+ "detailed-status-message (text(MAX)) has wrong "
+ "group tag %s (RFC 2911 section 3.1.6.3).",
+ ippTagString(attrptr->group_tag));
+ if (attrptr->num_values != 1)
+ add_stringf(errors,
+ "detailed-status-message (text(MAX)) has %d values"
+ " (RFC 2911 section 3.1.6.3).",
+ attrptr->num_values);
+ if (attrptr->value_tag == IPP_TAG_TEXT &&
+ strlen(attrptr->values[0].string.text) > 1023)
+ add_stringf(errors,
+ "detailed-status-message (text(MAX)) has bad "
+ "length %d (RFC 2911 section 3.1.6.3).",
+ (int)strlen(attrptr->values[0].string.text));
+ }
a = cupsArrayNew((cups_array_func_t)strcmp, NULL);
@@ -2333,61 +2560,59 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
{
if (attrptr->group_tag != group)
{
+ int out_of_order = 0; /* Are attribute groups out-of-order? */
cupsArrayClear(a);
+
switch (attrptr->group_tag)
{
case IPP_TAG_ZERO :
break;
case IPP_TAG_OPERATION :
- prev_pass = pass = 0;
+ out_of_order = 1;
break;
case IPP_TAG_UNSUPPORTED_GROUP :
if (group != IPP_TAG_OPERATION)
- prev_pass = pass = 0;
+ out_of_order = 1;
break;
case IPP_TAG_JOB :
case IPP_TAG_PRINTER :
if (group != IPP_TAG_OPERATION &&
group != IPP_TAG_UNSUPPORTED_GROUP)
- prev_pass = pass = 0;
+ out_of_order = 1;
break;
case IPP_TAG_SUBSCRIPTION :
if (group > attrptr->group_tag &&
group != IPP_TAG_DOCUMENT)
- prev_pass = pass = 0;
+ out_of_order = 1;
break;
default :
if (group > attrptr->group_tag)
- prev_pass = pass = 0;
+ out_of_order = 1;
break;
}
- if (!pass)
- break;
+ if (out_of_order)
+ add_stringf(errors, "Attribute groups out of order (%s < %s)",
+ ippTagString(attrptr->group_tag),
+ ippTagString(group));
if (attrptr->group_tag != IPP_TAG_ZERO)
group = attrptr->group_tag;
}
- if (!validate_attr(attrptr, 0))
- {
- prev_pass = pass = 0;
- break;
- }
+ validate_attr(errors, attrptr);
if (attrptr->name)
{
if (cupsArrayFind(a, attrptr->name))
- {
- prev_pass = pass = 0;
- break;
- }
+ add_stringf(errors, "Duplicate \"%s\" attribute in %s group",
+ attrptr->name, ippTagString(group));
cupsArrayAdd(a, attrptr->name);
}
@@ -2395,6 +2620,11 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
cupsArrayDelete(a);
+ /*
+ * Now check the test-defined expected status-code and attribute
+ * values...
+ */
+
for (i = 0; i < num_statuses; i ++)
{
if (statuses[i].if_defined &&
@@ -2407,17 +2637,39 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
if (response->request.status.status_code == statuses[i].status)
{
- if (statuses[i].repeat_match)
+ if (statuses[i].repeat_match &&
+ repeat_count < statuses[i].repeat_limit)
repeat_test = 1;
break;
}
- else if (statuses[i].repeat_no_match)
+ else if (statuses[i].repeat_no_match &&
+ repeat_count < statuses[i].repeat_limit)
repeat_test = 1;
}
if (i == num_statuses && num_statuses > 0)
- prev_pass = pass = 0;
+ {
+ for (i = 0; i < num_statuses; i ++)
+ {
+ if (statuses[i].if_defined &&
+ !get_variable(vars, statuses[i].if_defined))
+ continue;
+
+ if (statuses[i].if_not_defined &&
+ get_variable(vars, statuses[i].if_not_defined))
+ continue;
+
+ add_stringf(errors, "EXPECTED: STATUS %s (got %s)",
+ ippErrorString(statuses[i].status),
+ ippErrorString(cupsLastError()));
+ }
+
+ if ((attrptr = ippFindAttribute(response, "status-message",
+ IPP_TAG_TEXT)) != NULL)
+ add_stringf(errors, "status-message=\"%s\"",
+ attrptr->values[0].string.text);
+ }
for (i = num_expects, expect = expects; i > 0; i --, expect ++)
{
@@ -2439,27 +2691,62 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
if (expect->define_no_match)
set_variable(vars, expect->define_no_match, "1");
else if (!expect->define_match && !expect->define_value)
- prev_pass = pass = 0;
+ {
+ if (found && expect->not_expect)
+ add_stringf(errors, "NOT EXPECTED: %s", expect->name);
+ else if (!found && !(expect->not_expect || expect->optional))
+ add_stringf(errors, "EXPECTED: %s", expect->name);
+ else if (found)
+ {
+ if (!expect_matches(expect, found->value_tag))
+ add_stringf(errors, "EXPECTED: %s OF-TYPE %s (got %s)",
+ expect->name, expect->of_type,
+ ippTagString(found->value_tag));
+
+ if (expect->in_group && found->group_tag != expect->in_group)
+ add_stringf(errors, "EXPECTED: %s IN-GROUP %s (got %s).",
+ expect->name, ippTagString(expect->in_group),
+ ippTagString(found->group_tag));
+ }
+ }
- if (expect->repeat_no_match)
+ if (expect->repeat_no_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
continue;
}
if (found)
- _ippAttrString(found, buffer, sizeof(buffer));
+ ippAttributeString(found, buffer, sizeof(buffer));
if (found &&
- !with_value(expect->with_value, expect->with_regex, found, 0,
+ !with_value(NULL, expect->with_value, expect->with_flags, found,
buffer, sizeof(buffer)))
{
if (expect->define_no_match)
set_variable(vars, expect->define_no_match, "1");
else if (!expect->define_match && !expect->define_value)
- prev_pass = pass = 0;
+ {
+ if (expect->with_flags & _CUPS_WITH_REGEX)
+ add_stringf(errors, "EXPECTED: %s %s /%s/",
+ expect->name,
+ (expect->with_flags & _CUPS_WITH_ALL) ?
+ "WITH-ALL-VALUES" : "WITH-VALUE",
+ expect->with_value);
+ else
+ add_stringf(errors, "EXPECTED: %s %s \"%s\"",
+ expect->name,
+ (expect->with_flags & _CUPS_WITH_ALL) ?
+ "WITH-ALL-VALUES" : "WITH-VALUE",
+ expect->with_value);
+
+ with_value(errors, expect->with_value, expect->with_flags, found,
+ buffer, sizeof(buffer));
+ }
- if (expect->repeat_no_match)
+ if (expect->repeat_no_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
continue;
@@ -2471,9 +2758,13 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
if (expect->define_no_match)
set_variable(vars, expect->define_no_match, "1");
else if (!expect->define_match && !expect->define_value)
- prev_pass = pass = 0;
+ {
+ add_stringf(errors, "EXPECTED: %s COUNT %d (got %d)", expect->name,
+ expect->count, found->num_values);
+ }
- if (expect->repeat_no_match)
+ if (expect->repeat_no_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
continue;
@@ -2489,9 +2780,21 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
if (expect->define_no_match)
set_variable(vars, expect->define_no_match, "1");
else if (!expect->define_match && !expect->define_value)
- prev_pass = pass = 0;
+ {
+ if (!attrptr)
+ add_stringf(errors,
+ "EXPECTED: %s (%d values) SAME-COUNT-AS %s "
+ "(not returned)", expect->name,
+ found->num_values, expect->same_count_as);
+ else if (attrptr->num_values != found->num_values)
+ add_stringf(errors,
+ "EXPECTED: %s (%d values) SAME-COUNT-AS %s "
+ "(%d values)", expect->name, found->num_values,
+ expect->same_count_as, attrptr->num_values);
+ }
- if (expect->repeat_no_match)
+ if (expect->repeat_no_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
continue;
@@ -2504,7 +2807,8 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
if (found && expect->define_value)
set_variable(vars, expect->define_value, buffer);
- if (found && expect->repeat_match)
+ if (found && expect->repeat_match &&
+ repeat_count < expect->repeat_limit)
repeat_test = 1;
}
}
@@ -2515,7 +2819,22 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
*/
if (repeat_test)
- sleep(1);
+ {
+ if (Output == _CUPS_OUTPUT_TEST)
+ {
+ printf("%04d]\n", repeat_count);
+ fflush(stdout);
+ }
+
+ sleep(repeat_interval);
+ repeat_interval = _cupsNextDelay(repeat_interval, &repeat_prev);
+
+ if (Output == _CUPS_OUTPUT_TEST)
+ {
+ printf(" %-68.68s [", name);
+ fflush(stdout);
+ }
+ }
}
while (repeat_test);
@@ -2523,6 +2842,9 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
request = NULL;
+ if (cupsArrayCount(errors) > 0)
+ prev_pass = pass = 0;
+
if (prev_pass)
PassCount ++;
else
@@ -2582,7 +2904,7 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
attrptr = ippFindNextAttribute(response, displayed[i],
IPP_TAG_ZERO))
{
- width = _ippAttrString(attrptr, NULL, 0);
+ width = ippAttributeString(attrptr, NULL, 0);
if (width > widths[i])
widths[i] = width;
}
@@ -2618,303 +2940,24 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
{
puts("<key>Errors</key>");
puts("<array>");
- }
- if (http->version != HTTP_1_1)
- print_test_error("Bad HTTP version (%d.%d)", http->version / 100,
- http->version % 100);
+ for (error = (char *)cupsArrayFirst(errors);
+ error;
+ error = (char *)cupsArrayNext(errors))
+ print_xml_string("string", error);
- if (!response)
- print_test_error("IPP request failed with status %s (%s)",
- ippErrorString(cupsLastError()),
- cupsLastErrorString());
+ puts("</array>");
+ }
else
{
- if (response->state != IPP_DATA)
- print_test_error("Missing end-of-attributes-tag in response "
- "(RFC 2910 section 3.5.1)");
-
- if (version &&
- (response->request.status.version[0] != (version / 10) ||
- response->request.status.version[1] != (version % 10)))
- print_test_error("Bad version %d.%d in response - expected %d.%d "
- "(RFC 2911 section 3.1.8).",
- response->request.status.version[0],
- response->request.status.version[1],
- version / 10, version % 10);
-
- if (response->request.status.request_id != request_id)
- print_test_error("Bad request ID %d in response - expected %d "
- "(RFC 2911 section 3.1.1)",
- response->request.status.request_id, request_id);
-
- attrptr = response->attrs;
- if (!attrptr)
- print_test_error("Missing first attribute \"attributes-charset "
- "(charset)\" in group operation-attributes-tag "
- "(RFC 2911 section 3.1.4).");
- else
- {
- if (!attrptr->name ||
- attrptr->value_tag != IPP_TAG_CHARSET ||
- attrptr->group_tag != IPP_TAG_OPERATION ||
- attrptr->num_values != 1 ||
- strcmp(attrptr->name, "attributes-charset"))
- print_test_error("Bad first attribute \"%s (%s%s)\" in group %s, "
- "expected \"attributes-charset (charset)\" in "
- "group operation-attributes-tag (RFC 2911 section "
- "3.1.4).",
- attrptr->name ? attrptr->name : "(null)",
- attrptr->num_values > 1 ? "1setOf " : "",
- ippTagString(attrptr->value_tag),
- ippTagString(attrptr->group_tag));
-
- attrptr = attrptr->next;
- if (!attrptr)
- print_test_error("Missing second attribute \"attributes-natural-"
- "language (naturalLanguage)\" in group "
- "operation-attributes-tag (RFC 2911 section "
- "3.1.4).");
- else if (!attrptr->name ||
- attrptr->value_tag != IPP_TAG_LANGUAGE ||
- attrptr->group_tag != IPP_TAG_OPERATION ||
- attrptr->num_values != 1 ||
- strcmp(attrptr->name, "attributes-natural-language"))
- print_test_error("Bad first attribute \"%s (%s%s)\" in group %s, "
- "expected \"attributes-natural-language "
- "(naturalLanguage)\" in group "
- "operation-attributes-tag (RFC 2911 section "
- "3.1.4).",
- attrptr->name ? attrptr->name : "(null)",
- attrptr->num_values > 1 ? "1setOf " : "",
- ippTagString(attrptr->value_tag),
- ippTagString(attrptr->group_tag));
- }
-
- if ((attrptr = ippFindAttribute(response, "status-message",
- IPP_TAG_ZERO)) != NULL)
- {
- if (attrptr->value_tag != IPP_TAG_TEXT)
- print_test_error("status-message (text(255)) has wrong value tag "
- "%s (RFC 2911 section 3.1.6.2).",
- ippTagString(attrptr->value_tag));
- if (attrptr->group_tag != IPP_TAG_OPERATION)
- print_test_error("status-message (text(255)) has wrong group tag "
- "%s (RFC 2911 section 3.1.6.2).",
- ippTagString(attrptr->group_tag));
- if (attrptr->num_values != 1)
- print_test_error("status-message (text(255)) has %d values "
- "(RFC 2911 section 3.1.6.2).",
- attrptr->num_values);
- if (attrptr->value_tag == IPP_TAG_TEXT &&
- strlen(attrptr->values[0].string.text) > 255)
- print_test_error("status-message (text(255)) has bad length %d"
- " (RFC 2911 section 3.1.6.2).",
- (int)strlen(attrptr->values[0].string.text));
- }
-
- if ((attrptr = ippFindAttribute(response, "detailed-status-message",
- IPP_TAG_ZERO)) != NULL)
- {
- if (attrptr->value_tag != IPP_TAG_TEXT)
- print_test_error("detailed-status-message (text(MAX)) has wrong "
- "value tag %s (RFC 2911 section 3.1.6.3).",
- ippTagString(attrptr->value_tag));
- if (attrptr->group_tag != IPP_TAG_OPERATION)
- print_test_error("detailed-status-message (text(MAX)) has wrong "
- "group tag %s (RFC 2911 section 3.1.6.3).",
- ippTagString(attrptr->group_tag));
- if (attrptr->num_values != 1)
- print_test_error("detailed-status-message (text(MAX)) has %d values"
- " (RFC 2911 section 3.1.6.3).",
- attrptr->num_values);
- if (attrptr->value_tag == IPP_TAG_TEXT &&
- strlen(attrptr->values[0].string.text) > 1023)
- print_test_error("detailed-status-message (text(MAX)) has bad "
- "length %d (RFC 2911 section 3.1.6.3).",
- (int)strlen(attrptr->values[0].string.text));
- }
-
- a = cupsArrayNew((cups_array_func_t)strcmp, NULL);
-
- for (attrptr = response->attrs, group = attrptr->group_tag;
- attrptr;
- attrptr = attrptr->next)
- {
- if (attrptr->group_tag != group)
- {
- cupsArrayClear(a);
-
- switch (attrptr->group_tag)
- {
- case IPP_TAG_ZERO :
- break;
-
- case IPP_TAG_OPERATION :
- prev_pass = pass = 0;
- break;
-
- case IPP_TAG_UNSUPPORTED_GROUP :
- if (group != IPP_TAG_OPERATION)
- print_test_error("Attribute groups out of order (%s < %s)",
- ippTagString(attrptr->group_tag),
- ippTagString(group));
- break;
-
- case IPP_TAG_JOB :
- case IPP_TAG_PRINTER :
- if (group != IPP_TAG_OPERATION &&
- group != IPP_TAG_UNSUPPORTED_GROUP)
- print_test_error("Attribute groups out of order (%s < %s)",
- ippTagString(attrptr->group_tag),
- ippTagString(group));
- break;
-
- case IPP_TAG_SUBSCRIPTION :
- if (group > attrptr->group_tag &&
- group != IPP_TAG_DOCUMENT)
- print_test_error("Attribute groups out of order (%s < %s)",
- ippTagString(attrptr->group_tag),
- ippTagString(group));
- break;
-
- default :
- if (group > attrptr->group_tag)
- print_test_error("Attribute groups out of order (%s < %s)",
- ippTagString(attrptr->group_tag),
- ippTagString(group));
- break;
- }
-
- if (attrptr->group_tag != IPP_TAG_ZERO)
- group = attrptr->group_tag;
- }
-
- validate_attr(attrptr, 1);
-
- if (attrptr->name)
- {
- if (cupsArrayFind(a, attrptr->name))
- print_test_error("Duplicate \"%s\" attribute in %s group",
- attrptr->name, ippTagString(group));
-
- cupsArrayAdd(a, attrptr->name);
- }
- }
-
- cupsArrayDelete(a);
-
- for (i = 0; i < num_statuses; i ++)
- {
- if (statuses[i].if_defined &&
- !get_variable(vars, statuses[i].if_defined))
- continue;
-
- if (statuses[i].if_not_defined &&
- get_variable(vars, statuses[i].if_not_defined))
- continue;
-
- if (response->request.status.status_code == statuses[i].status)
- break;
- }
-
- if (i == num_statuses && num_statuses > 0)
- {
- for (i = 0; i < num_statuses; i ++)
- {
- if (statuses[i].if_defined &&
- !get_variable(vars, statuses[i].if_defined))
- continue;
-
- if (statuses[i].if_not_defined &&
- get_variable(vars, statuses[i].if_not_defined))
- continue;
-
- print_test_error("EXPECTED: STATUS %s (got %s)",
- ippErrorString(statuses[i].status),
- ippErrorString(cupsLastError()));
- }
-
- if ((attrptr = ippFindAttribute(response, "status-message",
- IPP_TAG_TEXT)) != NULL)
- print_test_error("status-message=\"%s\"",
- attrptr->values[0].string.text);
- }
-
- for (i = num_expects, expect = expects; i > 0; i --, expect ++)
- {
- if (expect->define_match || expect->define_no_match ||
- expect->define_value)
- continue;
-
- if (expect->if_defined && !get_variable(vars, expect->if_defined))
- continue;
-
- if (expect->if_not_defined &&
- get_variable(vars, expect->if_not_defined))
- continue;
-
- found = ippFindAttribute(response, expect->name, IPP_TAG_ZERO);
-
- if (found && expect->not_expect)
- print_test_error("NOT EXPECTED: %s", expect->name);
- else if (!found && !(expect->not_expect || expect->optional))
- print_test_error("EXPECTED: %s", expect->name);
- else if (found)
- {
- if (!expect_matches(expect, found->value_tag))
- print_test_error("EXPECTED: %s OF-TYPE %s (got %s)",
- expect->name, expect->of_type,
- ippTagString(found->value_tag));
-
- if (expect->in_group && found->group_tag != expect->in_group)
- print_test_error("EXPECTED: %s IN-GROUP %s (got %s).",
- expect->name, ippTagString(expect->in_group),
- ippTagString(found->group_tag));
-
- if (!with_value(expect->with_value, expect->with_regex, found, 0,
- buffer, sizeof(buffer)))
- {
- if (expect->with_regex)
- print_test_error("EXPECTED: %s WITH-VALUE /%s/",
- expect->name, expect->with_value);
- else
- print_test_error("EXPECTED: %s WITH-VALUE \"%s\"",
- expect->name, expect->with_value);
-
- with_value(expect->with_value, expect->with_regex, found, 1,
- buffer, sizeof(buffer));
- }
-
- if (expect->count > 0 && found->num_values != expect->count)
- {
- print_test_error("EXPECTED: %s COUNT %d (got %d)", expect->name,
- expect->count, found->num_values);
- }
-
- if (expect->same_count_as)
- {
- attrptr = ippFindAttribute(response, expect->same_count_as,
- IPP_TAG_ZERO);
-
- if (!attrptr)
- print_test_error("EXPECTED: %s (%d values) SAME-COUNT-AS %s "
- "(not returned)", expect->name,
- found->num_values, expect->same_count_as);
- else if (attrptr->num_values != found->num_values)
- print_test_error("EXPECTED: %s (%d values) SAME-COUNT-AS %s "
- "(%d values)", expect->name, found->num_values,
- expect->same_count_as, attrptr->num_values);
- }
- }
- }
+ for (error = (char *)cupsArrayFirst(errors);
+ error;
+ error = (char *)cupsArrayNext(errors))
+ printf(" %s\n", error);
}
-
- if (Output == _CUPS_OUTPUT_PLIST)
- puts("</array>");
}
- if (num_displayed > 0 && !Verbosity &&
+ if (num_displayed > 0 && !Verbosity && response &&
(Output == _CUPS_OUTPUT_TEST || Output == _CUPS_OUTPUT_PLIST))
{
for (attrptr = response->attrs;
@@ -2986,6 +3029,8 @@ do_tests(_cups_vars_t *vars, /* I - Variables */
test_exit:
+ cupsArrayDelete(errors);
+
if (fp)
fclose(fp);
@@ -3235,7 +3280,7 @@ get_collection(_cups_vars_t *vars, /* I - Variables */
if ((tempcol = realloc(lastcol, sizeof(ipp_attribute_t) +
(lastcol->num_values + 1) *
- sizeof(ipp_value_t))) == NULL)
+ sizeof(_ipp_value_t))) == NULL)
{
print_fatal_error("Unable to allocate memory on line %d.", *linenum);
goto col_error;
@@ -3317,7 +3362,9 @@ get_collection(_cups_vars_t *vars, /* I - Variables */
char units[6]; /* Units */
if (sscanf(token, "%dx%d%5s", &xres, &yres, units) != 3 ||
- (_cups_strcasecmp(units, "dpi") && _cups_strcasecmp(units, "dpc") &&
+ (_cups_strcasecmp(units, "dpi") &&
+ _cups_strcasecmp(units, "dpc") &&
+ _cups_strcasecmp(units, "dpcm") &&
_cups_strcasecmp(units, "other")))
{
print_fatal_error("Bad resolution value \"%s\" on line %d.",
@@ -3328,7 +3375,8 @@ get_collection(_cups_vars_t *vars, /* I - Variables */
if (!_cups_strcasecmp(units, "dpi"))
ippAddResolution(col, IPP_TAG_ZERO, attr, xres, yres,
IPP_RES_PER_INCH);
- else if (!_cups_strcasecmp(units, "dpc"))
+ else if (!_cups_strcasecmp(units, "dpc") ||
+ !_cups_strcasecmp(units, "dpcm"))
ippAddResolution(col, IPP_TAG_ZERO, attr, xres, yres,
IPP_RES_PER_CM);
else
@@ -3455,7 +3503,11 @@ get_filename(const char *testfile, /* I - Current test file */
if (*dstptr == '>')
*dstptr = '\0';
}
- else if (*src == '/' || !strchr(testfile, '/'))
+ else if (*src == '/' || !strchr(testfile, '/')
+#ifdef WIN32
+ || (isalpha(*src & 255) && src[1] == ':')
+#endif /* WIN32 */
+ )
{
/*
* Use the path as-is...
@@ -3719,12 +3771,12 @@ print_attr(ipp_attribute_t *attr, /* I - Attribute to print */
attr->values[i].resolution.xres,
attr->values[i].resolution.yres,
attr->values[i].resolution.units == IPP_RES_PER_INCH ?
- "dpi" : "dpc");
+ "dpi" : "dpcm");
else
printf("%dx%d%s ", attr->values[i].resolution.xres,
attr->values[i].resolution.yres,
attr->values[i].resolution.units == IPP_RES_PER_INCH ?
- "dpi" : "dpc");
+ "dpi" : "dpcm");
break;
case IPP_TAG_DATE :
@@ -3756,14 +3808,14 @@ print_attr(ipp_attribute_t *attr, /* I - Attribute to print */
if (Output == _CUPS_OUTPUT_PLIST)
{
fputs("<dict><key>language</key><string>", stdout);
- print_xml_string(NULL, attr->values[i].string.charset);
+ print_xml_string(NULL, attr->values[i].string.language);
fputs("</string><key>string</key><string>", stdout);
print_xml_string(NULL, attr->values[i].string.text);
puts("</string></dict>");
}
else
- printf("\"%s\"(%s) ", attr->values[i].string.text,
- attr->values[i].string.charset);
+ printf("\"%s\"[%s] ", attr->values[i].string.text,
+ attr->values[i].string.language);
break;
case IPP_TAG_BEGIN_COLLECTION :
@@ -3817,7 +3869,7 @@ print_attr(ipp_attribute_t *attr, /* I - Attribute to print */
ippTagString(attr->value_tag));
}
- _ippAttrString(attr, buffer, sizeof(buffer));
+ ippAttributeString(attr, buffer, sizeof(buffer));
puts(buffer);
}
}
@@ -3871,7 +3923,7 @@ print_col(ipp_t *col) /* I - Collection attribute to print */
printf("%dx%d%s ", attr->values[i].resolution.xres,
attr->values[i].resolution.yres,
attr->values[i].resolution.units == IPP_RES_PER_INCH ?
- "dpi" : "dpc");
+ "dpi" : "dpcm");
break;
case IPP_TAG_STRING :
@@ -3889,8 +3941,8 @@ print_col(ipp_t *col) /* I - Collection attribute to print */
case IPP_TAG_TEXTLANG :
case IPP_TAG_NAMELANG :
for (i = 0; i < attr->num_values; i ++)
- printf("\"%s\",%s ", attr->values[i].string.text,
- attr->values[i].string.charset);
+ printf("\"%s\"[%s] ", attr->values[i].string.text,
+ attr->values[i].string.language);
break;
case IPP_TAG_BEGIN_COLLECTION :
@@ -3960,7 +4012,7 @@ print_csv(
break;
else if (!strcmp(current->name, displayed[i]))
{
- _ippAttrString(current, buffer, maxlength);
+ ippAttributeString(current, buffer, maxlength);
break;
}
}
@@ -4081,7 +4133,7 @@ print_line(
break;
else if (!strcmp(current->name, displayed[i]))
{
- _ippAttrString(current, buffer, maxlength);
+ ippAttributeString(current, buffer, maxlength);
break;
}
}
@@ -4118,37 +4170,6 @@ print_line(
/*
- * 'print_test_error()' - Print a test error message.
- */
-
-static void
-print_test_error(const char *s, /* I - Printf-style format string */
- ...) /* I - Additional arguments as needed */
-{
- char buffer[10240]; /* Format buffer */
- va_list ap; /* Pointer to arguments */
-
-
- /*
- * Format the error message...
- */
-
- va_start(ap, s);
- vsnprintf(buffer, sizeof(buffer), s, ap);
- va_end(ap);
-
- /*
- * Then output it...
- */
-
- if (Output == _CUPS_OUTPUT_PLIST)
- print_xml_string("string", buffer);
- else
- printf(" %s\n", buffer);
-}
-
-
-/*
* 'print_xml_header()' - Print a standard XML plist header.
*/
@@ -4384,14 +4405,14 @@ usage(void)
_cupsLangPuts(stderr, _(" -6 Connect using IPv6."));
_cupsLangPuts(stderr, _(" -C Send requests using "
"chunking (default)."));
- _cupsLangPuts(stderr, _(" -E Test with TLS "
- "encryption."));
+ _cupsLangPuts(stdout, _(" -E Test with HTTP Upgrade to "
+ "TLS."));
_cupsLangPuts(stderr, _(" -I Ignore errors."));
_cupsLangPuts(stderr, _(" -L Send requests using "
"content-length."));
_cupsLangPuts(stderr, _(" -S Test with SSL "
"encryption."));
- _cupsLangPuts(stderr, _(" -T Set the receive/send "
+ _cupsLangPuts(stderr, _(" -T seconds Set the receive/send "
"timeout in seconds."));
_cupsLangPuts(stderr, _(" -V version Set default IPP "
"version."));
@@ -4405,11 +4426,9 @@ usage(void)
"the given time interval."));
_cupsLangPuts(stderr, _(" -n count Repeat the last file the "
"given number of times."));
- _cupsLangPuts(stderr, _(" -q Be quiet - no output "
- "except errors."));
+ _cupsLangPuts(stderr, _(" -q Run silently."));
_cupsLangPuts(stderr, _(" -t Produce a test report."));
- _cupsLangPuts(stderr, _(" -v Show all attributes sent "
- "and received."));
+ _cupsLangPuts(stderr, _(" -v Be verbose."));
exit(1);
}
@@ -4420,8 +4439,8 @@ usage(void)
*/
static int /* O - 1 if valid, 0 otherwise */
-validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
- int print) /* I - 1 = report issues to stdout */
+validate_attr(cups_array_t *errors, /* I - Errors array */
+ ipp_attribute_t *attr) /* I - Attribute to validate */
{
int i; /* Looping var */
char scheme[64], /* Scheme from URI */
@@ -4456,18 +4475,18 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad attribute name - invalid character (RFC "
- "2911 section 4.1.3).", attr->name);
+ add_stringf(errors,
+ "\"%s\": Bad attribute name - invalid character "
+ "(RFC 2911 section 4.1.3).", attr->name);
}
if ((ptr - attr->name) > 255)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad attribute name - bad length (RFC 2911 "
- "section 4.1.3).", attr->name);
+ add_stringf(errors,
+ "\"%s\": Bad attribute name - bad length "
+ "(RFC 2911 section 4.1.3).", attr->name);
}
switch (attr->value_tag)
@@ -4483,11 +4502,10 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad boolen value %d (RFC 2911 section "
- "4.1.10).", attr->name, attr->values[i].boolean);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad boolen value %d "
+ "(RFC 2911 section 4.1.10).", attr->name,
+ attr->values[i].boolean);
}
}
break;
@@ -4499,12 +4517,10 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad enum value %d - out of range "
- "(RFC 2911 section 4.1.4).", attr->name,
- attr->values[i].integer);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad enum value %d - out of range "
+ "(RFC 2911 section 4.1.4).", attr->name,
+ attr->values[i].integer);
}
}
break;
@@ -4516,12 +4532,10 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad octetString value - bad length %d "
- "(RFC 2911 section 4.1.10).", attr->name,
- attr->values[i].unknown.length);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad octetString value - bad length %d "
+ "(RFC 2911 section 4.1.10).", attr->name,
+ attr->values[i].unknown.length);
}
}
break;
@@ -4535,99 +4549,81 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad dateTime month %u (RFC 2911 "
- "section 4.1.13).", attr->name, date[2]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad dateTime month %u "
+ "(RFC 2911 section 4.1.13).", attr->name, date[2]);
}
if (date[3] < 1 || date[3] > 31)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad dateTime day %u (RFC 2911 "
- "section 4.1.13).", attr->name, date[3]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad dateTime day %u "
+ "(RFC 2911 section 4.1.13).", attr->name, date[3]);
}
if (date[4] > 23)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad dateTime hours %u (RFC 2911 "
- "section 4.1.13).", attr->name, date[4]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad dateTime hours %u "
+ "(RFC 2911 section 4.1.13).", attr->name, date[4]);
}
if (date[5] > 59)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad dateTime minutes %u (RFC 2911 "
- "section 4.1.13).", attr->name, date[5]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad dateTime minutes %u "
+ "(RFC 2911 section 4.1.13).", attr->name, date[5]);
}
if (date[6] > 60)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad dateTime seconds %u (RFC 2911 "
- "section 4.1.13).", attr->name, date[6]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad dateTime seconds %u "
+ "(RFC 2911 section 4.1.13).", attr->name, date[6]);
}
if (date[7] > 9)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad dateTime deciseconds %u (RFC 2911 "
- "section 4.1.13).", attr->name, date[7]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad dateTime deciseconds %u "
+ "(RFC 2911 section 4.1.13).", attr->name, date[7]);
}
if (date[8] != '-' && date[8] != '+')
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad dateTime UTC sign '%c' (RFC 2911 "
- "section 4.1.13).", attr->name, date[8]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad dateTime UTC sign '%c' "
+ "(RFC 2911 section 4.1.13).", attr->name, date[8]);
}
if (date[9] > 11)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad dateTime UTC hours %u (RFC 2911 "
- "section 4.1.13).", attr->name, date[9]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad dateTime UTC hours %u "
+ "(RFC 2911 section 4.1.13).", attr->name, date[9]);
}
if (date[10] > 59)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad dateTime UTC minutes %u (RFC 2911 "
- "section 4.1.13).", attr->name, date[10]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad dateTime UTC minutes %u "
+ "(RFC 2911 section 4.1.13).", attr->name, date[10]);
}
}
break;
@@ -4639,36 +4635,32 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad resolution value %dx%d%s - cross "
- "feed resolution must be positive (RFC 2911 "
- "section 4.1.13).", attr->name,
- attr->values[i].resolution.xres,
- attr->values[i].resolution.yres,
- attr->values[i].resolution.units ==
- IPP_RES_PER_INCH ? "dpi" :
- attr->values[i].resolution.units ==
- IPP_RES_PER_CM ? "dpc" : "unknown");
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad resolution value %dx%d%s - cross "
+ "feed resolution must be positive "
+ "(RFC 2911 section 4.1.13).", attr->name,
+ attr->values[i].resolution.xres,
+ attr->values[i].resolution.yres,
+ attr->values[i].resolution.units ==
+ IPP_RES_PER_INCH ? "dpi" :
+ attr->values[i].resolution.units ==
+ IPP_RES_PER_CM ? "dpcm" : "unknown");
}
if (attr->values[i].resolution.yres <= 0)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad resolution value %dx%d%s - feed "
- "resolution must be positive (RFC 2911 section "
- "4.1.13).", attr->name,
- attr->values[i].resolution.xres,
- attr->values[i].resolution.yres,
- attr->values[i].resolution.units ==
- IPP_RES_PER_INCH ? "dpi" :
- attr->values[i].resolution.units ==
- IPP_RES_PER_CM ? "dpc" : "unknown");
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad resolution value %dx%d%s - feed "
+ "resolution must be positive "
+ "(RFC 2911 section 4.1.13).", attr->name,
+ attr->values[i].resolution.xres,
+ attr->values[i].resolution.yres,
+ attr->values[i].resolution.units ==
+ IPP_RES_PER_INCH ? "dpi" :
+ attr->values[i].resolution.units ==
+ IPP_RES_PER_CM ? "dpcm" : "unknown");
}
if (attr->values[i].resolution.units != IPP_RES_PER_INCH &&
@@ -4676,17 +4668,15 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad resolution value %dx%d%s - bad "
- "units value (RFC 2911 section 4.1.13).",
- attr->name, attr->values[i].resolution.xres,
- attr->values[i].resolution.yres,
- attr->values[i].resolution.units ==
- IPP_RES_PER_INCH ? "dpi" :
- attr->values[i].resolution.units ==
- IPP_RES_PER_CM ? "dpc" : "unknown");
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad resolution value %dx%d%s - bad "
+ "units value (RFC 2911 section 4.1.13).",
+ attr->name, attr->values[i].resolution.xres,
+ attr->values[i].resolution.yres,
+ attr->values[i].resolution.units ==
+ IPP_RES_PER_INCH ? "dpi" :
+ attr->values[i].resolution.units ==
+ IPP_RES_PER_CM ? "dpcm" : "unknown");
}
}
break;
@@ -4698,13 +4688,11 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad rangeOfInteger value %d-%d - lower "
- "greater than upper (RFC 2911 section 4.1.13).",
- attr->name, attr->values[i].range.lower,
- attr->values[i].range.upper);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad rangeOfInteger value %d-%d - lower "
+ "greater than upper (RFC 2911 section 4.1.13).",
+ attr->name, attr->values[i].range.lower,
+ attr->values[i].range.upper);
}
}
break;
@@ -4716,20 +4704,20 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
colattr;
colattr = colattr->next)
{
- if (!validate_attr(colattr, 0))
+ if (!validate_attr(NULL, colattr))
{
valid = 0;
break;
}
}
- if (colattr && print)
+ if (colattr && errors)
{
- print_test_error("\"%s\": Bad collection value.", attr->name);
+ add_stringf(errors, "\"%s\": Bad collection value.", attr->name);
while (colattr)
{
- validate_attr(colattr, print);
+ validate_attr(errors, colattr);
colattr = colattr->next;
}
}
@@ -4777,25 +4765,21 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad text value \"%s\" - bad UTF-8 "
- "sequence (RFC 2911 section 4.1.1).", attr->name,
- attr->values[i].string.text);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad text value \"%s\" - bad UTF-8 "
+ "sequence (RFC 2911 section 4.1.1).", attr->name,
+ attr->values[i].string.text);
}
if ((ptr - attr->values[i].string.text) > 1023)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad text value \"%s\" - bad length %d "
- "(RFC 2911 section 4.1.1).", attr->name,
- attr->values[i].string.text,
- (int)strlen(attr->values[i].string.text));
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad text value \"%s\" - bad length %d "
+ "(RFC 2911 section 4.1.1).", attr->name,
+ attr->values[i].string.text,
+ (int)strlen(attr->values[i].string.text));
}
}
break;
@@ -4841,25 +4825,21 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad name value \"%s\" - bad UTF-8 "
- "sequence (RFC 2911 section 4.1.2).", attr->name,
- attr->values[i].string.text);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad name value \"%s\" - bad UTF-8 "
+ "sequence (RFC 2911 section 4.1.2).", attr->name,
+ attr->values[i].string.text);
}
if ((ptr - attr->values[i].string.text) > 1023)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad name value \"%s\" - bad length %d "
- "(RFC 2911 section 4.1.2).", attr->name,
- attr->values[i].string.text,
- (int)strlen(attr->values[i].string.text));
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad name value \"%s\" - bad length %d "
+ "(RFC 2911 section 4.1.2).", attr->name,
+ attr->values[i].string.text,
+ (int)strlen(attr->values[i].string.text));
}
}
break;
@@ -4876,25 +4856,21 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad keyword value \"%s\" - invalid "
- "character (RFC 2911 section 4.1.3).",
- attr->name, attr->values[i].string.text);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad keyword value \"%s\" - invalid "
+ "character (RFC 2911 section 4.1.3).",
+ attr->name, attr->values[i].string.text);
}
if ((ptr - attr->values[i].string.text) > 255)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad keyword value \"%s\" - bad "
- "length %d (RFC 2911 section 4.1.3).",
- attr->name, attr->values[i].string.text,
- (int)strlen(attr->values[i].string.text));
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad keyword value \"%s\" - bad "
+ "length %d (RFC 2911 section 4.1.3).",
+ attr->name, attr->values[i].string.text,
+ (int)strlen(attr->values[i].string.text));
}
}
break;
@@ -4913,27 +4889,23 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad URI value \"%s\" - %s "
- "(RFC 2911 section 4.1.5).", attr->name,
- attr->values[i].string.text,
- URIStatusStrings[uri_status -
- HTTP_URI_OVERFLOW]);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad URI value \"%s\" - %s "
+ "(RFC 2911 section 4.1.5).", attr->name,
+ attr->values[i].string.text,
+ URIStatusStrings[uri_status -
+ HTTP_URI_OVERFLOW]);
}
if (strlen(attr->values[i].string.text) > 1023)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad URI value \"%s\" - bad length %d "
- "(RFC 2911 section 4.1.5).", attr->name,
- attr->values[i].string.text,
- (int)strlen(attr->values[i].string.text));
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad URI value \"%s\" - bad length %d "
+ "(RFC 2911 section 4.1.5).", attr->name,
+ attr->values[i].string.text,
+ (int)strlen(attr->values[i].string.text));
}
}
break;
@@ -4954,25 +4926,21 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad uriScheme value \"%s\" - bad "
- "characters (RFC 2911 section 4.1.6).",
- attr->name, attr->values[i].string.text);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad uriScheme value \"%s\" - bad "
+ "characters (RFC 2911 section 4.1.6).",
+ attr->name, attr->values[i].string.text);
}
if ((ptr - attr->values[i].string.text) > 63)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad uriScheme value \"%s\" - bad "
- "length %d (RFC 2911 section 4.1.6).",
- attr->name, attr->values[i].string.text,
- (int)strlen(attr->values[i].string.text));
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad uriScheme value \"%s\" - bad "
+ "length %d (RFC 2911 section 4.1.6).",
+ attr->name, attr->values[i].string.text,
+ (int)strlen(attr->values[i].string.text));
}
}
break;
@@ -4989,25 +4957,21 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad charset value \"%s\" - bad "
- "characters (RFC 2911 section 4.1.7).",
- attr->name, attr->values[i].string.text);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad charset value \"%s\" - bad "
+ "characters (RFC 2911 section 4.1.7).",
+ attr->name, attr->values[i].string.text);
}
if ((ptr - attr->values[i].string.text) > 40)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad charset value \"%s\" - bad "
- "length %d (RFC 2911 section 4.1.7).",
- attr->name, attr->values[i].string.text,
- (int)strlen(attr->values[i].string.text));
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad charset value \"%s\" - bad "
+ "length %d (RFC 2911 section 4.1.7).",
+ attr->name, attr->values[i].string.text,
+ (int)strlen(attr->values[i].string.text));
}
}
break;
@@ -5040,6 +5004,7 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
regerror(i, &re, temp, sizeof(temp));
print_fatal_error("Unable to compile naturalLanguage regular "
"expression: %s.", temp);
+ break;
}
for (i = 0; i < attr->num_values; i ++)
@@ -5048,25 +5013,21 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad naturalLanguage value \"%s\" - bad "
- "characters (RFC 2911 section 4.1.8).",
- attr->name, attr->values[i].string.text);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad naturalLanguage value \"%s\" - bad "
+ "characters (RFC 2911 section 4.1.8).",
+ attr->name, attr->values[i].string.text);
}
if (strlen(attr->values[i].string.text) > 63)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad naturalLanguage value \"%s\" - bad "
- "length %d (RFC 2911 section 4.1.8).",
- attr->name, attr->values[i].string.text,
- (int)strlen(attr->values[i].string.text));
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad naturalLanguage value \"%s\" - bad "
+ "length %d (RFC 2911 section 4.1.8).",
+ attr->name, attr->values[i].string.text,
+ (int)strlen(attr->values[i].string.text));
}
}
@@ -5096,6 +5057,7 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
regerror(i, &re, temp, sizeof(temp));
print_fatal_error("Unable to compile mimeMediaType regular "
"expression: %s.", temp);
+ break;
}
for (i = 0; i < attr->num_values; i ++)
@@ -5104,27 +5066,25 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad mimeMediaType value \"%s\" - bad "
- "characters (RFC 2911 section 4.1.9).",
- attr->name, attr->values[i].string.text);
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad mimeMediaType value \"%s\" - bad "
+ "characters (RFC 2911 section 4.1.9).",
+ attr->name, attr->values[i].string.text);
}
if (strlen(attr->values[i].string.text) > 255)
{
valid = 0;
- if (print)
- print_test_error("\"%s\": Bad mimeMediaType value \"%s\" - bad "
- "length %d (RFC 2911 section 4.1.9).",
- attr->name, attr->values[i].string.text,
- (int)strlen(attr->values[i].string.text));
- else
- break;
+ add_stringf(errors,
+ "\"%s\": Bad mimeMediaType value \"%s\" - bad "
+ "length %d (RFC 2911 section 4.1.9).",
+ attr->name, attr->values[i].string.text,
+ (int)strlen(attr->values[i].string.text));
}
}
+
+ regfree(&re);
break;
default :
@@ -5140,18 +5100,20 @@ validate_attr(ipp_attribute_t *attr, /* I - Attribute to validate */
*/
static int /* O - 1 on match, 0 on non-match */
-with_value(char *value, /* I - Value string */
- int regex, /* I - Value is a regular expression */
+with_value(cups_array_t *errors, /* I - Errors array */
+ char *value, /* I - Value string */
+ int flags, /* I - Flags for match */
ipp_attribute_t *attr, /* I - Attribute to compare */
- int report, /* I - 1 = report failures */
char *matchbuf, /* I - Buffer to hold matching value */
size_t matchlen) /* I - Length of match buffer */
{
- int i; /* Looping var */
+ int i, /* Looping var */
+ match; /* Match? */
char *valptr; /* Pointer into value */
*matchbuf = '\0';
+ match = (flags & _CUPS_WITH_ALL) ? 1 : 0;
/*
* NULL matches everything.
@@ -5172,8 +5134,8 @@ with_value(char *value, /* I - Value string */
{
char op, /* Comparison operator */
*nextptr; /* Next pointer */
- int intvalue; /* Integer value */
-
+ int intvalue, /* Integer value */
+ valmatch = 0; /* Does the current value match? */
valptr = value;
@@ -5197,37 +5159,39 @@ with_value(char *value, /* I - Value string */
break;
valptr = nextptr;
- switch (op)
+ if ((op == '=' && attr->values[i].integer == intvalue) ||
+ (op == '<' && attr->values[i].integer < intvalue) ||
+ (op == '>' && attr->values[i].integer > intvalue))
{
- case '=' :
- if (attr->values[i].integer == intvalue)
- {
- snprintf(matchbuf, matchlen, "%d", attr->values[i].integer);
- return (1);
- }
- break;
- case '<' :
- if (attr->values[i].integer < intvalue)
- {
- snprintf(matchbuf, matchlen, "%d", attr->values[i].integer);
- return (1);
- }
- break;
- case '>' :
- if (attr->values[i].integer > intvalue)
- {
- snprintf(matchbuf, matchlen, "%d", attr->values[i].integer);
- return (1);
- }
- break;
+ if (!matchbuf[0])
+ snprintf(matchbuf, matchlen, "%d",
+ attr->values[i].integer);
+
+ valmatch = 1;
+ break;
}
}
+
+ if (flags & _CUPS_WITH_ALL)
+ {
+ if (!valmatch)
+ {
+ match = 0;
+ break;
+ }
+ }
+ else if (valmatch)
+ {
+ match = 1;
+ break;
+ }
}
- if (report)
+ if (!match && errors)
{
for (i = 0; i < attr->num_values; i ++)
- print_test_error("GOT: %s=%d", attr->name, attr->values[i].integer);
+ add_stringf(errors, "GOT: %s=%d", attr->name,
+ attr->values[i].integer);
}
break;
@@ -5236,8 +5200,8 @@ with_value(char *value, /* I - Value string */
{
char op, /* Comparison operator */
*nextptr; /* Next pointer */
- int intvalue; /* Integer value */
-
+ int intvalue, /* Integer value */
+ valmatch = 0; /* Does the current value match? */
valptr = value;
@@ -5261,44 +5225,40 @@ with_value(char *value, /* I - Value string */
break;
valptr = nextptr;
- switch (op)
+ if ((op == '=' && (attr->values[i].range.lower == intvalue ||
+ attr->values[i].range.upper == intvalue)) ||
+ (op == '<' && attr->values[i].range.upper < intvalue) ||
+ (op == '>' && attr->values[i].range.upper > intvalue))
{
- case '=' :
- if (attr->values[i].range.lower == intvalue ||
- attr->values[i].range.upper == intvalue)
- {
- snprintf(matchbuf, matchlen, "%d-%d",
- attr->values[i].range.lower,
- attr->values[i].range.upper);
- return (1);
- }
- break;
- case '<' :
- if (attr->values[i].range.upper < intvalue)
- {
- snprintf(matchbuf, matchlen, "%d-%d",
- attr->values[i].range.lower,
- attr->values[i].range.upper);
- return (1);
- }
- break;
- case '>' :
- if (attr->values[i].range.upper > intvalue)
- {
- snprintf(matchbuf, matchlen, "%d-%d",
- attr->values[i].range.lower,
- attr->values[i].range.upper);
- return (1);
- }
- break;
+ if (!matchbuf[0])
+ snprintf(matchbuf, matchlen, "%d-%d",
+ attr->values[0].range.lower,
+ attr->values[0].range.upper);
+
+ valmatch = 1;
+ break;
}
}
+
+ if (flags & _CUPS_WITH_ALL)
+ {
+ if (!valmatch)
+ {
+ match = 0;
+ break;
+ }
+ }
+ else if (valmatch)
+ {
+ match = 1;
+ break;
+ }
}
- if (report)
+ if (!match && errors)
{
for (i = 0; i < attr->num_values; i ++)
- print_test_error("GOT: %s=%d-%d", attr->name,
+ add_stringf(errors, "GOT: %s=%d-%d", attr->name,
attr->values[i].range.lower,
attr->values[i].range.upper);
}
@@ -5309,15 +5269,26 @@ with_value(char *value, /* I - Value string */
{
if (!strcmp(value, "true") == attr->values[i].boolean)
{
- strlcpy(matchbuf, value, matchlen);
- return (1);
+ if (!matchbuf[0])
+ strlcpy(matchbuf, value, matchlen);
+
+ if (!(flags & _CUPS_WITH_ALL))
+ {
+ match = 1;
+ break;
+ }
+ }
+ else if (flags & _CUPS_WITH_ALL)
+ {
+ match = 0;
+ break;
}
}
- if (report)
+ if (!match && errors)
{
for (i = 0; i < attr->num_values; i ++)
- print_test_error("GOT: %s=%s", attr->name,
+ add_stringf(errors, "GOT: %s=%s", attr->name,
attr->values[i].boolean ? "true" : "false");
}
break;
@@ -5336,7 +5307,7 @@ with_value(char *value, /* I - Value string */
case IPP_TAG_TEXTLANG :
case IPP_TAG_URI :
case IPP_TAG_URISCHEME :
- if (regex)
+ if (flags & _CUPS_WITH_REGEX)
{
/*
* Value is an extended, case-sensitive POSIX regular expression...
@@ -5361,56 +5332,69 @@ with_value(char *value, /* I - Value string */
for (i = 0; i < attr->num_values; i ++)
{
- if (regexec(&re, attr->values[i].string.text, 0, NULL, 0))
+ if (!regexec(&re, attr->values[i].string.text, 0, NULL, 0))
{
- if (report)
- print_test_error("GOT: %s=\"%s\"", attr->name,
- attr->values[i].string.text);
- else
+ if (!matchbuf[0])
+ strlcpy(matchbuf, attr->values[i].string.text, matchlen);
+
+ if (!(flags & _CUPS_WITH_ALL))
+ {
+ match = 1;
break;
+ }
+ }
+ else if (flags & _CUPS_WITH_ALL)
+ {
+ match = 0;
+ break;
}
}
regfree(&re);
-
- if (i == attr->num_values)
- strlcpy(matchbuf, attr->values[0].string.text, matchlen);
-
- return (i == attr->num_values);
}
else
{
/*
- * Value is a literal string, see if at least one value matches the
- * literal string...
+ * Value is a literal string, see if the value(s) match...
*/
for (i = 0; i < attr->num_values; i ++)
{
if (!strcmp(value, attr->values[i].string.text))
{
- strlcpy(matchbuf, attr->values[i].string.text, matchlen);
- return (1);
- }
- }
+ if (!matchbuf[0])
+ strlcpy(matchbuf, attr->values[i].string.text, matchlen);
- if (report)
- {
- for (i = 0; i < attr->num_values; i ++)
- print_test_error("GOT: %s=\"%s\"", attr->name,
- attr->values[i].string.text);
+ if (!(flags & _CUPS_WITH_ALL))
+ {
+ match = 1;
+ break;
+ }
+ }
+ else if (flags & _CUPS_WITH_ALL)
+ {
+ match = 0;
+ break;
+ }
}
}
+
+ if (!match && errors)
+ {
+ for (i = 0; i < attr->num_values; i ++)
+ add_stringf(errors, "GOT: %s=\"%s\"", attr->name,
+ attr->values[i].string.text);
+ }
break;
default :
break;
}
- return (0);
+ return (match);
}
/*
- * End of "$Id: ipptool.c 10090 2011-10-25 22:39:56Z mike $".
+ * End of "$Id: ipptool.c 10461 2012-05-11 23:01:21Z mike $".
*/
diff --git a/test/onepage-a4.ps b/test/onepage-a4.ps
index bfefc7ad..9397b89a 100644
--- a/test/onepage-a4.ps
+++ b/test/onepage-a4.ps
@@ -1,7 +1,7 @@
%!PS-Adobe-3.0
%XpdfVersion: 3.03
%%Creator: Scribus 1.4.0.rc5
-%%Title:
+%%Title:
%%LanguageLevel: 3
%%DocumentSuppliedResources: (atend)
%%DocumentMedia: plain 595 842 0 () ()
diff --git a/test/onepage-letter.ps b/test/onepage-letter.ps
index 7a00ce71..dfedeb47 100644
--- a/test/onepage-letter.ps
+++ b/test/onepage-letter.ps
@@ -1,7 +1,7 @@
%!PS-Adobe-3.0
%XpdfVersion: 3.03
%%Creator: Scribus 1.4.0.rc5
-%%Title:
+%%Title:
%%LanguageLevel: 3
%%DocumentSuppliedResources: (atend)
%%DocumentMedia: plain 612 792 0 () ()
diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh
index 7b6d1b72..ca3e51f7 100755
--- a/test/run-stp-tests.sh
+++ b/test/run-stp-tests.sh
@@ -1,11 +1,11 @@
#!/bin/sh
#
-# "$Id: run-stp-tests.sh 10464 2012-05-15 14:04:18Z mike $"
+# "$Id: run-stp-tests.sh 10488 2012-05-21 15:35:25Z mike $"
#
# Perform the complete set of IPP compliance tests specified in the
# CUPS Software Test Plan.
#
-# Copyright 2007-2011 by Apple Inc.
+# Copyright 2007-2012 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -18,6 +18,21 @@
argcount=$#
#
+# Don't allow "make check" or "make test" to be run by root...
+#
+
+if test "x`id -u`" = x0; then
+ echo Please run this as a normal user. Not supported when run as root.
+ exit 1
+fi
+
+#
+# Force the permissions of the files we create...
+#
+
+umask 022
+
+#
# Make the IPP test program...
#
@@ -203,12 +218,54 @@ echo ""
case "$usevalgrind" in
Y* | y*)
- valgrind="valgrind --tool=memcheck --log-file=/tmp/cups-$user/log/valgrind.%p --error-limit=no --leak-check=yes --trace-children=yes --read-var-info=yes"
+ VALGRIND="valgrind --tool=memcheck --log-file=/tmp/cups-$user/log/valgrind.%p --error-limit=no --leak-check=yes --trace-children=yes --read-var-info=yes"
+ if test `uname` = Darwin; then
+ VALGRIND="$VALGRIND --dsymutil=yes"
+ fi
+ export VALGRIND
echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..."
;;
*)
- valgrind=""
+ VALGRIND=""
+ export VALGRIND
+ ;;
+esac
+
+#
+# See if we want to do debug logging of the libraries...
+#
+
+echo ""
+echo "If CUPS was built with the --enable-debug-printfs configure option, you"
+echo "can enable debug logging of the libraries."
+echo ""
+echo $ac_n "Enter Y or a number from 0 to 9 to enable debug logging or N to not: [N] $ac_c"
+
+if test $# -gt 0; then
+ usedebugprintfs=$1
+ shift
+else
+ read usedebugprintfs
+fi
+echo ""
+
+case "$usedebugprintfs" in
+ Y* | y*)
+ echo "Enabling debug printfs; log files can be found in /tmp/cups-$user/log..."
+ CUPS_DEBUG_LOG="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
+ CUPS_DEBUG_LEVEL=5; export CUPS_DEBUG_LEVEL
+ CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
+ ;;
+
+ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)
+ echo "Enabling debug printfs; log files can be found in /tmp/cups-$user/log..."
+ CUPS_DEBUG_LOG="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
+ CUPS_DEBUG_LEVEL=$usedebugprintf; export CUPS_DEBUG_LEVEL
+ CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
+ ;;
+
+ *)
;;
esac
@@ -250,9 +307,7 @@ ln -s $root/backend/http /tmp/cups-$user/bin/backend
ln -s $root/backend/ipp /tmp/cups-$user/bin/backend
ln -s $root/backend/lpd /tmp/cups-$user/bin/backend
ln -s $root/backend/mdns /tmp/cups-$user/bin/backend
-ln -s $root/backend/parallel /tmp/cups-$user/bin/backend
ln -s $root/backend/pseudo /tmp/cups-$user/bin/backend
-ln -s $root/backend/serial /tmp/cups-$user/bin/backend
ln -s $root/backend/snmp /tmp/cups-$user/bin/backend
ln -s $root/backend/socket /tmp/cups-$user/bin/backend
ln -s $root/backend/usb /tmp/cups-$user/bin/backend
@@ -260,16 +315,13 @@ ln -s $root/cgi-bin /tmp/cups-$user/bin
ln -s $root/monitor /tmp/cups-$user/bin
ln -s $root/notifier /tmp/cups-$user/bin
ln -s $root/scheduler /tmp/cups-$user/bin/daemon
-ln -s $root/filter/bannertops /tmp/cups-$user/bin/filter
ln -s $root/filter/commandtops /tmp/cups-$user/bin/filter
ln -s $root/filter/gziptoany /tmp/cups-$user/bin/filter
-ln -s $root/filter/hpgltops /tmp/cups-$user/bin/filter
ln -s $root/filter/pstops /tmp/cups-$user/bin/filter
ln -s $root/filter/rastertoepson /tmp/cups-$user/bin/filter
ln -s $root/filter/rastertohp /tmp/cups-$user/bin/filter
ln -s $root/filter/rastertolabel /tmp/cups-$user/bin/filter
ln -s $root/filter/rastertopwg /tmp/cups-$user/bin/filter
-ln -s $root/filter/texttops /tmp/cups-$user/bin/filter
ln -s $root/data/classified /tmp/cups-$user/share/banners
ln -s $root/data/confidential /tmp/cups-$user/share/banners
@@ -277,10 +329,7 @@ ln -s $root/data/secret /tmp/cups-$user/share/banners
ln -s $root/data/standard /tmp/cups-$user/share/banners
ln -s $root/data/topsecret /tmp/cups-$user/share/banners
ln -s $root/data/unclassified /tmp/cups-$user/share/banners
-ln -s $root/data /tmp/cups-$user/share/charmaps
-ln -s $root/data /tmp/cups-$user/share/charsets
ln -s $root/data /tmp/cups-$user/share
-ln -s $root/fonts /tmp/cups-$user/share
ln -s $root/ppdc/sample.drv /tmp/cups-$user/share/drv
ln -s $root/conf/mime.types /tmp/cups-$user/share/mime
ln -s $root/conf/mime.convs /tmp/cups-$user/share/mime
@@ -288,16 +337,8 @@ ln -s $root/data/*.h /tmp/cups-$user/share/ppdc
ln -s $root/data/*.defs /tmp/cups-$user/share/ppdc
ln -s $root/templates /tmp/cups-$user/share
-if test -f $root/filter/imagetops; then
- ln -s $root/filter/imagetops /tmp/cups-$user/bin/filter
-fi
-
-if test -f $root/filter/imagetoraster; then
- ln -s $root/filter/imagetoraster /tmp/cups-$user/bin/filter
-fi
-
#
-# Mac OS X filters and configuration files...
+# Local filters and configuration files...
#
if test `uname` = Darwin; then
@@ -320,7 +361,13 @@ if test `uname` = Darwin; then
ln -s /usr/share/cups/mime/apple.* /tmp/cups-$user/share/mime
fi
else
- ln -s $root/filter/pdftops /tmp/cups-$user/bin/filter
+ ln -s /usr/lib/cups/filter/bannertops /tmp/cups-$user/bin/filter
+ ln -s /usr/lib/cups/filter/imagetops /tmp/cups-$user/bin/filter
+ ln -s /usr/lib/cups/filter/imagetoraster /tmp/cups-$user/bin/filter
+ ln -s /usr/lib/cups/filter/pdftops /tmp/cups-$user/bin/filter
+ ln -s /usr/lib/cups/filter/texttops /tmp/cups-$user/bin/filter
+
+ ln -s /usr/share/cups/mime/legacy.convs /tmp/cups-$user/share/mime
fi
#
@@ -336,10 +383,11 @@ else
fi
cat >/tmp/cups-$user/cupsd.conf <<EOF
+StrictConformance Yes
Browsing Off
FileDevice yes
Printcap
-Listen 127.0.0.1:$port
+Listen localhost:$port
User $user
ServerRoot /tmp/cups-$user
StateDir /tmp/cups-$user
@@ -348,6 +396,7 @@ CacheDir /tmp/cups-$user/share
DataDir /tmp/cups-$user/share
FontPath /tmp/cups-$user/share/fonts
PassEnv LOCALEDIR
+PassEnv DYLD_INSERT_LIBRARIES
DocumentRoot $root/doc
RequestRoot /tmp/cups-$user/spool
TempDir /tmp/cups-$user/spool/temp
@@ -362,9 +411,7 @@ LogTimeFormat usecs
PreserveJobHistory Yes
<Policy default>
<Limit All>
-Order Deny,Allow
-Deny from all
-Allow from 127.0.0.1
+Order Allow,Deny
$encryption
</Limit>
</Policy>
@@ -424,31 +471,31 @@ fi
echo "Setting up environment variables for test..."
if test "x$LD_LIBRARY_PATH" = x; then
- LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc"
+ LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
else
- LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$LD_LIBRARY_PATH"
+ LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$LD_LIBRARY_PATH"
fi
export LD_LIBRARY_PATH
-LD_PRELOAD="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2:$root/cgi-bin/libcupscgi.so.1:$root/scheduler/libcupsmime.so.1:$root/driver/libcupsdriver.so.1:$root/ppdc/libcupsppdc.so.1"
+LD_PRELOAD="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2:$root/cgi-bin/libcupscgi.so.1:$root/scheduler/libcupsmime.so.1:$root/ppdc/libcupsppdc.so.1"
if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then
LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD"
fi
export LD_PRELOAD
if test "x$DYLD_LIBRARY_PATH" = x; then
- DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc"
+ DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
else
- DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$DYLD_LIBRARY_PATH"
+ DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$DYLD_LIBRARY_PATH"
fi
export DYLD_LIBRARY_PATH
if test "x$SHLIB_PATH" = x; then
- SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc"
+ SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
else
- SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$SHLIB_PATH"
+ SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$SHLIB_PATH"
fi
export SHLIB_PATH
@@ -482,14 +529,14 @@ export LC_MESSAGES
#
echo "Starting scheduler:"
-echo " $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &"
+echo " $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &"
echo ""
-if test `uname` = Darwin -a "x$valgrind" = x -a -f /usr/lib/libgmalloc.dylib; then
- DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib \
- $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
+if test `uname` = Darwin -a "x$VALGRIND" = x; then
+ DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib
+ ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
else
- $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
+ $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
fi
cupsd=$!
@@ -553,7 +600,7 @@ done
#
date=`date "+%Y-%m-%d"`
-strfile=/tmp/cups-$user/cups-str-1.5-$date-$user.html
+strfile=/tmp/cups-$user/cups-str-1.6-$date-$user.html
rm -f $strfile
cat str-header.html >$strfile
@@ -572,11 +619,18 @@ echo `date "+%Y-%m-%d"` by $user on `hostname`. >>$strfile
echo "<PRE>" >>$strfile
fail=0
-for file in 4*.test; do
+for file in 4*.test ipp-2.1.test; do
echo $ac_n "Performing $file: $ac_c"
echo "" >>$strfile
- ./ipptool -tI ipp://localhost:$port/printers $file >> $strfile
+ if test $file = ipp-2.1.test; then
+ uri="ipp://localhost:$port/printers/Test1"
+ options="-V 2.1 -d NOPRINT=1 -f testfile.ps"
+ else
+ uri="ipp://localhost:$port/printers"
+ options=""
+ fi
+ $VALGRIND ./ipptool -tI $options $uri $file >> $strfile
status=$?
if test $status != 0; then
@@ -677,9 +731,21 @@ else
echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile
fi
+# Paged printed on Test3
+count=`$GREP '^Test3 ' /tmp/cups-$user/log/page_log | grep -v total | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
+expected=2
+if test $count != $expected; then
+ echo "FAIL: Printer 'Test3' produced $count page(s), expected $expected."
+ echo "<P>FAIL: Printer 'Test3' produced $count page(s), expected $expected.</P>" >>$strfile
+ fail=`expr $fail + 1`
+else
+ echo "PASS: Printer 'Test3' correctly produced $count page(s)."
+ echo "<P>PASS: Printer 'Test3' correctly produced $count page(s).</P>" >>$strfile
+fi
+
# Requests logged
count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
-expected=`expr 37 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
+expected=`expr 37 + 18 + 28 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
if test $count != $expected; then
echo "FAIL: $count requests logged, expected $expected."
echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile
@@ -749,10 +815,10 @@ fi
# Error log messages
count=`$GREP '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
-if test $count != 18; then
- echo "FAIL: $count error messages, expected 18."
+if test $count != 33; then
+ echo "FAIL: $count error messages, expected 33."
$GREP '^E ' /tmp/cups-$user/log/error_log
- echo "<P>FAIL: $count error messages, expected 18.</P>" >>$strfile
+ echo "<P>FAIL: $count error messages, expected 33.</P>" >>$strfile
echo "<PRE>" >>$strfile
$GREP '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
echo "</PRE>" >>$strfile
@@ -870,5 +936,5 @@ if test $fail != 0; then
fi
#
-# End of "$Id: run-stp-tests.sh 10464 2012-05-15 14:04:18Z mike $"
+# End of "$Id: run-stp-tests.sh 10488 2012-05-21 15:35:25Z mike $"
#
diff --git a/test/str-header.html b/test/str-header.html
index 84f0d9b7..f9204bbe 100644
--- a/test/str-header.html
+++ b/test/str-header.html
@@ -1,8 +1,8 @@
<HTML>
<HEAD>
<META NAME="Description" CONTENT="CUPS Test Report">
- <META NAME="COPYRIGHT" CONTENT="Copyright 2007-2010, All Rights Reserved">
- <META NAME="DOCNUMBER" CONTENT="CUPS-STR-1.5">
+ <META NAME="COPYRIGHT" CONTENT="Copyright 2007-2011, All Rights Reserved">
+ <META NAME="DOCNUMBER" CONTENT="CUPS-STR-1.6">
<META NAME="Author" CONTENT="Apple Inc.">
<TITLE>CUPS 1.5 Software Test Report</TITLE>
<STYLE TYPE="text/css"><!--
@@ -14,10 +14,10 @@
</HEAD>
<BODY>
-<H1>CUPS 1.5 Software Test Report</H1>
+<H1>CUPS 1.6 Software Test Report</H1>
<P>This software test report provides detailed test results that
-are used to evaluate the stability and compliance of CUPS Version 1.5.
+are used to evaluate the stability and compliance of CUPS Version 1.6.
<H2>Document Overview</H2>
diff --git a/test/testfile.pcl b/test/testfile.pcl
new file mode 100644
index 00000000..4b865976
--- /dev/null
+++ b/test/testfile.pcl
@@ -0,0 +1,60 @@
+EAll work and no play makes Johhny a dull boy. All work and no
+play makes Johhny a dull boy. All work and no play makes Johhny
+a dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. E
diff --git a/test/testfile.txt b/test/testfile.txt
index 46bbf084..bad0a31e 100644
--- a/test/testfile.txt
+++ b/test/testfile.txt
@@ -1,60 +1,60 @@
-All work and no play makes Johhny a dull boy. All work and no
-play makes Johhny a dull boy. All work and no play makes Johhny
-a dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy. All
-work and no play makes Johhny a dull boy. All work and no play
-makes Johhny a dull boy. All work and no play makes Johhny a
-dull boy. All work and no play makes Johhny a dull boy.
+All work and no play makes Johhny a dull boy. All work and no
+play makes Johhny a dull boy. All work and no play makes Johhny
+a dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy. All
+work and no play makes Johhny a dull boy. All work and no play
+makes Johhny a dull boy. All work and no play makes Johhny a
+dull boy. All work and no play makes Johhny a dull boy.
diff --git a/test/xmltotest.c b/test/xmltotest.c
new file mode 100644
index 00000000..efe04553
--- /dev/null
+++ b/test/xmltotest.c
@@ -0,0 +1,529 @@
+/*
+ * "$Id: xmltotest.c 10192 2012-01-20 21:49:02Z mike $"
+ *
+ * IANA XML registration to test file generator for CUPS.
+ *
+ * Copyright 2011-2012 by Apple Inc.
+ *
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
+ *
+ * This file is subject to the Apple OS-Developed Software exception.
+ *
+ * Usage:
+ *
+ * ./xmltotest [--ref standard] {--job|--printer} [XML file/URL] >file.test
+ *
+ * If not specified, loads the XML registrations from:
+ *
+ * http://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml
+ *
+ * "Standard" is of the form "rfcNNNN" or "pwgNNNN.N".
+ *
+ * Contents:
+ *
+ * main() - Process command-line arguments.
+ * compare_reg() - Compare two registrations.
+ * load_xml() - Load the XML registration file or URL.
+ * match_xref() - Compare the xref against the named standard.
+ * new_reg() - Create a new registration record.
+ * usage() - Show usage message.
+ * write_expect() - Write an EXPECT test for an attribute.
+ */
+
+
+#include <config.h>
+#include <cups/cups.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#ifdef HAVE_MXML_H
+# include <mxml.h>
+/*
+ * Local types...
+ */
+
+typedef struct _cups_reg_s /**** Registration data ****/
+{
+ char *name, /* Attribute name */
+ *member, /* Member attribute name */
+ *sub_member, /* Sub-member attribute name */
+ *syntax; /* Attribute syntax */
+} _cups_reg_t;
+
+
+/*
+ * Local functions...
+ */
+
+static int compare_reg(_cups_reg_t *a, _cups_reg_t *b);
+static mxml_node_t *load_xml(const char *reg_file);
+static int match_xref(mxml_node_t *xref, const char *standard);
+static _cups_reg_t *new_reg(mxml_node_t *name, mxml_node_t *member,
+ mxml_node_t *sub_member, mxml_node_t *syntax);
+static int usage(void);
+static void write_expect(_cups_reg_t *reg, ipp_tag_t group);
+
+
+/*
+ * 'main()' - Process command-line arguments.
+ */
+
+int
+main(int argc, /* I - Number of command-line args */
+ char *argv[]) /* I - Command-line arguments */
+{
+ int i; /* Looping var */
+ const char *reg_file = NULL, /* Registration file/URL to use */
+ *reg_standard = NULL; /* Which standard to extract */
+ mxml_node_t *reg_xml, /* Registration XML data */
+ *reg_2, /* ipp-registrations-2 */
+ *reg_record, /* <record> */
+ *reg_collection, /* <collection> */
+ *reg_name, /* <name> */
+ *reg_member, /* <member_attribute> */
+ *reg_sub_member, /* <sub-member_attribute> */
+ *reg_syntax, /* <syntax> */
+ *reg_xref; /* <xref> */
+ cups_array_t *attrs; /* Attribute registrations */
+ _cups_reg_t *current; /* Current attribute registration */
+ ipp_tag_t group = IPP_TAG_ZERO, /* Which attributes to test */
+ reg_group; /* Group for registration */
+
+
+ /*
+ * Parse command-line...
+ */
+
+ for (i = 1; i < argc; i ++)
+ {
+ if (!strcmp(argv[i], "--job") && group == IPP_TAG_ZERO)
+ group = IPP_TAG_JOB;
+ else if (!strcmp(argv[i], "--ref"))
+ {
+ i ++;
+ if (i >= argc)
+ return (usage());
+
+ reg_standard = argv[i];
+ }
+ else if (!strcmp(argv[i], "--printer") && group == IPP_TAG_ZERO)
+ group = IPP_TAG_PRINTER;
+ else if (argv[i][0] == '-' || reg_file)
+ return (usage());
+ else
+ reg_file = argv[i];
+ }
+
+ if (group == IPP_TAG_ZERO)
+ return (usage());
+
+ /*
+ * Read registrations...
+ */
+
+ if (!reg_file)
+ reg_file = "http://www.iana.org/assignments/ipp-registrations/"
+ "ipp-registrations.xml";
+
+ if ((reg_xml = load_xml(reg_file)) == NULL)
+ return (1);
+
+ /*
+ * Scan registrations for attributes...
+ */
+
+ if ((reg_2 = mxmlFindElement(reg_xml, reg_xml, "registry", "id",
+ "ipp-registrations-2",
+ MXML_DESCEND)) == NULL)
+ {
+ fprintf(stderr, "xmltotest: No IPP attribute registrations in \"%s\".\n",
+ reg_file);
+ return (1);
+ }
+
+ attrs = cupsArrayNew((cups_array_func_t)compare_reg, NULL);
+
+ for (reg_record = mxmlFindElement(reg_2, reg_2, "record", NULL, NULL,
+ MXML_DESCEND);
+ reg_record;
+ reg_record = mxmlFindElement(reg_record, reg_2, "record", NULL, NULL,
+ MXML_NO_DESCEND))
+ {
+ /*
+ * Get the values from the current record...
+ */
+
+ reg_collection = mxmlFindElement(reg_record, reg_record, "collection",
+ NULL, NULL, MXML_DESCEND);
+ reg_name = mxmlFindElement(reg_record, reg_record, "name", NULL, NULL,
+ MXML_DESCEND);
+ reg_member = mxmlFindElement(reg_record, reg_record, "member_attribute",
+ NULL, NULL, MXML_DESCEND);
+ reg_sub_member = mxmlFindElement(reg_record, reg_record,
+ "sub-member_attribute", NULL, NULL,
+ MXML_DESCEND);
+ reg_syntax = mxmlFindElement(reg_record, reg_record, "syntax", NULL,
+ NULL, MXML_DESCEND);
+ reg_xref = mxmlFindElement(reg_record, reg_record, "xref", NULL, NULL,
+ MXML_DESCEND);
+
+ if (!reg_collection || !reg_name || !reg_syntax || !reg_xref)
+ continue;
+
+ /*
+ * Filter based on group and standard...
+ */
+
+ if (!strcmp(reg_collection->child->value.opaque, "Printer Description"))
+ reg_group = IPP_TAG_PRINTER;
+ else if (!strcmp(reg_collection->child->value.opaque, "Job Description"))
+ reg_group = IPP_TAG_JOB;
+ else if (!strcmp(reg_collection->child->value.opaque, "Job Template"))
+ {
+ if (strstr(reg_name->child->value.opaque, "-default") ||
+ strstr(reg_name->child->value.opaque, "-supported"))
+ reg_group = IPP_TAG_PRINTER;
+ else
+ reg_group = IPP_TAG_JOB;
+ }
+ else
+ reg_group = IPP_TAG_ZERO;
+
+ if (reg_group != group)
+ continue;
+
+ if (reg_standard && !match_xref(reg_xref, reg_standard))
+ continue;
+
+ /*
+ * Add the record to the array...
+ */
+
+ if ((current = new_reg(reg_name, reg_member, reg_sub_member,
+ reg_syntax)) != NULL)
+ cupsArrayAdd(attrs, current);
+ }
+
+ /*
+ * Write out a test for all of the selected attributes...
+ */
+
+ puts("{");
+
+ if (group == IPP_TAG_PRINTER)
+ {
+ puts("\tOPERATION Get-Printer-Attributes");
+ puts("\tGROUP operation-attributes-tag");
+ puts("\tATTR charset attributes-charset utf-8");
+ puts("\tATTR naturalLanguage attributes-natural-language en");
+ puts("\tATTR uri printer-uri $uri");
+ puts("\tATTR name requesting-user-name $user");
+ puts("\tATTR keyword requested-attributes all,media-col-database");
+ puts("");
+ puts("\tSTATUS successful-ok");
+ puts("\tSTATUS successful-ok-ignored-or-substituted-attributes");
+ puts("");
+ }
+ else
+ {
+ puts("\tOPERATION Get-Job-Attributes");
+ puts("\tGROUP operation-attributes-tag");
+ puts("\tATTR charset attributes-charset utf-8");
+ puts("\tATTR naturalLanguage attributes-natural-language en");
+ puts("\tATTR uri printer-uri $uri");
+ puts("\tATTR integer job-id $job-id");
+ puts("\tATTR name requesting-user-name $user");
+ puts("");
+ puts("\tSTATUS successful-ok");
+ puts("");
+ }
+
+ for (current = cupsArrayFirst(attrs);
+ current;
+ current = cupsArrayNext(attrs))
+ write_expect(current, group);
+
+ puts("}");
+
+ return (0);
+}
+
+
+/*
+ * 'compare_reg()' - Compare two registrations.
+ */
+
+static int /* O - Result of comparison */
+compare_reg(_cups_reg_t *a, /* I - First registration */
+ _cups_reg_t *b) /* I - Second registration */
+{
+ int retval; /* Return value */
+
+
+ if ((retval = strcmp(a->name, b->name)) != 0)
+ return (retval);
+
+ if (a->member && b->member)
+ retval = strcmp(a->member, b->member);
+ else if (a->member)
+ retval = 1;
+ else if (b->member)
+ retval = -1;
+
+ if (retval)
+ return (retval);
+
+ if (a->sub_member && b->sub_member)
+ retval = strcmp(a->sub_member, b->sub_member);
+ else if (a->sub_member)
+ retval = 1;
+ else if (b->sub_member)
+ retval = -1;
+
+ return (retval);
+}
+
+
+/*
+ * 'load_xml()' - Load the XML registration file or URL.
+ */
+
+static mxml_node_t * /* O - XML file or NULL */
+load_xml(const char *reg_file) /* I - Filename or URL */
+{
+ mxml_node_t *xml; /* XML file */
+ char scheme[256], /* Scheme */
+ userpass[256], /* Username and password */
+ hostname[256], /* Hostname */
+ resource[1024], /* Resource path */
+ filename[1024]; /* Temporary file */
+ int port, /* Port number */
+ fd; /* File descriptor */
+
+
+ if (httpSeparateURI(HTTP_URI_CODING_ALL, reg_file, scheme, sizeof(scheme),
+ userpass, sizeof(userpass), hostname, sizeof(hostname),
+ &port, resource, sizeof(resource)) < HTTP_URI_OK)
+ {
+ fprintf(stderr, "xmltotest: Bad URI or filename \"%s\".\n", reg_file);
+ return (NULL);
+ }
+
+ if (!strcmp(scheme, "file"))
+ {
+ /*
+ * Local file...
+ */
+
+ if ((fd = open(resource, O_RDONLY)) < 0)
+ {
+ fprintf(stderr, "xmltotest: Unable to open \"%s\": %s\n", resource,
+ strerror(errno));
+ return (NULL);
+ }
+
+ filename[0] = '\0';
+ }
+ else if (strcmp(scheme, "http") && strcmp(scheme, "https"))
+ {
+ fprintf(stderr, "xmltotest: Unsupported URI scheme \"%s\".\n", scheme);
+ return (NULL);
+ }
+ else
+ {
+ http_t *http; /* HTTP connection */
+ http_encryption_t encryption; /* Encryption to use */
+ http_status_t status; /* Status of HTTP GET */
+
+ if (!strcmp(scheme, "https") || port == 443)
+ encryption = HTTP_ENCRYPT_ALWAYS;
+ else
+ encryption = HTTP_ENCRYPT_IF_REQUESTED;
+
+ if ((http = httpConnectEncrypt(hostname, port, encryption)) == NULL)
+ {
+ fprintf(stderr, "xmltotest: Unable to connect to \"%s\": %s\n", hostname,
+ cupsLastErrorString());
+ return (NULL);
+ }
+
+ if ((fd = cupsTempFd(filename, sizeof(filename))) < 0)
+ {
+ fprintf(stderr, "xmltotest: Unable to create temporary file: %s\n",
+ strerror(errno));
+ httpClose(http);
+ return (NULL);
+ }
+
+ status = cupsGetFd(http, resource, fd);
+ httpClose(http);
+
+ if (status != HTTP_OK)
+ {
+ fprintf(stderr, "mxmltotest: Unable to get \"%s\": %d\n", reg_file,
+ status);
+ close(fd);
+ unlink(filename);
+ return (NULL);
+ }
+
+ lseek(fd, 0, SEEK_SET);
+ }
+
+ /*
+ * Load the XML file...
+ */
+
+ xml = mxmlLoadFd(NULL, fd, MXML_OPAQUE_CALLBACK);
+
+ close(fd);
+
+ if (filename[0])
+ unlink(filename);
+
+ return (xml);
+}
+
+
+/*
+ * 'match_xref()' - Compare the xref against the named standard.
+ */
+
+static int /* O - 1 if match, 0 if not */
+match_xref(mxml_node_t *xref, /* I - <xref> node */
+ const char *standard) /* I - Name of standard */
+{
+ const char *data; /* "data" attribute */
+ char s[256]; /* String to look for */
+
+
+ if ((data = mxmlElementGetAttr(xref, "data")) == NULL)
+ return (1);
+
+ if (!strcmp(data, standard))
+ return (1);
+
+ if (!strncmp(standard, "pwg", 3))
+ {
+ snprintf(s, sizeof(s), "-%s.pdf", standard + 3);
+ return (strstr(data, s) != NULL);
+ }
+ else
+ return (0);
+}
+
+
+/*
+ * 'new_reg()' - Create a new registration record.
+ */
+
+static _cups_reg_t * /* O - New record */
+new_reg(mxml_node_t *name, /* I - Attribute name */
+ mxml_node_t *member, /* I - Member attribute, if any */
+ mxml_node_t *sub_member, /* I - Sub-member attribute, if any */
+ mxml_node_t *syntax) /* I - Syntax */
+{
+ _cups_reg_t *reg; /* New record */
+
+
+ if ((reg = calloc(1, sizeof(_cups_reg_t))) != NULL)
+ {
+ reg->name = name->child->value.opaque;
+ reg->syntax = syntax->child->value.opaque;
+
+ if (member)
+ reg->member = member->child->value.opaque;
+
+ if (sub_member)
+ reg->sub_member = sub_member->child->value.opaque;
+ }
+
+ return (reg);
+}
+
+
+/*
+ * 'usage()' - Show usage message.
+ */
+
+static int /* O - Exit status */
+usage(void)
+{
+ puts("Usage ./xmltotest [--ref standard] {--job|--printer} [XML file/URL] "
+ ">file.test");
+ return (1);
+}
+
+
+/*
+ * 'write_expect()' - Write an EXPECT test for an attribute.
+ */
+
+static void
+write_expect(_cups_reg_t *reg, /* I - Registration information */
+ ipp_tag_t group) /* I - Attribute group tag */
+{
+ const char *syntax; /* Pointer into syntax string */
+ int single = 1, /* Single valued? */
+ skip = 0; /* Skip characters? */
+
+
+ printf("\tEXPECT ?%s OF-TYPE ", reg->name);
+
+ syntax = reg->syntax;
+
+ while (*syntax)
+ {
+ if (!strncmp(syntax, "1setOf", 6))
+ {
+ single = 0;
+ syntax += 6;
+
+ while (isspace(*syntax & 255))
+ syntax ++;
+
+ if (*syntax == '(')
+ syntax ++;
+ }
+ else if (!strncmp(syntax, "type1", 5) || !strncmp(syntax, "type2", 5) ||
+ !strncmp(syntax, "type3", 5))
+ syntax += 5;
+ else if (*syntax == '(')
+ {
+ skip = 1;
+ syntax ++;
+ }
+ else if (*syntax == ')')
+ {
+ skip = 0;
+ syntax ++;
+ }
+ else if (!skip && (*syntax == '|' || isalpha(*syntax & 255)))
+ putchar(*syntax++);
+ else
+ syntax ++;
+ }
+
+ if (single)
+ printf(" IN-GROUP %s COUNT 1\n", ippTagString(group));
+ else
+ printf(" IN-GROUP %s\n", ippTagString(group));
+}
+
+
+#else /* !HAVE_MXML */
+int
+main(void)
+{
+ return (1);
+}
+#endif /* HAVE_MXML */
+
+
+/*
+ * End of "$Id: xmltotest.c 10192 2012-01-20 21:49:02Z mike $".
+ */