5 :: IPP Everywhere Printer Self
-Certification Manual
1.0: Section
5: Bonjour Tests.
7 :: Copyright
2014 by The Printer Working Group.
9 :: This program may be copied and furnished to others
, and derivative works
10 :: that comment on
, or otherwise explain it or assist in its implementation may
11 :: be prepared
, copied
, published and distributed
, in whole or in part
, without
12 :: restriction of any kind
, provided that the above copyright notice and this
13 :: paragraph are included on all such copies and derivative works.
15 :: The IEEE
-ISTO and the Printer Working Group DISCLAIM ANY AND ALL WARRANTIES
,
16 :: WHETHER EXPRESS OR IMPLIED INCLUDING
(WITHOUT LIMITATION
) ANY IMPLIED
17 :: WARRANTIES OF MERCHANTABILITY OR FITNESS
FOR A PARTICULAR PURPOSE.
21 :: bonjour
-tests.bat
'Printer Name'
24 set PLIST
="%1 Bonjour Results.plist"
26 :: Special case
"_failN" name to show bad
/missing TXT
keys
29 echo "<key>Errors</key><array>" >>"%PLIST%"
30 if not defined IPPFIND_TXT_ADMINURL
{
31 echo " adminurl is not set."
32 echo "<string>adminurl is not set.</string>" >>"%PLIST%"
34 if test
"%2" == "_values" {
35 if not %IPPFIND_TXT_ADMINURL
:~
0,7% == "http://" {
36 if not %IPPFIND_TXT_ADMINURL
:~
0,8% == "https://" {
37 echo " adminurl has bad value '%IPPFIND_TXT_ADMINURL%'."
38 echo "<string>adminurl has bad value '%IPPFIND_TXT_ADMINURL%'.</string>" >>"%PLIST%"
44 if not defined IPPFIND_TXT_PDL
{
45 echo " pdl is not set."
46 echo "<string>pdl is not set.</string>" >>"%PLIST%"
48 if "%2" == "_values" {
49 set temp
=%IPPFIND_TXT_PDL
:image/jpeg
=%
50 if "%temp%" == "%IPPFIND_TXT_PDL%" {
51 echo " pdl is missing image/jpeg: '%IPPFIND_TXT_PDL%'"
52 echo "<string>pdl is missing image/jpeg: '%IPPFIND_TXT_PDL%'.</string>" >>"%PLIST%"
55 set temp
=%IPPFIND_TXT_PDL
:image/pwg
-raster
=%
56 if "%temp%" == "%IPPFIND_TXT_PDL%" {
57 echo " pdl is missing image/pwg-raster: '%IPPFIND_TXT_PDL%'"
58 echo "<string>pdl is missing image/pwg-raster: '%IPPFIND_TXT_PDL%'.</string>" >>"%PLIST%"
63 if not defined IPPFIND_TXT_RP
{
64 echo " rp is not set."
65 echo "<string>rp is not set.</string>" >>"%PLIST%"
67 if "%2" == "_values" {
68 if not "%IPPFIND_TXT_RP%" == "ipp/print" {
69 if not "%IPPFIND_TXT_RP:~0,10%" == "ipp/print/" {
70 echo " rp has bad value '%IPPFIND_TXT_RP%'"
71 echo "<string>rp has bad value '%IPPFIND_TXT_RP%'.</string>" >>"%PLIST%"
77 if not defined IPPFIND_TXT_UUID
{
78 echo " UUID is not set."
79 echo "<string>UUID is not set.</string>" >>"%PLIST%"
81 if "%2" == "_values" {
82 :: This isn
't as effective as the test in bonjour-tests.sh...
83 if "%IPPFIND_TXT_UUID:~0,9%" == "urn:uuid:" {
84 echo " UUID has bad value '%IPPFIND_TXT_UUID%'"
85 echo "<string>UUID has bad value '%IPPFIND_TXT_UUID%'.</string>" >>"%PLIST%"
90 if "%2" == "_values" {
91 ipptool -t -d "ADMINURL=%IPPFIND_TXT_ADMINURL%" -d "UUID=%IPPFIND_TXT_UUID%" %IPPFIND_SERVICE_URI% bonjour-value-tests.test
92 echo "<string>" >>"%PLIST%"
93 $IPPTOOL -t -d "ADMINURL=$IPPFIND_TXT_ADMINURL" -d "UUID=$IPPFIND_TXT_UUID" $IPPFIND_SERVICE_URI bonjour-value-tests.test | findstr /r '[TD
]:' >>"%PLIST%"
94 echo "</string>" >>"%PLIST%"
97 echo "</array>" >>"%PLIST%"
98 echo "<key>Successful</key><false />" >>"%PLIST%"
99 echo "</dict>" >>"%PLIST%"
105 :: Write the standard XML plist header...
106 echo '<?xml version
="1.0" encoding
="UTF-8"?
>' >"%PLIST%"
107 echo '<!DOCTYPE plist PUBLIC
"-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">' >>"%PLIST%"
108 echo '<plist version
="1.0">' >>"%PLIST%"
109 echo '<dict
>' >>"%PLIST%"
110 echo '<key
>Tests
</key
><array
>' >>"%PLIST%"
117 :: B-1. IPP Browse test: Printers appear in a search for "_ipp._tcp,_print" services?
118 call :start_test "B-1. IPP Browse test"
120 ippfind _ipp._tcp,_print.local. --name "%1" --quiet && set result=PASS
121 if "%result%" == "PASS" {
129 :: B-2. IPP TXT keys test: The IPP TXT record contains all required keys.
130 call :start_test "B-2. IPP TXT keys test"
132 ippfind "%1._ipp._tcp.local." --txt adminurl --txt pdl --txt rp --txt UUID --quiet && set result=PASS
133 if "%result%" == "PASS" {
138 ippfind "$1._ipp._tcp.local." -x bonjour-tests.bat '{service_name
}' _keys \;
141 :: B-3. IPP Resolve test: Printer responds to an IPP Get-Printer-Attributes request using the resolved hostname, port, and resource path.
142 call :start_test "B-3. IPP Resolve test"
144 ippfind "%1._ipp._tcp.local." --ls >/dev/null && set result=PASS
145 if "%result%" == "PASS" {
150 echo "<key>Errors</key><array><string>" >>"%PLIST%"
151 ippfind "$1._ipp._tcp.local." --ls >>"%PLIST%"
152 echo "</string></array>" >>"%PLIST%"
156 :: B-4. IPP TXT values test: The IPP TXT record values match the reported IPP attribute values.
157 call :start_test "B-4. IPP TXT values test"
159 ippfind "%1._ipp._tcp.local." --txt-adminurl '^
(http
:|https
:)//' --txt-pdl 'image
/pwg
-raster
' --txt-pdl 'image
/jpeg
' --txt-rp '^ipp
/(print|
print/[^
/]+)$
' --txt-UUID '^
[0-9a
-fA
-F
]{8,8}-[0-9a
-fA
-F
]{4,4}-[0-9a
-fA
-F
]{4,4}-[0-9a
-fA
-F
]{4,4}-[0-9a
-fA
-F
]{12,12}$
' -x $IPPTOOL -q -d 'ADMINURL
={txt_adminurl
}' -d 'UUID
={txt_uuid
}' '{}' bonjour-value-tests.test \; && set result=PASS
160 if "%result%" == "PASS" {
165 ippfind "%1._ipp._tcp.local." -x bonjour-tests.bat '{service_name
}' _values \;
168 :: B-5. TLS tests: Performed only if TLS is supported
169 call :start_test "B-5. TLS tests"
171 find "$1._ipp._tcp.local." --txt tls --quiet && set result=PASS
172 if "%result%" == "PASS" {
182 :: B-5.1 HTTP Upgrade test: Printer responds to an IPP Get-Printer-Attributes request after doing an HTTP Upgrade to TLS.
183 call :start_test "B-5.1 HTTP Upgrade test"
186 ippfind "%1._ipp._tcp.local." -x ipptool -E -q '{}' bonjour-access-tests.test \; && set result=PASS
187 if "%result%" == "PASS" {
192 echo "<key>Errors</key><array><string>" >>"%PLIST"
193 ippfind "%1._ipp._tcp.local." -x ipptool -E -q '{}' bonjour-access-tests.test \; >>"%PLIST%"
194 echo "</string></array>" >>"%PLIST%"
202 :: B-5.2 IPPS Browse test: Printer appears in a search for "_ipps._tcp,_print" services.
203 start_test "B-5.2 IPPS Browse test"
204 if test $HAVE_TLS = 1; then
205 $IPPFIND _ipps._tcp,_print.local. --name "$1" --quiet
207 pass=`expr $pass + 1`
210 fail=`expr $fail + 1`
214 skip=`expr $skip + 1`
218 :: B-5.3 IPPS TXT keys test: The TXT record for IPPS contains all required keys
219 start_test "B-5.3 IPPS TXT keys test"
220 if test $HAVE_TLS = 1; then
221 $IPPFIND "$1._ipps._tcp.local." --txt adminurl --txt pdl --txt rp --txt TLS --txt UUID --quiet
223 pass=`expr $pass + 1`
226 fail=`expr $fail + 1`
227 $IPPFIND "$1._ipps._tcp.local." -x ./bonjour-tests.sh '{service_name
}' _fail5.3 \;
230 skip=`expr $skip + 1`
234 :: B-5.4 IPPS Resolve test: Printer responds to an IPPS Get-Printer-Attributes request using the resolved hostname, port, and resource path.
235 start_test "B-5.4 IPPS Resolve test"
236 if test $HAVE_TLS = 1; then
237 $IPPFIND "$1._ipps._tcp.local." --ls >/dev/null
239 pass=`expr $pass + 1`
242 fail=`expr $fail + 1`
243 echo "<key>Errors</key><array>" >>"%PLIST%"
244 $IPPFIND "$1._ipps._tcp.local." --ls | awk '{ print "<string>" $
0 "</string>" }' >>"%PLIST%"
245 echo "</array>" >>"%PLIST%"
249 skip=`expr $skip + 1`
253 :: B-5.5 IPPS TXT values test: The TXT record values for IPPS match the reported IPPS attribute values.
254 start_test "B-5.5 IPPS TXT values test"
255 if test $HAVE_TLS = 1; then
256 $IPPFIND "$1._ipps._tcp.local." --txt-adminurl '^
(http
:|https
:)//' --txt-pdl 'image
/pwg
-raster
' --txt-pdl 'image
/jpeg
' --txt-rp '^ipp
/(print|
print/[^
/]+)$
' --txt-UUID '^
[0-9a
-fA
-F
]{8,8}-[0-9a
-fA
-F
]{4,4}-[0-9a
-fA
-F
]{4,4}-[0-9a
-fA
-F
]{4,4}-[0-9a
-fA
-F
]{12,12}$
' -x $IPPTOOL -q -d 'ADMINURL
={txt_adminurl
}' -d 'UUID
={txt_uuid
}' '{}' bonjour-value-tests.test \;
258 pass=`expr $pass + 1`
261 fail=`expr $fail + 1`
262 $IPPFIND "$1._ipps._tcp.local." -x ./bonjour-tests.sh '{service_name
}' _fail5.5 \;
265 skip=`expr $skip + 1`
270 if test $fail -gt 0; then
271 cat >>"%PLIST%" <<EOF
273 <key>Successful</key>
277 cat >>"%PLIST%" <<EOF
279 <key>Successful</key>
284 cat >>"%PLIST%" <<EOF
289 score=`expr $pass + $skip`
290 score=`expr 100 \* $score / $total`
291 echo "Summary: $total tests, $pass passed, $fail failed, $skip skipped"
292 echo "Score: ${score}%"
296 :: call :start_test "name"
301 echo "<dict><key>Name</key><string>$1</string>" >>"%PLIST%"
302 echo "<key>FileId</key><string>org.pwg.ipp-everywhere.20140826.bonjour</string>" >>"%PLIST%"
306 :: call :end_test PASS/FAIL/SKIP
311 echo "<key>Successful</key><false />" >>"%PLIST%"
314 echo "<key>Successful</key><true />" >>"%PLIST%"
315 echo "<key>Skipped</key><true />" >>"%PLIST%"
317 echo "<key>Successful</key><true />" >>"%PLIST%"
320 echo "</dict>" >>"%PLIST%"