]>
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 | # |
afe94dff MS |
6 | # Copyright © 2007-2018 by Apple Inc. |
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 | ||
8fe0183a | 485 | cat >$BASE/cupsd.conf <<EOF |
a29fd7dd | 486 | StrictConformance Yes |
ef416fc2 | 487 | Browsing Off |
a29fd7dd | 488 | Listen localhost:$port |
8fe0183a | 489 | Listen $BASE/sock |
52f6f666 | 490 | MaxSubscriptions 3 |
ef416fc2 | 491 | MaxLogSize 0 |
e07d4801 | 492 | AccessLogLevel actions |
766a8229 | 493 | LogLevel $loglevel |
b9faaae1 | 494 | LogTimeFormat usecs |
ef416fc2 | 495 | PreserveJobHistory Yes |
237b42e9 | 496 | PreserveJobFiles 5m |
ef416fc2 | 497 | <Policy default> |
498 | <Limit All> | |
a29fd7dd | 499 | Order Allow,Deny |
ef416fc2 | 500 | $encryption |
501 | </Limit> | |
502 | </Policy> | |
503 | EOF | |
504 | ||
72d05bc9 | 505 | if test $testtype = 0; then |
8fe0183a | 506 | echo WebInterface yes >>$BASE/cupsd.conf |
72d05bc9 MS |
507 | fi |
508 | ||
8fe0183a | 509 | cat >$BASE/cups-files.conf <<EOF |
c41769ff MS |
510 | FileDevice yes |
511 | Printcap | |
512 | User $user | |
8fe0183a MS |
513 | ServerRoot $BASE |
514 | StateDir $BASE | |
515 | ServerBin $BASE/bin | |
516 | CacheDir $BASE/share | |
517 | DataDir $BASE/share | |
518 | FontPath $BASE/share/fonts | |
c41769ff | 519 | DocumentRoot $root/doc |
8fe0183a MS |
520 | RequestRoot $BASE/spool |
521 | TempDir $BASE/spool/temp | |
522 | AccessLog $BASE/log/access_log | |
523 | ErrorLog $BASE/log/error_log | |
524 | PageLog $BASE/log/page_log | |
97cb5665 MS |
525 | |
526 | PassEnv DYLD_LIBRARY_PATH | |
527 | PassEnv LD_LIBRARY_PATH | |
528 | PassEnv LD_PRELOAD | |
529 | PassEnv LOCALEDIR | |
530 | PassEnv SHLIB_PATH | |
c41769ff MS |
531 | EOF |
532 | ||
c1420c87 | 533 | if test $ssltype != 0 -a `uname` = Darwin; then |
8fe0183a | 534 | echo "ServerKeychain $HOME/Library/Keychains/login.keychain" >> $BASE/cups-files.conf |
c1420c87 MS |
535 | fi |
536 | ||
ef416fc2 | 537 | # |
a83658fa | 538 | # Setup lots of test queues with PPD files... |
ef416fc2 | 539 | # |
540 | ||
a74454a7 | 541 | echo "Creating printers.conf for test..." |
542 | ||
ef416fc2 | 543 | i=1 |
a83658fa | 544 | while test $i -le $nprinters; do |
8fe0183a | 545 | cat >>$BASE/printers.conf <<EOF |
ef416fc2 | 546 | <Printer test-$i> |
547 | Accepting Yes | |
548 | DeviceURI file:/dev/null | |
549 | Info Test PS printer $i | |
550 | JobSheets none none | |
551 | Location CUPS test suite | |
552 | State Idle | |
553 | StateMessage Printer $1 is idle. | |
554 | </Printer> | |
555 | EOF | |
556 | ||
8fe0183a | 557 | cp testps.ppd $BASE/ppd/test-$i.ppd |
ef416fc2 | 558 | |
559 | i=`expr $i + 1` | |
560 | done | |
561 | ||
8fe0183a MS |
562 | if test -f $BASE/printers.conf; then |
563 | cp $BASE/printers.conf $BASE/printers.conf.orig | |
426c6a59 | 564 | else |
8fe0183a | 565 | touch $BASE/printers.conf.orig |
426c6a59 | 566 | fi |
ef416fc2 | 567 | |
ef416fc2 | 568 | # |
569 | # Setup the paths... | |
570 | # | |
571 | ||
a74454a7 | 572 | echo "Setting up environment variables for test..." |
573 | ||
ef416fc2 | 574 | if test "x$LD_LIBRARY_PATH" = x; then |
82cc1f9a | 575 | LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" |
ef416fc2 | 576 | else |
82cc1f9a | 577 | LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$LD_LIBRARY_PATH" |
ef416fc2 | 578 | fi |
579 | ||
580 | export LD_LIBRARY_PATH | |
581 | ||
83e08001 | 582 | 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 |
583 | if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then |
584 | LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD" | |
585 | fi | |
ef416fc2 | 586 | export LD_PRELOAD |
587 | ||
7536de1a MS |
588 | if test -f $root/cups/libcups.2.dylib; then |
589 | if test "x$DYLD_INSERT_LIBRARIES" = x; then | |
590 | DYLD_INSERT_LIBRARIES="$root/cups/libcups.2.dylib:$root/filter/libcupsimage.2.dylib:$root/cgi-bin/libcupscgi.1.dylib:$root/scheduler/libcupsmime.1.dylib:$root/ppdc/libcupsppdc.1.dylib" | |
591 | else | |
592 | DYLD_INSERT_LIBRARIES="$root/cups/libcups.2.dylib:$root/filter/libcupsimage.2.dylib:$root/cgi-bin/libcupscgi.1.dylib:$root/scheduler/libcupsmime.1.dylib:$root/ppdc/libcupsppdc.1.dylib:$DYLD_INSERT_LIBRARIES" | |
593 | fi | |
594 | ||
595 | export DYLD_INSERT_LIBRARIES | |
596 | fi | |
597 | ||
ef416fc2 | 598 | if test "x$DYLD_LIBRARY_PATH" = x; then |
82cc1f9a | 599 | DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" |
ef416fc2 | 600 | else |
82cc1f9a | 601 | DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$DYLD_LIBRARY_PATH" |
ef416fc2 | 602 | fi |
603 | ||
604 | export DYLD_LIBRARY_PATH | |
605 | ||
606 | if test "x$SHLIB_PATH" = x; then | |
82cc1f9a | 607 | SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" |
ef416fc2 | 608 | else |
82cc1f9a | 609 | SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$SHLIB_PATH" |
ef416fc2 | 610 | fi |
611 | ||
612 | export SHLIB_PATH | |
613 | ||
ef55b745 | 614 | CUPS_DISABLE_APPLE_DEFAULT=yes; export CUPS_DISABLE_APPLE_DEFAULT |
95dd8876 | 615 | CUPS_SERVER=localhost:$port; export CUPS_SERVER |
8fe0183a MS |
616 | CUPS_SERVERROOT=$BASE; export CUPS_SERVERROOT |
617 | CUPS_STATEDIR=$BASE; export CUPS_STATEDIR | |
618 | CUPS_DATADIR=$BASE/share; export CUPS_DATADIR | |
619 | LOCALEDIR=$BASE/share/locale; export LOCALEDIR | |
ef416fc2 | 620 | |
621 | # | |
622 | # Set a new home directory to avoid getting user options mixed in... | |
623 | # | |
624 | ||
8fe0183a | 625 | HOME=$BASE |
ef416fc2 | 626 | export HOME |
627 | ||
f42414bf | 628 | # |
629 | # Force POSIX locale for tests... | |
630 | # | |
631 | ||
632 | LANG=C | |
633 | export LANG | |
634 | ||
0268488e MS |
635 | LC_MESSAGES=C |
636 | export LC_MESSAGES | |
637 | ||
ef416fc2 | 638 | # |
639 | # Start the server; run as foreground daemon in the background... | |
640 | # | |
641 | ||
642 | echo "Starting scheduler:" | |
8fe0183a | 643 | echo " $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &" |
ef416fc2 | 644 | echo "" |
645 | ||
a2326b5b | 646 | if test `uname` = Darwin -a "x$VALGRIND" = x; then |
7536de1a MS |
647 | if test "x$DYLD_INSERT_LIBRARIES" = x; then |
648 | insert="/usr/lib/libgmalloc.dylib" | |
649 | else | |
650 | insert="/usr/lib/libgmalloc.dylib:$DYLD_INSERT_LIBRARIES" | |
651 | fi | |
652 | ||
653 | DYLD_INSERT_LIBRARIES="$insert" MallocStackLogging=1 ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 & | |
b9faaae1 | 654 | else |
8fe0183a | 655 | $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 & |
b9faaae1 MS |
656 | fi |
657 | ||
ef416fc2 | 658 | cupsd=$! |
659 | ||
ef416fc2 | 660 | if test "x$testtype" = x0; then |
b19ccc9e | 661 | # Not running tests... |
6f260d7d | 662 | echo "Scheduler is PID $cupsd and is listening on port $port." |
ef416fc2 | 663 | echo "" |
b19ccc9e MS |
664 | |
665 | # Create a helper script to run programs with... | |
8fe0183a | 666 | runcups="$BASE/runcups" |
b19ccc9e MS |
667 | |
668 | echo "#!/bin/sh" >$runcups | |
669 | echo "# Helper script for running CUPS test instance." >>$runcups | |
670 | echo "" >>$runcups | |
671 | echo "# Set required environment variables..." >>$runcups | |
672 | echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups | |
673 | echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups | |
674 | echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups | |
675 | echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups | |
676 | echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups | |
677 | echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups | |
678 | echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups | |
679 | echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups | |
680 | echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups | |
c41769ff MS |
681 | if test "x$CUPS_DEBUG_LEVEL" != x; then |
682 | echo "CUPS_DEBUG_FILTER='$CUPS_DEBUG_FILTER'; export CUPS_DEBUG_FILTER" >>$runcups | |
683 | echo "CUPS_DEBUG_LEVEL=$CUPS_DEBUG_LEVEL; export CUPS_DEBUG_LEVEL" >>$runcups | |
684 | echo "CUPS_DEBUG_LOG='$CUPS_DEBUG_LOG'; export CUPS_DEBUG_LOG" >>$runcups | |
685 | fi | |
b19ccc9e MS |
686 | echo "" >>$runcups |
687 | echo "# Run command..." >>$runcups | |
688 | echo "exec \"\$@\"" >>$runcups | |
689 | ||
690 | chmod +x $runcups | |
691 | ||
692 | echo "The $runcups helper script can be used to test programs" | |
693 | echo "with the server." | |
ef416fc2 | 694 | exit 0 |
695 | fi | |
696 | ||
a74454a7 | 697 | if test $argcount -eq 0; then |
698 | echo "Scheduler is PID $cupsd; run debugger now if you need to." | |
699 | echo "" | |
700 | echo $ac_n "Press ENTER to continue... $ac_c" | |
701 | read junk | |
702 | else | |
703 | echo "Scheduler is PID $cupsd." | |
704 | sleep 2 | |
705 | fi | |
ef416fc2 | 706 | |
707 | IPP_PORT=$port; export IPP_PORT | |
708 | ||
709 | while true; do | |
710 | running=`../systemv/lpstat -r 2>/dev/null` | |
711 | if test "x$running" = "xscheduler is running"; then | |
712 | break | |
713 | fi | |
714 | ||
715 | echo "Waiting for scheduler to become ready..." | |
716 | sleep 10 | |
717 | done | |
718 | ||
719 | # | |
720 | # Create the test report source file... | |
721 | # | |
722 | ||
dd1abb6b | 723 | date=`date "+%Y-%m-%d"` |
6015e919 | 724 | |
35fc2243 | 725 | strfile=$BASE/cups-str-$date-$user.html |
ef416fc2 | 726 | |
727 | rm -f $strfile | |
728 | cat str-header.html >$strfile | |
729 | ||
730 | # | |
731 | # Run the IPP tests... | |
732 | # | |
733 | ||
a74454a7 | 734 | echo "" |
ef416fc2 | 735 | echo "Running IPP compliance tests..." |
736 | ||
35fc2243 MS |
737 | echo " <h1><a name='IPP'>1 - IPP Compliance Tests</a></h1>" >>$strfile |
738 | echo " <p>This section provides the results to the IPP compliance tests" >>$strfile | |
739 | echo " outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
740 | echo " $date by $user on `hostname`." >>$strfile | |
741 | echo " <pre>" >>$strfile | |
ef416fc2 | 742 | |
743 | fail=0 | |
a29fd7dd | 744 | for file in 4*.test ipp-2.1.test; do |
a2326b5b | 745 | echo $ac_n "Performing $file: $ac_c" |
ef416fc2 | 746 | echo "" >>$strfile |
747 | ||
a29fd7dd MS |
748 | if test $file = ipp-2.1.test; then |
749 | uri="ipp://localhost:$port/printers/Test1" | |
750 | options="-V 2.1 -d NOPRINT=1 -f testfile.ps" | |
751 | else | |
752 | uri="ipp://localhost:$port/printers" | |
753 | options="" | |
754 | fi | |
755 | $VALGRIND ./ipptool -tI $options $uri $file >> $strfile | |
ef416fc2 | 756 | status=$? |
757 | ||
758 | if test $status != 0; then | |
a2326b5b | 759 | echo FAIL |
ef416fc2 | 760 | fail=`expr $fail + 1` |
a2326b5b MS |
761 | else |
762 | echo PASS | |
ef416fc2 | 763 | fi |
764 | done | |
765 | ||
35fc2243 | 766 | echo " </pre>" >>$strfile |
ef416fc2 | 767 | |
768 | # | |
769 | # Run the command tests... | |
770 | # | |
771 | ||
a74454a7 | 772 | echo "" |
ef416fc2 | 773 | echo "Running command tests..." |
774 | ||
35fc2243 MS |
775 | echo " <h1><a name='COMMAND'>2 - Command Tests</a></h1>" >>$strfile |
776 | echo " <p>This section provides the results to the command tests" >>$strfile | |
777 | echo " outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
778 | echo " $date by $user on `hostname`." >>$strfile | |
779 | echo " <pre>" >>$strfile | |
ef416fc2 | 780 | |
781 | for file in 5*.sh; do | |
a2326b5b | 782 | echo $ac_n "Performing $file: $ac_c" |
ef416fc2 | 783 | echo "" >>$strfile |
784 | echo "\"$file\":" >>$strfile | |
785 | ||
a2326b5b | 786 | sh $file $pjobs $pprinters >> $strfile |
ef416fc2 | 787 | status=$? |
788 | ||
789 | if test $status != 0; then | |
a2326b5b | 790 | echo FAIL |
ef416fc2 | 791 | fail=`expr $fail + 1` |
a2326b5b MS |
792 | else |
793 | echo PASS | |
ef416fc2 | 794 | fi |
795 | done | |
796 | ||
8e8d3a71 MS |
797 | # |
798 | # Log all allocations made by the scheduler... | |
799 | # | |
35fc2243 | 800 | |
8e8d3a71 MS |
801 | if test `uname` = Darwin -a "x$VALGRIND" = x; then |
802 | malloc_history $cupsd -callTree -showContent >$BASE/log/malloc_log 2>&1 | |
803 | fi | |
804 | ||
698fa0aa MS |
805 | # |
806 | # Restart the server... | |
807 | # | |
808 | ||
809 | echo $ac_n "Performing restart test: $ac_c" | |
810 | echo "" >>$strfile | |
811 | echo "\"5.10-restart\":" >>$strfile | |
812 | ||
813 | kill -HUP $cupsd | |
814 | ||
815 | while true; do | |
8e8d3a71 MS |
816 | sleep 10 |
817 | ||
698fa0aa MS |
818 | running=`../systemv/lpstat -r 2>/dev/null` |
819 | if test "x$running" = "xscheduler is running"; then | |
820 | break | |
821 | fi | |
698fa0aa MS |
822 | done |
823 | ||
e0f0a3d5 | 824 | description="`../systemv/lpstat -l -p Test1 | grep Description | sed -e '1,$s/^[^:]*: //g'`" |
698fa0aa MS |
825 | if test "x$description" != "xTest Printer 1"; then |
826 | echo "Failed, printer-info for Test1 is '$description', expected 'Test Printer 1'." >>$strfile | |
827 | echo "FAIL (got '$description', expected 'Test Printer 1')" | |
828 | fail=`expr $fail + 1` | |
829 | else | |
830 | echo "Passed." >>$strfile | |
831 | echo PASS | |
832 | fi | |
833 | ||
35fc2243 | 834 | echo " </pre>" >>$strfile |
ef416fc2 | 835 | |
ef416fc2 | 836 | # |
837 | # Stop the server... | |
838 | # | |
839 | ||
840 | kill $cupsd | |
87f8ade3 MS |
841 | wait $cupsd |
842 | cupsdstatus=$? | |
ef416fc2 | 843 | |
839a51c8 MS |
844 | # |
845 | # Verify counts... | |
846 | # | |
847 | ||
848 | echo "Test Summary" | |
849 | echo "" | |
35fc2243 | 850 | echo " <h1><a name='SUMMARY'>3 - Test Summary</a></h1>" >>$strfile |
87f8ade3 MS |
851 | |
852 | if test $cupsdstatus != 0; then | |
853 | echo "FAIL: cupsd failed with exit status $cupsdstatus." | |
35fc2243 | 854 | echo " <p>FAIL: cupsd failed with exit status $cupsdstatus.</p>" >>$strfile |
87f8ade3 MS |
855 | fail=`expr $fail + 1` |
856 | else | |
857 | echo "PASS: cupsd exited with no errors." | |
35fc2243 | 858 | echo " <p>PASS: cupsd exited with no errors.</p>" >>$strfile |
87f8ade3 | 859 | fi |
839a51c8 | 860 | |
ba55dc12 | 861 | # Job control files |
8fe0183a | 862 | count=`ls -1 $BASE/spool | wc -l` |
ba55dc12 MS |
863 | count=`expr $count - 1` |
864 | if test $count != 0; then | |
865 | echo "FAIL: $count job control files were not purged." | |
35fc2243 | 866 | echo " <p>FAIL: $count job control files were not purged.</p>" >>$strfile |
ba55dc12 MS |
867 | fail=`expr $fail + 1` |
868 | else | |
869 | echo "PASS: All job control files purged." | |
35fc2243 | 870 | echo " <p>PASS: All job control files purged.</p>" >>$strfile |
ba55dc12 MS |
871 | fi |
872 | ||
7a14d768 | 873 | # Pages printed on Test1 (within 1 page for timing-dependent cancel issues) |
8fe0183a | 874 | count=`$GREP '^Test1 ' $BASE/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` |
969307f0 MS |
875 | expected=`expr $pjobs \* 2 + 34` |
876 | expected2=`expr $expected + 2` | |
877 | if test $count -lt $expected -a $count -gt $expected2; then | |
839a51c8 | 878 | echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected." |
35fc2243 | 879 | echo " <p>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</p>" >>$strfile |
839a51c8 MS |
880 | fail=`expr $fail + 1` |
881 | else | |
882 | echo "PASS: Printer 'Test1' correctly produced $count page(s)." | |
35fc2243 | 883 | echo " <p>PASS: Printer 'Test1' correctly produced $count page(s).</p>" >>$strfile |
839a51c8 MS |
884 | fi |
885 | ||
886 | # Paged printed on Test2 | |
8fe0183a | 887 | count=`$GREP '^Test2 ' $BASE/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` |
839a51c8 MS |
888 | expected=`expr $pjobs \* 2 + 3` |
889 | if test $count != $expected; then | |
890 | echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected." | |
35fc2243 | 891 | echo " <p>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</p>" >>$strfile |
839a51c8 MS |
892 | fail=`expr $fail + 1` |
893 | else | |
894 | echo "PASS: Printer 'Test2' correctly produced $count page(s)." | |
35fc2243 | 895 | echo " <p>PASS: Printer 'Test2' correctly produced $count page(s).</p>" >>$strfile |
839a51c8 MS |
896 | fi |
897 | ||
a29fd7dd | 898 | # Paged printed on Test3 |
afe94dff | 899 | count=`$GREP '^Test3 ' $BASE/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` |
6daeebb5 MS |
900 | expected=2 |
901 | if test $count -lt $expected; then | |
a29fd7dd | 902 | echo "FAIL: Printer 'Test3' produced $count page(s), expected $expected." |
35fc2243 | 903 | echo " <p>FAIL: Printer 'Test3' produced $count page(s), expected $expected.</p>" >>$strfile |
a29fd7dd MS |
904 | fail=`expr $fail + 1` |
905 | else | |
906 | echo "PASS: Printer 'Test3' correctly produced $count page(s)." | |
35fc2243 | 907 | echo " <p>PASS: Printer 'Test3' correctly produced $count page(s).</p>" >>$strfile |
a29fd7dd MS |
908 | fi |
909 | ||
e07d4801 | 910 | # Requests logged |
8fe0183a | 911 | count=`wc -l $BASE/log/access_log | awk '{print $1}'` |
a83658fa | 912 | expected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4` |
e07d4801 MS |
913 | if test $count != $expected; then |
914 | echo "FAIL: $count requests logged, expected $expected." | |
35fc2243 | 915 | echo " <p>FAIL: $count requests logged, expected $expected.</p>" >>$strfile |
e07d4801 MS |
916 | fail=`expr $fail + 1` |
917 | else | |
918 | echo "PASS: $count requests logged." | |
35fc2243 | 919 | echo " <p>PASS: $count requests logged.</p>" >>$strfile |
e07d4801 MS |
920 | fi |
921 | ||
922 | # Did CUPS-Get-Default get logged? | |
8fe0183a | 923 | if $GREP -q CUPS-Get-Default $BASE/log/access_log; then |
e07d4801 | 924 | echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'" |
35fc2243 MS |
925 | echo " <p>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</p>" >>$strfile |
926 | echo " <pre>" >>$strfile | |
8fe0183a | 927 | $GREP CUPS-Get-Default $BASE/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
35fc2243 | 928 | echo " </pre>" >>$strfile |
e07d4801 MS |
929 | fail=`expr $fail + 1` |
930 | else | |
931 | echo "PASS: CUPS-Get-Default not logged." | |
35fc2243 | 932 | echo " <p>PASS: CUPS-Get-Default not logged.</p>" >>$strfile |
e07d4801 | 933 | fi |
839a51c8 MS |
934 | |
935 | # Emergency log messages | |
8fe0183a | 936 | count=`$GREP '^X ' $BASE/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
937 | if test $count != 0; then |
938 | echo "FAIL: $count emergency messages, expected 0." | |
8fe0183a | 939 | $GREP '^X ' $BASE/log/error_log |
35fc2243 MS |
940 | echo " <p>FAIL: $count emergency messages, expected 0.</p>" >>$strfile |
941 | echo " <pre>" >>$strfile | |
8fe0183a | 942 | $GREP '^X ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
35fc2243 | 943 | echo " </pre>" >>$strfile |
839a51c8 MS |
944 | fail=`expr $fail + 1` |
945 | else | |
946 | echo "PASS: $count emergency messages." | |
35fc2243 | 947 | echo " <p>PASS: $count emergency messages.</p>" >>$strfile |
839a51c8 MS |
948 | fi |
949 | ||
950 | # Alert log messages | |
8fe0183a | 951 | count=`$GREP '^A ' $BASE/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
952 | if test $count != 0; then |
953 | echo "FAIL: $count alert messages, expected 0." | |
8fe0183a | 954 | $GREP '^A ' $BASE/log/error_log |
35fc2243 MS |
955 | echo " <p>FAIL: $count alert messages, expected 0.</p>" >>$strfile |
956 | echo " <pre>" >>$strfile | |
8fe0183a | 957 | $GREP '^A ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
35fc2243 | 958 | echo " </pre>" >>$strfile |
839a51c8 MS |
959 | fail=`expr $fail + 1` |
960 | else | |
961 | echo "PASS: $count alert messages." | |
35fc2243 | 962 | echo " <p>PASS: $count alert messages.</p>" >>$strfile |
839a51c8 MS |
963 | fi |
964 | ||
965 | # Critical log messages | |
8fe0183a | 966 | count=`$GREP '^C ' $BASE/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
967 | if test $count != 0; then |
968 | echo "FAIL: $count critical messages, expected 0." | |
8fe0183a | 969 | $GREP '^C ' $BASE/log/error_log |
35fc2243 MS |
970 | echo " <p>FAIL: $count critical messages, expected 0.</p>" >>$strfile |
971 | echo " <pre>" >>$strfile | |
8fe0183a | 972 | $GREP '^C ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
35fc2243 | 973 | echo " </pre>" >>$strfile |
839a51c8 MS |
974 | fail=`expr $fail + 1` |
975 | else | |
976 | echo "PASS: $count critical messages." | |
35fc2243 | 977 | echo " <p>PASS: $count critical messages.</p>" >>$strfile |
839a51c8 MS |
978 | fi |
979 | ||
980 | # Error log messages | |
97980490 | 981 | count=`$GREP '^E ' $BASE/log/error_log | $GREP -v 'Unknown default SystemGroup' | wc -l | awk '{print $1}'` |
a29fd7dd MS |
982 | if test $count != 33; then |
983 | echo "FAIL: $count error messages, expected 33." | |
8fe0183a | 984 | $GREP '^E ' $BASE/log/error_log |
35fc2243 MS |
985 | echo " <p>FAIL: $count error messages, expected 33.</p>" >>$strfile |
986 | echo " <pre>" >>$strfile | |
8fe0183a | 987 | $GREP '^E ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
35fc2243 | 988 | echo " </pre>" >>$strfile |
839a51c8 MS |
989 | fail=`expr $fail + 1` |
990 | else | |
991 | echo "PASS: $count error messages." | |
35fc2243 | 992 | echo " <p>PASS: $count error messages.</p>" >>$strfile |
839a51c8 MS |
993 | fi |
994 | ||
995 | # Warning log messages | |
8fe0183a | 996 | count=`$GREP '^W ' $BASE/log/error_log | $GREP -v CreateProfile | wc -l | awk '{print $1}'` |
3fc450cd | 997 | if test $count != 8; then |
ea99768e | 998 | echo "FAIL: $count warning messages, expected 8." |
8fe0183a | 999 | $GREP '^W ' $BASE/log/error_log |
35fc2243 MS |
1000 | echo " <p>FAIL: $count warning messages, expected 8.</p>" >>$strfile |
1001 | echo " <pre>" >>$strfile | |
8fe0183a | 1002 | $GREP '^W ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
35fc2243 | 1003 | echo " </pre>" >>$strfile |
839a51c8 MS |
1004 | fail=`expr $fail + 1` |
1005 | else | |
1006 | echo "PASS: $count warning messages." | |
35fc2243 | 1007 | echo " <p>PASS: $count warning messages.</p>" >>$strfile |
839a51c8 MS |
1008 | fi |
1009 | ||
1010 | # Notice log messages | |
8fe0183a | 1011 | count=`$GREP '^N ' $BASE/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
1012 | if test $count != 0; then |
1013 | echo "FAIL: $count notice messages, expected 0." | |
8fe0183a | 1014 | $GREP '^N ' $BASE/log/error_log |
35fc2243 MS |
1015 | echo " <p>FAIL: $count notice messages, expected 0.</p>" >>$strfile |
1016 | echo " <pre>" >>$strfile | |
8fe0183a | 1017 | $GREP '^N ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
35fc2243 | 1018 | echo " </pre>" >>$strfile |
839a51c8 MS |
1019 | fail=`expr $fail + 1` |
1020 | else | |
1021 | echo "PASS: $count notice messages." | |
35fc2243 | 1022 | echo " <p>PASS: $count notice messages.</p>" >>$strfile |
839a51c8 MS |
1023 | fi |
1024 | ||
1025 | # Info log messages | |
8fe0183a | 1026 | count=`$GREP '^I ' $BASE/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
1027 | if test $count = 0; then |
1028 | echo "FAIL: $count info messages, expected more than 0." | |
35fc2243 | 1029 | echo " <p>FAIL: $count info messages, expected more than 0.</p>" >>$strfile |
839a51c8 MS |
1030 | fail=`expr $fail + 1` |
1031 | else | |
1032 | echo "PASS: $count info messages." | |
35fc2243 | 1033 | echo " <p>PASS: $count info messages.</p>" >>$strfile |
839a51c8 MS |
1034 | fi |
1035 | ||
1036 | # Debug log messages | |
8fe0183a | 1037 | count=`$GREP '^D ' $BASE/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
1038 | if test $count = 0; then |
1039 | echo "FAIL: $count debug messages, expected more than 0." | |
35fc2243 | 1040 | echo " <p>FAIL: $count debug messages, expected more than 0.</p>" >>$strfile |
839a51c8 MS |
1041 | fail=`expr $fail + 1` |
1042 | else | |
1043 | echo "PASS: $count debug messages." | |
35fc2243 | 1044 | echo " <p>PASS: $count debug messages.</p>" >>$strfile |
839a51c8 MS |
1045 | fi |
1046 | ||
1047 | # Debug2 log messages | |
8fe0183a | 1048 | count=`$GREP '^d ' $BASE/log/error_log | wc -l | awk '{print $1}'` |
7a14d768 MS |
1049 | if test $count = 0; then |
1050 | echo "FAIL: $count debug2 messages, expected more than 0." | |
35fc2243 | 1051 | echo " <p>FAIL: $count debug2 messages, expected more than 0.</p>" >>$strfile |
839a51c8 MS |
1052 | fail=`expr $fail + 1` |
1053 | else | |
1054 | echo "PASS: $count debug2 messages." | |
35fc2243 | 1055 | echo " <p>PASS: $count debug2 messages.</p>" >>$strfile |
839a51c8 MS |
1056 | fi |
1057 | ||
87f8ade3 | 1058 | # |
839a51c8 | 1059 | # Log files... |
87f8ade3 MS |
1060 | # |
1061 | ||
35fc2243 MS |
1062 | echo " <h1><a name='LOGS'>4 - Log Files</a></h1>" >>$strfile |
1063 | ||
1064 | for file in $BASE/log/*_log; do | |
1065 | baselog=`basename $file` | |
1066 | ||
1067 | echo " <h2><a name=\"$baselog\">$baselog</a></h2>" >>$strfile | |
1068 | case $baselog in | |
1069 | error_log) | |
1070 | echo " <blockquote>Note: debug2 messages have been filtered out of the HTML report.</blockquote>" >>$strfile | |
1071 | echo " <pre>" >>$strfile | |
1072 | $GREP -v '^d' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile | |
1073 | echo " </pre>" >>$strfile | |
1074 | ;; | |
1075 | ||
1076 | *) | |
1077 | echo " <pre>" >>$strfile | |
1078 | sed -e '1,$s/&/&/g' -e '1,$s/</</g' $file >>$strfile | |
1079 | echo " </pre>" >>$strfile | |
1080 | ;; | |
1081 | esac | |
1082 | done | |
ef416fc2 | 1083 | |
ef416fc2 | 1084 | # |
1085 | # Format the reports and tell the user where to find them... | |
1086 | # | |
1087 | ||
ef416fc2 | 1088 | cat str-trailer.html >>$strfile |
1089 | ||
ef416fc2 | 1090 | echo "" |
d2f1a784 MS |
1091 | for file in $BASE/log/*_log; do |
1092 | baselog=`basename $file` | |
1093 | cp $file $baselog-$date-$user | |
1094 | echo "Copied log file \"$baselog-$date-$user\" to test directory." | |
1095 | done | |
1096 | cp $strfile . | |
1097 | echo "Copied report file \"cups-str-$date-$user.html\" to test directory." | |
ef416fc2 | 1098 | |
d2f1a784 | 1099 | # Clean out old failure log files after 1 week... |
ae7225e5 MS |
1100 | find . -name \*_log-\*-$user -a -mtime +7 -print -exec rm -f '{}' \; | awk '{print "Removed old log file \"" substr($1,3) "\" from test directory."}' |
1101 | find . -name cups-str-\*-$user.html -a -mtime +7 -print -exec rm -f '{}' \; | awk '{print "Removed old report file \"" $1 "\" from test directory."}' | |
ef416fc2 | 1102 | |
d2f1a784 | 1103 | echo "" |
dd1abb6b | 1104 | |
d2f1a784 MS |
1105 | if test $fail != 0; then |
1106 | echo "$fail tests failed." | |
db0bd74a | 1107 | exit 1 |
35fc2243 MS |
1108 | else |
1109 | echo "All tests were successful." | |
db0bd74a | 1110 | fi |