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