]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | #!/bin/sh |
2 | # | |
79a784c4 | 3 | # "$Id$" |
ef416fc2 | 4 | # |
5 | # Perform the complete set of IPP compliance tests specified in the | |
6 | # CUPS Software Test Plan. | |
7 | # | |
db8b865d | 8 | # Copyright 2007-2013 by Apple Inc. |
f899b121 | 9 | # Copyright 1997-2007 by Easy Software Products, all rights reserved. |
ef416fc2 | 10 | # |
11 | # These coded instructions, statements, and computer programs are the | |
bc44d920 | 12 | # property of Apple Inc. and are protected by Federal copyright |
13 | # law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
14 | # which should have been included with this file. If this file is | |
15 | # file is missing or damaged, see the license at "http://www.cups.org/". | |
ef416fc2 | 16 | # |
17 | ||
a74454a7 | 18 | argcount=$# |
19 | ||
a29fd7dd MS |
20 | # |
21 | # Don't allow "make check" or "make test" to be run by root... | |
22 | # | |
23 | ||
24 | if test "x`id -u`" = x0; then | |
25 | echo Please run this as a normal user. Not supported when run as root. | |
26 | exit 1 | |
27 | fi | |
28 | ||
29 | # | |
30 | # Force the permissions of the files we create... | |
31 | # | |
32 | ||
33 | umask 022 | |
34 | ||
ef416fc2 | 35 | # |
36 | # Make the IPP test program... | |
37 | # | |
38 | ||
39 | make | |
40 | ||
0268488e MS |
41 | # |
42 | # Solaris has a non-POSIX grep in /bin... | |
43 | # | |
44 | ||
45 | if test -x /usr/xpg4/bin/grep; then | |
46 | GREP=/usr/xpg4/bin/grep | |
47 | else | |
48 | GREP=grep | |
49 | fi | |
50 | ||
bd7854cb | 51 | # |
52 | # Figure out the proper echo options... | |
53 | # | |
54 | ||
0268488e | 55 | if (echo "testing\c"; echo 1,2,3) | $GREP c >/dev/null; then |
bd7854cb | 56 | ac_n=-n |
57 | ac_c= | |
58 | else | |
59 | ac_n= | |
60 | ac_c='\c' | |
61 | fi | |
62 | ||
ef416fc2 | 63 | # |
64 | # Greet the tester... | |
65 | # | |
66 | ||
67 | echo "Welcome to the CUPS Automated Test Script." | |
68 | echo "" | |
69 | echo "Before we begin, it is important that you understand that the larger" | |
70 | echo "tests require significant amounts of RAM and disk space. If you" | |
71 | echo "attempt to run one of the big tests on a system that lacks sufficient" | |
72 | echo "disk and virtual memory, the UNIX kernel might decide to kill one or" | |
73 | echo "more system processes that you've grown attached to, like the X" | |
74 | echo "server. The question you may want to ask yourself before running a" | |
75 | echo "large test is: Do you feel lucky?" | |
76 | echo "" | |
77 | echo "OK, now that we have the Dirty Harry quote out of the way, please" | |
78 | echo "choose the type of test you wish to perform:" | |
79 | echo "" | |
80 | echo "0 - No testing, keep the scheduler running for me (all systems)" | |
81 | echo "1 - Basic conformance test, no load testing (all systems)" | |
82 | echo "2 - Basic conformance test, some load testing (minimum 256MB VM, 50MB disk)" | |
83 | echo "3 - Basic conformance test, extreme load testing (minimum 1GB VM, 500MB disk)" | |
84 | echo "4 - Basic conformance test, torture load testing (minimum 2GB VM, 1GB disk)" | |
85 | echo "" | |
bd7854cb | 86 | echo $ac_n "Enter the number of the test you wish to perform: [1] $ac_c" |
ef416fc2 | 87 | |
a74454a7 | 88 | if test $# -gt 0; then |
89 | testtype=$1 | |
90 | shift | |
91 | else | |
92 | read testtype | |
93 | fi | |
bd7854cb | 94 | echo "" |
ef416fc2 | 95 | |
96 | case "$testtype" in | |
97 | 0) | |
98 | echo "Running in test mode (0)" | |
99 | nprinters1=0 | |
100 | nprinters2=0 | |
101 | pjobs=0 | |
b9faaae1 | 102 | pprinters=0 |
766a8229 | 103 | loglevel="debug2" |
ef416fc2 | 104 | ;; |
105 | 2) | |
106 | echo "Running the medium tests (2)" | |
107 | nprinters1=10 | |
108 | nprinters2=20 | |
109 | pjobs=20 | |
b9faaae1 | 110 | pprinters=10 |
766a8229 | 111 | loglevel="debug" |
ef416fc2 | 112 | ;; |
113 | 3) | |
114 | echo "Running the extreme tests (3)" | |
115 | nprinters1=500 | |
116 | nprinters2=1000 | |
117 | pjobs=100 | |
b9faaae1 | 118 | pprinters=50 |
766a8229 | 119 | loglevel="debug" |
ef416fc2 | 120 | ;; |
121 | 4) | |
122 | echo "Running the torture tests (4)" | |
123 | nprinters1=10000 | |
124 | nprinters2=20000 | |
125 | pjobs=200 | |
b9faaae1 | 126 | pprinters=100 |
766a8229 | 127 | loglevel="debug" |
ef416fc2 | 128 | ;; |
129 | *) | |
130 | echo "Running the timid tests (1)" | |
131 | nprinters1=0 | |
132 | nprinters2=0 | |
839a51c8 | 133 | pjobs=10 |
b9faaae1 | 134 | pprinters=0 |
766a8229 | 135 | loglevel="debug2" |
ef416fc2 | 136 | ;; |
137 | esac | |
138 | ||
139 | # | |
140 | # See if we want to do SSL testing... | |
141 | # | |
142 | ||
143 | echo "" | |
144 | echo "Now you can choose whether to create a SSL/TLS encryption key and" | |
145 | echo "certificate for testing; these tests currently require the OpenSSL" | |
146 | echo "tools:" | |
147 | echo "" | |
148 | echo "0 - Do not do SSL/TLS encryption tests" | |
411affcf | 149 | echo "1 - Test but do not require encryption" |
150 | echo "2 - Test and require encryption" | |
ef416fc2 | 151 | echo "" |
bd7854cb | 152 | echo $ac_n "Enter the number of the SSL/TLS tests to perform: [0] $ac_c" |
ef416fc2 | 153 | |
a74454a7 | 154 | if test $# -gt 0; then |
155 | ssltype=$1 | |
156 | shift | |
157 | else | |
158 | read ssltype | |
159 | fi | |
bd7854cb | 160 | echo "" |
ef416fc2 | 161 | |
162 | case "$ssltype" in | |
411affcf | 163 | 1) |
164 | echo "Will test but not require encryption (1)" | |
165 | ;; | |
166 | 2) | |
167 | echo "Will test and require encryption (2)" | |
ef416fc2 | 168 | ;; |
ef416fc2 | 169 | *) |
411affcf | 170 | echo "Not using SSL/TLS (0)" |
ef416fc2 | 171 | ssltype=0 |
172 | ;; | |
173 | esac | |
174 | ||
175 | # | |
176 | # Information for the server/tests... | |
177 | # | |
178 | ||
e1d6a774 | 179 | user="$USER" |
180 | if test -z "$user"; then | |
181 | if test -x /usr/ucb/whoami; then | |
182 | user=`/usr/ucb/whoami` | |
183 | else | |
184 | user=`whoami` | |
185 | fi | |
186 | ||
187 | if test -z "$user"; then | |
188 | user="unknown" | |
189 | fi | |
190 | fi | |
191 | ||
ef416fc2 | 192 | port=8631 |
193 | cwd=`pwd` | |
194 | root=`dirname $cwd` | |
195 | ||
196 | # | |
197 | # Make sure that the LPDEST and PRINTER environment variables are | |
198 | # not included in the environment that is passed to the tests. These | |
199 | # will usually cause tests to fail erroneously... | |
200 | # | |
201 | ||
634763e8 MS |
202 | unset LPDEST |
203 | unset PRINTER | |
ef416fc2 | 204 | |
205 | # | |
206 | # See if we want to use valgrind... | |
207 | # | |
208 | ||
209 | echo "" | |
210 | echo "This test script can use the Valgrind software from:" | |
211 | echo "" | |
212 | echo " http://developer.kde.org/~sewardj/" | |
213 | echo "" | |
bd7854cb | 214 | echo $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c" |
ef416fc2 | 215 | |
a74454a7 | 216 | if test $# -gt 0; then |
217 | usevalgrind=$1 | |
218 | shift | |
219 | else | |
220 | read usevalgrind | |
221 | fi | |
bd7854cb | 222 | echo "" |
ef416fc2 | 223 | |
224 | case "$usevalgrind" in | |
225 | Y* | y*) | |
a2326b5b MS |
226 | 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" |
227 | if test `uname` = Darwin; then | |
228 | VALGRIND="$VALGRIND --dsymutil=yes" | |
229 | fi | |
230 | export VALGRIND | |
ef416fc2 | 231 | echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..." |
232 | ;; | |
233 | ||
234 | *) | |
a2326b5b MS |
235 | VALGRIND="" |
236 | export VALGRIND | |
ef416fc2 | 237 | ;; |
238 | esac | |
239 | ||
85dda01c MS |
240 | # |
241 | # See if we want to do debug logging of the libraries... | |
242 | # | |
243 | ||
244 | echo "" | |
245 | echo "If CUPS was built with the --enable-debug-printfs configure option, you" | |
246 | echo "can enable debug logging of the libraries." | |
247 | echo "" | |
248 | echo $ac_n "Enter Y or a number from 0 to 9 to enable debug logging or N to not: [N] $ac_c" | |
249 | ||
250 | if test $# -gt 0; then | |
251 | usedebugprintfs=$1 | |
252 | shift | |
253 | else | |
254 | read usedebugprintfs | |
255 | fi | |
256 | echo "" | |
257 | ||
258 | case "$usedebugprintfs" in | |
259 | Y* | y*) | |
c41769ff | 260 | echo "Enabling debug printfs (level 5); log files can be found in /tmp/cups-$user/log..." |
85dda01c MS |
261 | CUPS_DEBUG_LOG="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG |
262 | CUPS_DEBUG_LEVEL=5; export CUPS_DEBUG_LEVEL | |
a2326b5b | 263 | CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER |
85dda01c MS |
264 | ;; |
265 | ||
266 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9) | |
c41769ff | 267 | echo "Enabling debug printfs (level $usedebugprintfs); log files can be found in /tmp/cups-$user/log..." |
85dda01c | 268 | CUPS_DEBUG_LOG="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG |
c41769ff | 269 | CUPS_DEBUG_LEVEL="$usedebugprintfs"; export CUPS_DEBUG_LEVEL |
a2326b5b | 270 | CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER |
85dda01c MS |
271 | ;; |
272 | ||
273 | *) | |
274 | ;; | |
275 | esac | |
276 | ||
ef416fc2 | 277 | # |
278 | # Start by creating temporary directories for the tests... | |
279 | # | |
280 | ||
a74454a7 | 281 | echo "Creating directories for test..." |
282 | ||
ef416fc2 | 283 | rm -rf /tmp/cups-$user |
284 | mkdir /tmp/cups-$user | |
285 | mkdir /tmp/cups-$user/bin | |
286 | mkdir /tmp/cups-$user/bin/backend | |
839a51c8 | 287 | mkdir /tmp/cups-$user/bin/driver |
ef416fc2 | 288 | mkdir /tmp/cups-$user/bin/filter |
289 | mkdir /tmp/cups-$user/certs | |
290 | mkdir /tmp/cups-$user/share | |
291 | mkdir /tmp/cups-$user/share/banners | |
7a14d768 | 292 | mkdir /tmp/cups-$user/share/drv |
4509bb49 MS |
293 | mkdir /tmp/cups-$user/share/locale |
294 | for file in ../locale/cups_*.po; do | |
295 | loc=`basename $file .po | cut -c 6-` | |
296 | mkdir /tmp/cups-$user/share/locale/$loc | |
297 | ln -s $root/locale/cups_$loc.po /tmp/cups-$user/share/locale/$loc | |
298 | ln -s $root/locale/ppdc_$loc.po /tmp/cups-$user/share/locale/$loc | |
299 | done | |
75bd9771 | 300 | mkdir /tmp/cups-$user/share/mime |
ef416fc2 | 301 | mkdir /tmp/cups-$user/share/model |
7a14d768 | 302 | mkdir /tmp/cups-$user/share/ppdc |
ef416fc2 | 303 | mkdir /tmp/cups-$user/interfaces |
304 | mkdir /tmp/cups-$user/log | |
305 | mkdir /tmp/cups-$user/ppd | |
306 | mkdir /tmp/cups-$user/spool | |
307 | mkdir /tmp/cups-$user/spool/temp | |
308 | mkdir /tmp/cups-$user/ssl | |
309 | ||
b19ccc9e | 310 | ln -s $root/backend/dnssd /tmp/cups-$user/bin/backend |
ef416fc2 | 311 | ln -s $root/backend/http /tmp/cups-$user/bin/backend |
312 | ln -s $root/backend/ipp /tmp/cups-$user/bin/backend | |
313 | ln -s $root/backend/lpd /tmp/cups-$user/bin/backend | |
7a14d768 | 314 | ln -s $root/backend/mdns /tmp/cups-$user/bin/backend |
f14324a7 | 315 | ln -s $root/backend/pseudo /tmp/cups-$user/bin/backend |
a74454a7 | 316 | ln -s $root/backend/snmp /tmp/cups-$user/bin/backend |
ef416fc2 | 317 | ln -s $root/backend/socket /tmp/cups-$user/bin/backend |
318 | ln -s $root/backend/usb /tmp/cups-$user/bin/backend | |
319 | ln -s $root/cgi-bin /tmp/cups-$user/bin | |
bd7854cb | 320 | ln -s $root/monitor /tmp/cups-$user/bin |
ef416fc2 | 321 | ln -s $root/notifier /tmp/cups-$user/bin |
322 | ln -s $root/scheduler /tmp/cups-$user/bin/daemon | |
7a14d768 | 323 | ln -s $root/filter/commandtops /tmp/cups-$user/bin/filter |
7a0cbd5e | 324 | ln -s $root/filter/gziptoany /tmp/cups-$user/bin/filter |
ef416fc2 | 325 | ln -s $root/filter/pstops /tmp/cups-$user/bin/filter |
326 | ln -s $root/filter/rastertoepson /tmp/cups-$user/bin/filter | |
327 | ln -s $root/filter/rastertohp /tmp/cups-$user/bin/filter | |
eac3a0a0 MS |
328 | ln -s $root/filter/rastertolabel /tmp/cups-$user/bin/filter |
329 | ln -s $root/filter/rastertopwg /tmp/cups-$user/bin/filter | |
ef416fc2 | 330 | |
331 | ln -s $root/data/classified /tmp/cups-$user/share/banners | |
332 | ln -s $root/data/confidential /tmp/cups-$user/share/banners | |
333 | ln -s $root/data/secret /tmp/cups-$user/share/banners | |
334 | ln -s $root/data/standard /tmp/cups-$user/share/banners | |
335 | ln -s $root/data/topsecret /tmp/cups-$user/share/banners | |
336 | ln -s $root/data/unclassified /tmp/cups-$user/share/banners | |
ef416fc2 | 337 | ln -s $root/data /tmp/cups-$user/share |
7a14d768 | 338 | ln -s $root/ppdc/sample.drv /tmp/cups-$user/share/drv |
75bd9771 MS |
339 | ln -s $root/conf/mime.types /tmp/cups-$user/share/mime |
340 | ln -s $root/conf/mime.convs /tmp/cups-$user/share/mime | |
7a14d768 MS |
341 | ln -s $root/data/*.h /tmp/cups-$user/share/ppdc |
342 | ln -s $root/data/*.defs /tmp/cups-$user/share/ppdc | |
ef416fc2 | 343 | ln -s $root/templates /tmp/cups-$user/share |
344 | ||
bc44d920 | 345 | # |
f3c17241 | 346 | # Local filters and configuration files... |
bc44d920 | 347 | # |
348 | ||
79a784c4 MS |
349 | instfilter() { |
350 | # instfilter src dst format | |
351 | # | |
352 | # See if the filter exists in a standard location; if so, make a | |
353 | # symlink, otherwise create a dummy script for the specified format. | |
354 | # | |
355 | src="$1" | |
356 | dst="$2" | |
357 | format="$3" | |
358 | ||
359 | for dir in /usr/libexec/cups/filter /usr/lib/cups/filter; do | |
360 | if test -x "$dir/$src"; then | |
361 | ln -s "$dir/$src" "/tmp/cups-$user/bin/filter/$dst" | |
362 | return | |
363 | fi | |
364 | done | |
365 | ||
366 | # Source filter not present, create a dummy filter | |
367 | case $format in | |
368 | passthru) | |
369 | ln -s gziptoany "/tmp/cups-$user/bin/filter/$dst" | |
370 | ;; | |
371 | pdf) | |
372 | cat >"/tmp/cups-$user/bin/filter/$dst" <<EOF | |
373 | #!/bin/sh | |
374 | case "\$5" in | |
375 | *media=a4* | *media=iso_a4* | *PageSize=A4*) | |
376 | cat "$root/test/onepage-a4.pdf" | |
377 | ;; | |
378 | *) | |
379 | cat "$root/test/onepage-letter.pdf" | |
380 | ;; | |
381 | esac | |
382 | EOF | |
383 | chmod +x "/tmp/cups-$user/bin/filter/$dst" | |
384 | ;; | |
385 | ps) | |
386 | cat >"/tmp/cups-$user/bin/filter/$dst" <<EOF | |
387 | #!/bin/sh | |
388 | case "\$5" in | |
389 | *media=a4* | *media=iso_a4* | *PageSize=A4*) | |
390 | cat "$root/test/onepage-a4.ps" | |
391 | ;; | |
392 | *) | |
393 | cat "$root/test/onepage-letter.ps" | |
394 | ;; | |
395 | esac | |
396 | EOF | |
397 | chmod +x "/tmp/cups-$user/bin/filter/$dst" | |
398 | ;; | |
399 | raster) | |
400 | cat >"/tmp/cups-$user/bin/filter/$dst" <<EOF | |
401 | #!/bin/sh | |
402 | case "\$5" in | |
403 | *media=a4* | *media=iso_a4* | *PageSize=A4*) | |
404 | gunzip -c "$root/test/onepage-a4-300-black-1.pwg.gz" | |
405 | ;; | |
406 | *) | |
407 | gunzip -c "$root/test/onepage-letter-300-black-1.pwg.gz" | |
408 | ;; | |
409 | esac | |
410 | EOF | |
411 | chmod +x "/tmp/cups-$user/bin/filter/$dst" | |
412 | ;; | |
413 | esac | |
414 | } | |
415 | ||
416 | ln -s $root/test/test.convs /tmp/cups-$user/share/mime | |
417 | ||
bc44d920 | 418 | if test `uname` = Darwin; then |
79a784c4 MS |
419 | instfilter cgbannertopdf bannertopdf pdf |
420 | instfilter cgimagetopdf imagetopdf pdf | |
421 | instfilter cgpdftopdf pdftopdf passthru | |
422 | instfilter cgpdftops pdftops ps | |
423 | instfilter cgpdftoraster pdftoraster raster | |
424 | instfilter cgtexttopdf texttopdf pdf | |
425 | instfilter pstocupsraster pstoraster raster | |
426 | instfilter pstopdffilter pstopdf pdf | |
839a51c8 | 427 | else |
79a784c4 MS |
428 | instfilter bannertopdf bannertopdf pdf |
429 | instfilter bannertops bannertops ps | |
430 | instfilter imagetopdf imagetopdf pdf | |
431 | instfilter pdftopdf pdftopdf passthru | |
432 | instfilter pdftops pdftops ps | |
433 | instfilter pdftoraster pdftoraster raster | |
434 | instfilter pstoraster pstoraster raster | |
435 | instfilter texttopdf texttopdf pdf | |
436 | ||
437 | if test -d /usr/share/cups/charsets; then | |
438 | ln -s /usr/share/cups/charsets /tmp/cups-$user/share | |
5a9febac | 439 | fi |
bc44d920 | 440 | fi |
441 | ||
ef416fc2 | 442 | # |
443 | # Then create the necessary config files... | |
444 | # | |
445 | ||
a74454a7 | 446 | echo "Creating cupsd.conf for test..." |
447 | ||
ef416fc2 | 448 | if test $ssltype = 2; then |
449 | encryption="Encryption Required" | |
450 | else | |
451 | encryption="" | |
452 | fi | |
453 | ||
454 | cat >/tmp/cups-$user/cupsd.conf <<EOF | |
a29fd7dd | 455 | StrictConformance Yes |
ef416fc2 | 456 | Browsing Off |
a29fd7dd | 457 | Listen localhost:$port |
cb7f98ee | 458 | Listen /tmp/cups-$user/sock |
4509bb49 | 459 | PassEnv LOCALEDIR |
85dda01c | 460 | PassEnv DYLD_INSERT_LIBRARIES |
52f6f666 | 461 | MaxSubscriptions 3 |
ef416fc2 | 462 | MaxLogSize 0 |
e07d4801 | 463 | AccessLogLevel actions |
766a8229 | 464 | LogLevel $loglevel |
b9faaae1 | 465 | LogTimeFormat usecs |
ef416fc2 | 466 | PreserveJobHistory Yes |
db8b865d | 467 | PreserveJobFiles No |
ef416fc2 | 468 | <Policy default> |
469 | <Limit All> | |
a29fd7dd | 470 | Order Allow,Deny |
ef416fc2 | 471 | $encryption |
472 | </Limit> | |
473 | </Policy> | |
474 | EOF | |
475 | ||
c41769ff MS |
476 | cat >/tmp/cups-$user/cups-files.conf <<EOF |
477 | FileDevice yes | |
478 | Printcap | |
479 | User $user | |
480 | ServerRoot /tmp/cups-$user | |
481 | StateDir /tmp/cups-$user | |
482 | ServerBin /tmp/cups-$user/bin | |
483 | CacheDir /tmp/cups-$user/share | |
484 | DataDir /tmp/cups-$user/share | |
485 | FontPath /tmp/cups-$user/share/fonts | |
486 | DocumentRoot $root/doc | |
487 | RequestRoot /tmp/cups-$user/spool | |
488 | TempDir /tmp/cups-$user/spool/temp | |
489 | AccessLog /tmp/cups-$user/log/access_log | |
490 | ErrorLog /tmp/cups-$user/log/error_log | |
491 | PageLog /tmp/cups-$user/log/page_log | |
492 | EOF | |
493 | ||
c1420c87 MS |
494 | if test $ssltype != 0 -a `uname` = Darwin; then |
495 | echo "ServerCertificate $HOME/Library/Keychains/login.keychain" >> /tmp/cups-$user/cups-files.conf | |
496 | fi | |
497 | ||
ef416fc2 | 498 | # |
75bd9771 | 499 | # Setup lots of test queues - half with PPD files, half without... |
ef416fc2 | 500 | # |
501 | ||
a74454a7 | 502 | echo "Creating printers.conf for test..." |
503 | ||
ef416fc2 | 504 | i=1 |
505 | while test $i -le $nprinters1; do | |
506 | cat >>/tmp/cups-$user/printers.conf <<EOF | |
507 | <Printer test-$i> | |
508 | Accepting Yes | |
509 | DeviceURI file:/dev/null | |
510 | Info Test PS printer $i | |
511 | JobSheets none none | |
512 | Location CUPS test suite | |
513 | State Idle | |
514 | StateMessage Printer $1 is idle. | |
515 | </Printer> | |
516 | EOF | |
517 | ||
518 | cp testps.ppd /tmp/cups-$user/ppd/test-$i.ppd | |
519 | ||
520 | i=`expr $i + 1` | |
521 | done | |
522 | ||
523 | while test $i -le $nprinters2; do | |
524 | cat >>/tmp/cups-$user/printers.conf <<EOF | |
525 | <Printer test-$i> | |
526 | Accepting Yes | |
527 | DeviceURI file:/dev/null | |
528 | Info Test raw printer $i | |
529 | JobSheets none none | |
530 | Location CUPS test suite | |
531 | State Idle | |
532 | StateMessage Printer $1 is idle. | |
533 | </Printer> | |
534 | EOF | |
535 | ||
536 | i=`expr $i + 1` | |
537 | done | |
538 | ||
426c6a59 MS |
539 | if test -f /tmp/cups-$user/printers.conf; then |
540 | cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig | |
541 | else | |
542 | touch /tmp/cups-$user/printers.conf.orig | |
543 | fi | |
ef416fc2 | 544 | |
ef416fc2 | 545 | # |
546 | # Setup the paths... | |
547 | # | |
548 | ||
a74454a7 | 549 | echo "Setting up environment variables for test..." |
550 | ||
ef416fc2 | 551 | if test "x$LD_LIBRARY_PATH" = x; then |
82cc1f9a | 552 | LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" |
ef416fc2 | 553 | else |
82cc1f9a | 554 | LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$LD_LIBRARY_PATH" |
ef416fc2 | 555 | fi |
556 | ||
557 | export LD_LIBRARY_PATH | |
558 | ||
83e08001 | 559 | 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" |
f11a948a MS |
560 | if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then |
561 | LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD" | |
562 | fi | |
ef416fc2 | 563 | export LD_PRELOAD |
564 | ||
565 | if test "x$DYLD_LIBRARY_PATH" = x; then | |
82cc1f9a | 566 | DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" |
ef416fc2 | 567 | else |
82cc1f9a | 568 | DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$DYLD_LIBRARY_PATH" |
ef416fc2 | 569 | fi |
570 | ||
571 | export DYLD_LIBRARY_PATH | |
572 | ||
573 | if test "x$SHLIB_PATH" = x; then | |
82cc1f9a | 574 | SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" |
ef416fc2 | 575 | else |
82cc1f9a | 576 | SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$SHLIB_PATH" |
ef416fc2 | 577 | fi |
578 | ||
579 | export SHLIB_PATH | |
580 | ||
ef55b745 | 581 | CUPS_DISABLE_APPLE_DEFAULT=yes; export CUPS_DISABLE_APPLE_DEFAULT |
b19ccc9e | 582 | CUPS_SERVER=localhost:8631; export CUPS_SERVER |
ef416fc2 | 583 | CUPS_SERVERROOT=/tmp/cups-$user; export CUPS_SERVERROOT |
584 | CUPS_STATEDIR=/tmp/cups-$user; export CUPS_STATEDIR | |
585 | CUPS_DATADIR=/tmp/cups-$user/share; export CUPS_DATADIR | |
4509bb49 | 586 | LOCALEDIR=/tmp/cups-$user/share/locale; export LOCALEDIR |
ef416fc2 | 587 | |
588 | # | |
589 | # Set a new home directory to avoid getting user options mixed in... | |
590 | # | |
591 | ||
592 | HOME=/tmp/cups-$user | |
593 | export HOME | |
594 | ||
f42414bf | 595 | # |
596 | # Force POSIX locale for tests... | |
597 | # | |
598 | ||
599 | LANG=C | |
600 | export LANG | |
601 | ||
0268488e MS |
602 | LC_MESSAGES=C |
603 | export LC_MESSAGES | |
604 | ||
ef416fc2 | 605 | # |
606 | # Start the server; run as foreground daemon in the background... | |
607 | # | |
608 | ||
609 | echo "Starting scheduler:" | |
a2326b5b | 610 | echo " $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &" |
ef416fc2 | 611 | echo "" |
612 | ||
a2326b5b | 613 | if test `uname` = Darwin -a "x$VALGRIND" = x; then |
85dda01c MS |
614 | DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib |
615 | ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & | |
b9faaae1 | 616 | else |
a2326b5b | 617 | $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & |
b9faaae1 MS |
618 | fi |
619 | ||
ef416fc2 | 620 | cupsd=$! |
621 | ||
ef416fc2 | 622 | if test "x$testtype" = x0; then |
b19ccc9e | 623 | # Not running tests... |
ef416fc2 | 624 | echo "Scheduler is PID $cupsd and is listening on port 8631." |
625 | echo "" | |
b19ccc9e MS |
626 | |
627 | # Create a helper script to run programs with... | |
628 | runcups="/tmp/cups-$user/runcups" | |
629 | ||
630 | echo "#!/bin/sh" >$runcups | |
631 | echo "# Helper script for running CUPS test instance." >>$runcups | |
632 | echo "" >>$runcups | |
633 | echo "# Set required environment variables..." >>$runcups | |
634 | echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups | |
635 | echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups | |
636 | echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups | |
637 | echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups | |
638 | echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups | |
639 | echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups | |
640 | echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups | |
641 | echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups | |
642 | echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups | |
c41769ff MS |
643 | if test "x$CUPS_DEBUG_LEVEL" != x; then |
644 | echo "CUPS_DEBUG_FILTER='$CUPS_DEBUG_FILTER'; export CUPS_DEBUG_FILTER" >>$runcups | |
645 | echo "CUPS_DEBUG_LEVEL=$CUPS_DEBUG_LEVEL; export CUPS_DEBUG_LEVEL" >>$runcups | |
646 | echo "CUPS_DEBUG_LOG='$CUPS_DEBUG_LOG'; export CUPS_DEBUG_LOG" >>$runcups | |
647 | fi | |
b19ccc9e MS |
648 | echo "" >>$runcups |
649 | echo "# Run command..." >>$runcups | |
650 | echo "exec \"\$@\"" >>$runcups | |
651 | ||
652 | chmod +x $runcups | |
653 | ||
654 | echo "The $runcups helper script can be used to test programs" | |
655 | echo "with the server." | |
ef416fc2 | 656 | exit 0 |
657 | fi | |
658 | ||
a74454a7 | 659 | if test $argcount -eq 0; then |
660 | echo "Scheduler is PID $cupsd; run debugger now if you need to." | |
661 | echo "" | |
662 | echo $ac_n "Press ENTER to continue... $ac_c" | |
663 | read junk | |
664 | else | |
665 | echo "Scheduler is PID $cupsd." | |
666 | sleep 2 | |
667 | fi | |
ef416fc2 | 668 | |
669 | IPP_PORT=$port; export IPP_PORT | |
670 | ||
671 | while true; do | |
672 | running=`../systemv/lpstat -r 2>/dev/null` | |
673 | if test "x$running" = "xscheduler is running"; then | |
674 | break | |
675 | fi | |
676 | ||
677 | echo "Waiting for scheduler to become ready..." | |
678 | sleep 10 | |
679 | done | |
680 | ||
681 | # | |
682 | # Create the test report source file... | |
683 | # | |
684 | ||
dd1abb6b | 685 | date=`date "+%Y-%m-%d"` |
75c167a2 | 686 | strfile=/tmp/cups-$user/cups-str-2.0-$date-$user.html |
ef416fc2 | 687 | |
688 | rm -f $strfile | |
689 | cat str-header.html >$strfile | |
690 | ||
691 | # | |
692 | # Run the IPP tests... | |
693 | # | |
694 | ||
a74454a7 | 695 | echo "" |
ef416fc2 | 696 | echo "Running IPP compliance tests..." |
697 | ||
bd7854cb | 698 | echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile |
ef416fc2 | 699 | echo "<P>This section provides the results to the IPP compliance tests" >>$strfile |
700 | echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
e1d6a774 | 701 | echo `date "+%Y-%m-%d"` by $user on `hostname`. >>$strfile |
ef416fc2 | 702 | echo "<PRE>" >>$strfile |
703 | ||
704 | fail=0 | |
a29fd7dd | 705 | for file in 4*.test ipp-2.1.test; do |
a2326b5b | 706 | echo $ac_n "Performing $file: $ac_c" |
ef416fc2 | 707 | echo "" >>$strfile |
708 | ||
a29fd7dd MS |
709 | if test $file = ipp-2.1.test; then |
710 | uri="ipp://localhost:$port/printers/Test1" | |
711 | options="-V 2.1 -d NOPRINT=1 -f testfile.ps" | |
712 | else | |
713 | uri="ipp://localhost:$port/printers" | |
714 | options="" | |
715 | fi | |
716 | $VALGRIND ./ipptool -tI $options $uri $file >> $strfile | |
ef416fc2 | 717 | status=$? |
718 | ||
719 | if test $status != 0; then | |
a2326b5b | 720 | echo FAIL |
ef416fc2 | 721 | fail=`expr $fail + 1` |
a2326b5b MS |
722 | else |
723 | echo PASS | |
ef416fc2 | 724 | fi |
725 | done | |
726 | ||
727 | echo "</PRE>" >>$strfile | |
728 | ||
729 | # | |
730 | # Run the command tests... | |
731 | # | |
732 | ||
a74454a7 | 733 | echo "" |
ef416fc2 | 734 | echo "Running command tests..." |
735 | ||
bd7854cb | 736 | echo "<H1>2 - Command Tests</H1>" >>$strfile |
ef416fc2 | 737 | echo "<P>This section provides the results to the command tests" >>$strfile |
738 | echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
dd1abb6b | 739 | echo $date by $user on `hostname`. >>$strfile |
ef416fc2 | 740 | echo "<PRE>" >>$strfile |
741 | ||
742 | for file in 5*.sh; do | |
a2326b5b | 743 | echo $ac_n "Performing $file: $ac_c" |
ef416fc2 | 744 | echo "" >>$strfile |
745 | echo "\"$file\":" >>$strfile | |
746 | ||
a2326b5b | 747 | sh $file $pjobs $pprinters >> $strfile |
ef416fc2 | 748 | status=$? |
749 | ||
750 | if test $status != 0; then | |
a2326b5b | 751 | echo FAIL |
ef416fc2 | 752 | fail=`expr $fail + 1` |
a2326b5b MS |
753 | else |
754 | echo PASS | |
ef416fc2 | 755 | fi |
756 | done | |
757 | ||
758 | echo "</PRE>" >>$strfile | |
759 | ||
ef416fc2 | 760 | # |
761 | # Stop the server... | |
762 | # | |
763 | ||
764 | kill $cupsd | |
765 | ||
766 | # | |
767 | # Append the log files for post-mortim... | |
768 | # | |
769 | ||
bd7854cb | 770 | echo "<H1>3 - Log Files</H1>" >>$strfile |
ef416fc2 | 771 | |
839a51c8 MS |
772 | # |
773 | # Verify counts... | |
774 | # | |
775 | ||
776 | echo "Test Summary" | |
777 | echo "" | |
778 | echo "<H2>Summary</H2>" >>$strfile | |
779 | ||
ba55dc12 MS |
780 | # Job control files |
781 | count=`ls -1 /tmp/cups-$user/spool | wc -l` | |
782 | count=`expr $count - 1` | |
783 | if test $count != 0; then | |
784 | echo "FAIL: $count job control files were not purged." | |
785 | echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile | |
786 | fail=`expr $fail + 1` | |
787 | else | |
788 | echo "PASS: All job control files purged." | |
789 | echo "<P>PASS: All job control files purged.</P>" >>$strfile | |
790 | fi | |
791 | ||
7a14d768 | 792 | # Pages printed on Test1 (within 1 page for timing-dependent cancel issues) |
0268488e | 793 | count=`$GREP '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` |
969307f0 MS |
794 | expected=`expr $pjobs \* 2 + 34` |
795 | expected2=`expr $expected + 2` | |
796 | if test $count -lt $expected -a $count -gt $expected2; then | |
839a51c8 MS |
797 | echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected." |
798 | echo "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile | |
799 | fail=`expr $fail + 1` | |
800 | else | |
801 | echo "PASS: Printer 'Test1' correctly produced $count page(s)." | |
802 | echo "<P>PASS: Printer 'Test1' correctly produced $count page(s).</P>" >>$strfile | |
803 | fi | |
804 | ||
805 | # Paged printed on Test2 | |
0268488e | 806 | count=`$GREP '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` |
839a51c8 MS |
807 | expected=`expr $pjobs \* 2 + 3` |
808 | if test $count != $expected; then | |
809 | echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected." | |
810 | echo "<P>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</P>" >>$strfile | |
811 | fail=`expr $fail + 1` | |
812 | else | |
813 | echo "PASS: Printer 'Test2' correctly produced $count page(s)." | |
814 | echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile | |
815 | fi | |
816 | ||
a29fd7dd MS |
817 | # Paged printed on Test3 |
818 | count=`$GREP '^Test3 ' /tmp/cups-$user/log/page_log | grep -v total | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` | |
819 | expected=2 | |
820 | if test $count != $expected; then | |
821 | echo "FAIL: Printer 'Test3' produced $count page(s), expected $expected." | |
822 | echo "<P>FAIL: Printer 'Test3' produced $count page(s), expected $expected.</P>" >>$strfile | |
823 | fail=`expr $fail + 1` | |
824 | else | |
825 | echo "PASS: Printer 'Test3' correctly produced $count page(s)." | |
826 | echo "<P>PASS: Printer 'Test3' correctly produced $count page(s).</P>" >>$strfile | |
827 | fi | |
828 | ||
e07d4801 | 829 | # Requests logged |
839a51c8 | 830 | count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'` |
a29fd7dd | 831 | expected=`expr 37 + 18 + 28 + $pjobs \* 8 + $pprinters \* $pjobs \* 4` |
e07d4801 MS |
832 | if test $count != $expected; then |
833 | echo "FAIL: $count requests logged, expected $expected." | |
834 | echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile | |
835 | fail=`expr $fail + 1` | |
836 | else | |
837 | echo "PASS: $count requests logged." | |
838 | echo "<P>PASS: $count requests logged.</P>" >>$strfile | |
839 | fi | |
840 | ||
841 | # Did CUPS-Get-Default get logged? | |
0268488e | 842 | if $GREP -q CUPS-Get-Default /tmp/cups-$user/log/access_log; then |
e07d4801 MS |
843 | echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'" |
844 | echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile | |
845 | echo "<PRE>" >>$strfile | |
0268488e | 846 | $GREP CUPS-Get-Default /tmp/cups-$user/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
e07d4801 MS |
847 | echo "</PRE>" >>$strfile |
848 | fail=`expr $fail + 1` | |
849 | else | |
850 | echo "PASS: CUPS-Get-Default not logged." | |
851 | echo "<P>PASS: CUPS-Get-Default not logged.</P>" >>$strfile | |
852 | fi | |
839a51c8 MS |
853 | |
854 | # Emergency log messages | |
0268488e | 855 | count=`$GREP '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
856 | if test $count != 0; then |
857 | echo "FAIL: $count emergency messages, expected 0." | |
0268488e | 858 | $GREP '^X ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
859 | echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile |
860 | echo "<PRE>" >>$strfile | |
0268488e | 861 | $GREP '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
862 | echo "</PRE>" >>$strfile |
863 | fail=`expr $fail + 1` | |
864 | else | |
865 | echo "PASS: $count emergency messages." | |
866 | echo "<P>PASS: $count emergency messages.</P>" >>$strfile | |
867 | fi | |
868 | ||
869 | # Alert log messages | |
0268488e | 870 | count=`$GREP '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
871 | if test $count != 0; then |
872 | echo "FAIL: $count alert messages, expected 0." | |
0268488e | 873 | $GREP '^A ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
874 | echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile |
875 | echo "<PRE>" >>$strfile | |
0268488e | 876 | $GREP '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
877 | echo "</PRE>" >>$strfile |
878 | fail=`expr $fail + 1` | |
879 | else | |
880 | echo "PASS: $count alert messages." | |
881 | echo "<P>PASS: $count alert messages.</P>" >>$strfile | |
882 | fi | |
883 | ||
884 | # Critical log messages | |
0268488e | 885 | count=`$GREP '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
886 | if test $count != 0; then |
887 | echo "FAIL: $count critical messages, expected 0." | |
0268488e | 888 | $GREP '^C ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
889 | echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile |
890 | echo "<PRE>" >>$strfile | |
0268488e | 891 | $GREP '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
892 | echo "</PRE>" >>$strfile |
893 | fail=`expr $fail + 1` | |
894 | else | |
895 | echo "PASS: $count critical messages." | |
896 | echo "<P>PASS: $count critical messages.</P>" >>$strfile | |
897 | fi | |
898 | ||
899 | # Error log messages | |
0268488e | 900 | count=`$GREP '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
a29fd7dd MS |
901 | if test $count != 33; then |
902 | echo "FAIL: $count error messages, expected 33." | |
0268488e | 903 | $GREP '^E ' /tmp/cups-$user/log/error_log |
a29fd7dd | 904 | echo "<P>FAIL: $count error messages, expected 33.</P>" >>$strfile |
839a51c8 | 905 | echo "<PRE>" >>$strfile |
0268488e | 906 | $GREP '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
907 | echo "</PRE>" >>$strfile |
908 | fail=`expr $fail + 1` | |
909 | else | |
910 | echo "PASS: $count error messages." | |
911 | echo "<P>PASS: $count error messages.</P>" >>$strfile | |
912 | fi | |
913 | ||
914 | # Warning log messages | |
79a784c4 | 915 | count=`$GREP '^W ' /tmp/cups-$user/log/error_log | $GREP -v CreateProfile | wc -l | awk '{print $1}'` |
10d09e33 MS |
916 | if test $count != 9; then |
917 | echo "FAIL: $count warning messages, expected 9." | |
0268488e | 918 | $GREP '^W ' /tmp/cups-$user/log/error_log |
10d09e33 | 919 | echo "<P>FAIL: $count warning messages, expected 9.</P>" >>$strfile |
839a51c8 | 920 | echo "<PRE>" >>$strfile |
0268488e | 921 | $GREP '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
922 | echo "</PRE>" >>$strfile |
923 | fail=`expr $fail + 1` | |
924 | else | |
925 | echo "PASS: $count warning messages." | |
926 | echo "<P>PASS: $count warning messages.</P>" >>$strfile | |
927 | fi | |
928 | ||
929 | # Notice log messages | |
0268488e | 930 | count=`$GREP '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
931 | if test $count != 0; then |
932 | echo "FAIL: $count notice messages, expected 0." | |
0268488e | 933 | $GREP '^N ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
934 | echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile |
935 | echo "<PRE>" >>$strfile | |
0268488e | 936 | $GREP '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
937 | echo "</PRE>" >>$strfile |
938 | fail=`expr $fail + 1` | |
939 | else | |
940 | echo "PASS: $count notice messages." | |
941 | echo "<P>PASS: $count notice messages.</P>" >>$strfile | |
942 | fi | |
943 | ||
944 | # Info log messages | |
0268488e | 945 | count=`$GREP '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
946 | if test $count = 0; then |
947 | echo "FAIL: $count info messages, expected more than 0." | |
948 | echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile | |
949 | fail=`expr $fail + 1` | |
950 | else | |
951 | echo "PASS: $count info messages." | |
952 | echo "<P>PASS: $count info messages.</P>" >>$strfile | |
953 | fi | |
954 | ||
955 | # Debug log messages | |
0268488e | 956 | count=`$GREP '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
957 | if test $count = 0; then |
958 | echo "FAIL: $count debug messages, expected more than 0." | |
959 | echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile | |
960 | fail=`expr $fail + 1` | |
961 | else | |
962 | echo "PASS: $count debug messages." | |
963 | echo "<P>PASS: $count debug messages.</P>" >>$strfile | |
964 | fi | |
965 | ||
966 | # Debug2 log messages | |
0268488e | 967 | count=`$GREP '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
7a14d768 MS |
968 | if test $count = 0; then |
969 | echo "FAIL: $count debug2 messages, expected more than 0." | |
970 | echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile | |
839a51c8 MS |
971 | fail=`expr $fail + 1` |
972 | else | |
973 | echo "PASS: $count debug2 messages." | |
974 | echo "<P>PASS: $count debug2 messages.</P>" >>$strfile | |
975 | fi | |
976 | ||
977 | # Log files... | |
ef416fc2 | 978 | echo "<H2>access_log</H2>" >>$strfile |
979 | echo "<PRE>" >>$strfile | |
839a51c8 | 980 | sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/access_log >>$strfile |
ef416fc2 | 981 | echo "</PRE>" >>$strfile |
982 | ||
983 | echo "<H2>error_log</H2>" >>$strfile | |
984 | echo "<PRE>" >>$strfile | |
0268488e | 985 | $GREP -v '^d' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
ef416fc2 | 986 | echo "</PRE>" >>$strfile |
987 | ||
988 | echo "<H2>page_log</H2>" >>$strfile | |
989 | echo "<PRE>" >>$strfile | |
839a51c8 | 990 | sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/page_log >>$strfile |
ef416fc2 | 991 | echo "</PRE>" >>$strfile |
992 | ||
ef416fc2 | 993 | # |
994 | # Format the reports and tell the user where to find them... | |
995 | # | |
996 | ||
ef416fc2 | 997 | cat str-trailer.html >>$strfile |
998 | ||
ef416fc2 | 999 | echo "" |
1000 | ||
1001 | if test $fail != 0; then | |
1002 | echo "$fail tests failed." | |
dd1abb6b MS |
1003 | cp /tmp/cups-$user/log/error_log error_log-$date-$user |
1004 | cp $strfile . | |
ef416fc2 | 1005 | else |
1006 | echo "All tests were successful." | |
1007 | fi | |
1008 | ||
a74454a7 | 1009 | echo "Log files can be found in /tmp/cups-$user/log." |
839a51c8 | 1010 | echo "A HTML report was created in $strfile." |
ef416fc2 | 1011 | echo "" |
1012 | ||
db0bd74a | 1013 | if test $fail != 0; then |
dd1abb6b MS |
1014 | echo "Copies of the error_log and `basename $strfile` files are in" |
1015 | echo "`pwd`." | |
1016 | echo "" | |
1017 | ||
db0bd74a MS |
1018 | exit 1 |
1019 | fi | |
1020 | ||
ef416fc2 | 1021 | # |
79a784c4 | 1022 | # End of "$Id$" |
ef416fc2 | 1023 | # |