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 second argument
: "_keys" and
"_values" 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 "%2" == "_values" (
36 set scheme
="%IPPFIND_TXT_ADMINURL:~0,7%"
37 if "%scheme%" == "http://" set result
=PASS
38 set scheme
="%IPPFIND_TXT_ADMINURL:~0,8%"
39 if "%scheme%" == "https://" set result
=PASS
40 if "%result%" == "FAIL" (
41 echo " adminurl has bad value '%IPPFIND_TXT_ADMINURL%'."
42 echo "<string>adminurl has bad value '%IPPFIND_TXT_ADMINURL%'.</string>" >>"%PLIST%"
47 if not defined IPPFIND_TXT_PDL
(
48 echo " pdl is not set."
49 echo "<string>pdl is not set.</string>" >>"%PLIST%"
51 if "%2" == "_values" (
52 set temp
="%IPPFIND_TXT_PDL:image/jpeg=%"
53 if "%temp%" == "%IPPFIND_TXT_PDL%" (
54 echo " pdl is missing image/jpeg: '%IPPFIND_TXT_PDL%'"
55 echo "<string>pdl is missing image/jpeg: '%IPPFIND_TXT_PDL%'.</string>" >>"%PLIST%"
58 set temp
="%IPPFIND_TXT_PDL:image/pwg-raster=%"
59 if "%temp%" == "%IPPFIND_TXT_PDL%" (
60 echo " pdl is missing image/pwg-raster: '%IPPFIND_TXT_PDL%'"
61 echo "<string>pdl is missing image/pwg-raster: '%IPPFIND_TXT_PDL%'.</string>" >>"%PLIST%"
66 if not defined IPPFIND_TXT_RP
(
67 echo " rp is not set."
68 echo "<string>rp is not set.</string>" >>"%PLIST%"
70 if "%2" == "_values" (
71 if not "%IPPFIND_TXT_RP%" == "ipp/print" (
72 if not "%IPPFIND_TXT_RP:~0,10%" == "ipp/print/" (
73 echo " rp has bad value '%IPPFIND_TXT_RP%'"
74 echo "<string>rp has bad value '%IPPFIND_TXT_RP%'.</string>" >>"%PLIST%"
80 if not defined IPPFIND_TXT_UUID
(
81 echo " UUID is not set."
82 echo "<string>UUID is not set.</string>" >>"%PLIST%"
84 if "%2" == "_values" (
85 :: This isn
't as effective as the test in bonjour-tests.sh but still
86 :: catches the most common error...
87 set scheme="%IPPFIND_TXT_UUID:~0,9%"
88 if "%scheme%" == "urn:uuid:" (
89 echo " UUID has bad value '%IPPFIND_TXT_UUID%'"
90 echo "<string>UUID has bad value '%IPPFIND_TXT_UUID%'.</string>" >>"%PLIST%"
95 if "%2" == "_values" (
96 ipptool -t -d "ADMINURL=%IPPFIND_TXT_ADMINURL%" -d "UUID=%IPPFIND_TXT_UUID%" %IPPFIND_SERVICE_URI% bonjour-value-tests.test
97 echo "<string>" >>"%PLIST%"
98 $IPPTOOL -t -d "ADMINURL=$IPPFIND_TXT_ADMINURL" -d "UUID=$IPPFIND_TXT_UUID" $IPPFIND_SERVICE_URI bonjour-value-tests.test | findstr /r "[TD]:" >>"%PLIST%"
99 echo "</string>" >>"%PLIST%"
102 echo "</array>" >>"%PLIST%"
103 echo "<key>Successful</key><false />" >>"%PLIST%"
104 echo "</dict>" >>"%PLIST%"
110 :: Write the standard XML plist header...
111 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >"%PLIST%"
112 echo "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >>"%PLIST%"
113 echo "<plist version=\"1.0\">" >>"%PLIST%"
114 echo "<dict>" >>"%PLIST%"
115 echo "<key>Tests</key><array>" >>"%PLIST%"
122 :: B-1. IPP Browse test: Printers appear in a search for "_ipp._tcp,_print" services?
123 call :start_test "B-1. IPP Browse test"
125 ippfind _ipp._tcp,_print.local. --name "%1" --quiet && set result=PASS
126 if "%result%" == "PASS" (
134 :: B-2. IPP TXT keys test: The IPP TXT record contains all required keys.
135 call :start_test "B-2. IPP TXT keys test"
137 ippfind "%1._ipp._tcp.local." --txt adminurl --txt pdl --txt rp --txt UUID --quiet && set result=PASS
138 if "%result%" == "PASS" (
143 ippfind "%1._ipp._tcp.local." -x bonjour-tests.bat "{service_name}" _keys ";"
146 :: B-3. IPP Resolve test: Printer responds to an IPP Get-Printer-Attributes request using the resolved hostname, port, and resource path.
147 call :start_test "B-3. IPP Resolve test"
149 (ippfind "%1._ipp._tcp.local." --ls && set result=PASS) >nul:
150 if "%result%" == "PASS" (
155 echo "<key>Errors</key><array><string>" >>"%PLIST%"
156 ippfind "%1._ipp._tcp.local." --ls >>"%PLIST%"
157 echo "</string></array>" >>"%PLIST%"
161 :: B-4. IPP TXT values test: The IPP TXT record values match the reported IPP attribute values.
162 call :start_test "B-4. IPP TXT values test"
164 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
165 if "%result%" == "PASS" (
170 ippfind "%1._ipp._tcp.local." -x bonjour-tests.bat "{service_name}" _values ";"
173 :: B-5. TLS tests: Performed only if TLS is supported
174 call :start_test "B-5. TLS tests"
176 find "%1._ipp._tcp.local." --txt tls --quiet && set result=PASS
177 if "%result%" == "PASS" (
187 :: B-5.1 HTTP Upgrade test: Printer responds to an IPP Get-Printer-Attributes request after doing an HTTP Upgrade to TLS.
188 call :start_test "B-5.1 HTTP Upgrade test"
189 if "%HAVE_TLS%" == "1" (
191 ippfind "%1._ipp._tcp.local." -x ipptool -E -q "{}" bonjour-access-tests.test ";" && set result=PASS
192 if "%result%" == "PASS" (
197 echo "<key>Errors</key><array><string>" >>"%PLIST"
198 ippfind "%1._ipp._tcp.local." -x ipptool -E -q "{}" bonjour-access-tests.test ";" >>"%PLIST%"
199 echo "</string></array>" >>"%PLIST%"
207 :: B-5.2 IPPS Browse test: Printer appears in a search for "_ipps._tcp,_print" services.
208 call :start_test "B-5.2 IPPS Browse test"
209 if "%HAVE_TLS%" == "1" (
211 ippfind _ipps._tcp,_print.local. --name "%1" --quiet && set result=PASS
212 if "%result%" == "PASS" (
224 :: B-5.3 IPPS TXT keys test: The TXT record for IPPS contains all required keys
225 call :start_test "B-5.3 IPPS TXT keys test"
226 if "%HAVE_TLS%" == "1" (
228 ippfind "%1._ipps._tcp.local." --txt adminurl --txt pdl --txt rp --txt TLS --txt UUID --quiet && set result=PASS
229 if "%result%" == "PASS" (
234 ippfind "%1._ipps._tcp.local." -x bonjour-tests.bat "{service_name}" _keys ";"
241 :: B-5.4 IPPS Resolve test: Printer responds to an IPPS Get-Printer-Attributes request using the resolved hostname, port, and resource path.
242 call :start_test "B-5.4 IPPS Resolve test"
243 if "%HAVE_TLS%" == "1" (
245 (ippfind "%1._ipps._tcp.local." --ls && set result=PASS) >nul:
246 if "%result%" == "PASS" (
251 echo "<key>Errors</key><array><string>" >>"%PLIST%"
252 ippfind "%1._ipps._tcp.local." --ls >>"%PLIST%"
253 echo "</string></array>" >>"%PLIST%"
261 :: B-5.5 IPPS TXT values test: The TXT record values for IPPS match the reported IPPS attribute values.
262 call :start_test "B-5.5 IPPS TXT values test"
263 if "%HAVE_TLS%" == "1" (
265 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 ";" && set result=PASS
266 if "%result%" == "PASS" (
271 ippfind "%1._ipps._tcp.local." -x bonjour-tests.bat "{service_name}" _values ";"
279 echo "</array>" >>"%PLIST%"
280 echo "<key>Successful</key>" >>"%PLIST%"
282 echo "<false />" >>"%PLIST%"
284 echo "<true />" >>"%PLIST%"
286 echo "</dict>" >>"%PLIST%"
287 echo "</plist>" >>"%PLIST%"
289 set /a score=%pass% + %skip%
290 set /a score=100 * %score% / %total%
291 echo "Summary: %total% tests, %pass% passed, %fail% failed, %skip% skipped"
292 echo "Score: %score%^%"
296 :: call :start_test "name"
301 set name=%name:~1,-1%
302 set <NUL /p="%name%: "
303 echo "<dict><key>Name</key><string>%name%</string>" >>"%PLIST%"
304 echo "<key>FileId</key><string>org.pwg.ipp-everywhere.20140826.bonjour</string>" >>"%PLIST%"
308 :: call :end_test PASS/FAIL/SKIP
313 echo "<key>Successful</key><false />" >>"%PLIST%"
316 echo "<key>Successful</key><true />" >>"%PLIST%"
317 echo "<key>Skipped</key><true />" >>"%PLIST%"
319 echo "<key>Successful</key><true />" >>"%PLIST%"
322 echo "</dict>" >>"%PLIST%"