]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | #!/bin/sh |
2 | # | |
a480a1b6 | 3 | # "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $" |
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 | ||
349 | if test `uname` = Darwin; then | |
350 | ln -s /usr/libexec/cups/filter/cgpdfto* /tmp/cups-$user/bin/filter | |
f0ab5bff MS |
351 | ln -s /usr/libexec/cups/filter/cgbannertopdf /tmp/cups-$user/bin/filter |
352 | ln -s /usr/libexec/cups/filter/cgimagetopdf /tmp/cups-$user/bin/filter | |
353 | ln -s /usr/libexec/cups/filter/cgtexttopdf /tmp/cups-$user/bin/filter | |
bc44d920 | 354 | ln -s /usr/libexec/cups/filter/nsimagetopdf /tmp/cups-$user/bin/filter |
355 | ln -s /usr/libexec/cups/filter/nstexttopdf /tmp/cups-$user/bin/filter | |
356 | ln -s /usr/libexec/cups/filter/pictwpstops /tmp/cups-$user/bin/filter | |
357 | ln -s /usr/libexec/cups/filter/pstoappleps /tmp/cups-$user/bin/filter | |
358 | ln -s /usr/libexec/cups/filter/pstocupsraster /tmp/cups-$user/bin/filter | |
359 | ln -s /usr/libexec/cups/filter/pstopdffilter /tmp/cups-$user/bin/filter | |
eac3a0a0 MS |
360 | ln -s /usr/libexec/cups/filter/rastertourf /tmp/cups-$user/bin/filter |
361 | ln -s /usr/libexec/cups/filter/xhtmltopdf /tmp/cups-$user/bin/filter | |
bc44d920 | 362 | |
4509bb49 MS |
363 | if test -f /private/etc/cups/apple.types; then |
364 | ln -s /private/etc/cups/apple.* /tmp/cups-$user/share/mime | |
365 | elif test -f /usr/share/cups/mime/apple.types; then | |
366 | ln -s /usr/share/cups/mime/apple.* /tmp/cups-$user/share/mime | |
367 | fi | |
839a51c8 | 368 | else |
a4845881 MS |
369 | ln -s /usr/lib/cups/filter/bannertops /tmp/cups-$user/bin/filter |
370 | ln -s /usr/lib/cups/filter/imagetops /tmp/cups-$user/bin/filter | |
371 | ln -s /usr/lib/cups/filter/imagetoraster /tmp/cups-$user/bin/filter | |
372 | ln -s /usr/lib/cups/filter/pdftops /tmp/cups-$user/bin/filter | |
373 | ln -s /usr/lib/cups/filter/texttops /tmp/cups-$user/bin/filter | |
374 | ||
375 | ln -s /usr/share/cups/mime/legacy.convs /tmp/cups-$user/share/mime | |
5a9febac MS |
376 | ln -s /usr/share/cups/charsets /tmp/cups-$user/share |
377 | if test -f $root/data/psglyphs; then | |
378 | ln -s /usr/share/cups/data/psglyphs $root/data | |
379 | fi | |
380 | ln -s /usr/share/cups/fonts /tmp/cups-$user/share | |
bc44d920 | 381 | fi |
382 | ||
ef416fc2 | 383 | # |
384 | # Then create the necessary config files... | |
385 | # | |
386 | ||
a74454a7 | 387 | echo "Creating cupsd.conf for test..." |
388 | ||
ef416fc2 | 389 | if test $ssltype = 2; then |
390 | encryption="Encryption Required" | |
391 | else | |
392 | encryption="" | |
393 | fi | |
394 | ||
395 | cat >/tmp/cups-$user/cupsd.conf <<EOF | |
a29fd7dd | 396 | StrictConformance Yes |
ef416fc2 | 397 | Browsing Off |
a29fd7dd | 398 | Listen localhost:$port |
cb7f98ee | 399 | Listen /tmp/cups-$user/sock |
4509bb49 | 400 | PassEnv LOCALEDIR |
85dda01c | 401 | PassEnv DYLD_INSERT_LIBRARIES |
52f6f666 | 402 | MaxSubscriptions 3 |
ef416fc2 | 403 | MaxLogSize 0 |
e07d4801 | 404 | AccessLogLevel actions |
766a8229 | 405 | LogLevel $loglevel |
b9faaae1 | 406 | LogTimeFormat usecs |
ef416fc2 | 407 | PreserveJobHistory Yes |
db8b865d | 408 | PreserveJobFiles No |
ef416fc2 | 409 | <Policy default> |
410 | <Limit All> | |
a29fd7dd | 411 | Order Allow,Deny |
ef416fc2 | 412 | $encryption |
413 | </Limit> | |
414 | </Policy> | |
415 | EOF | |
416 | ||
c41769ff MS |
417 | cat >/tmp/cups-$user/cups-files.conf <<EOF |
418 | FileDevice yes | |
419 | Printcap | |
420 | User $user | |
421 | ServerRoot /tmp/cups-$user | |
422 | StateDir /tmp/cups-$user | |
423 | ServerBin /tmp/cups-$user/bin | |
424 | CacheDir /tmp/cups-$user/share | |
425 | DataDir /tmp/cups-$user/share | |
426 | FontPath /tmp/cups-$user/share/fonts | |
427 | DocumentRoot $root/doc | |
428 | RequestRoot /tmp/cups-$user/spool | |
429 | TempDir /tmp/cups-$user/spool/temp | |
430 | AccessLog /tmp/cups-$user/log/access_log | |
431 | ErrorLog /tmp/cups-$user/log/error_log | |
432 | PageLog /tmp/cups-$user/log/page_log | |
433 | EOF | |
434 | ||
c1420c87 MS |
435 | if test $ssltype != 0 -a `uname` = Darwin; then |
436 | echo "ServerCertificate $HOME/Library/Keychains/login.keychain" >> /tmp/cups-$user/cups-files.conf | |
437 | fi | |
438 | ||
ef416fc2 | 439 | # |
75bd9771 | 440 | # Setup lots of test queues - half with PPD files, half without... |
ef416fc2 | 441 | # |
442 | ||
a74454a7 | 443 | echo "Creating printers.conf for test..." |
444 | ||
ef416fc2 | 445 | i=1 |
446 | while test $i -le $nprinters1; do | |
447 | cat >>/tmp/cups-$user/printers.conf <<EOF | |
448 | <Printer test-$i> | |
449 | Accepting Yes | |
450 | DeviceURI file:/dev/null | |
451 | Info Test PS printer $i | |
452 | JobSheets none none | |
453 | Location CUPS test suite | |
454 | State Idle | |
455 | StateMessage Printer $1 is idle. | |
456 | </Printer> | |
457 | EOF | |
458 | ||
459 | cp testps.ppd /tmp/cups-$user/ppd/test-$i.ppd | |
460 | ||
461 | i=`expr $i + 1` | |
462 | done | |
463 | ||
464 | while test $i -le $nprinters2; do | |
465 | cat >>/tmp/cups-$user/printers.conf <<EOF | |
466 | <Printer test-$i> | |
467 | Accepting Yes | |
468 | DeviceURI file:/dev/null | |
469 | Info Test raw printer $i | |
470 | JobSheets none none | |
471 | Location CUPS test suite | |
472 | State Idle | |
473 | StateMessage Printer $1 is idle. | |
474 | </Printer> | |
475 | EOF | |
476 | ||
477 | i=`expr $i + 1` | |
478 | done | |
479 | ||
426c6a59 MS |
480 | if test -f /tmp/cups-$user/printers.conf; then |
481 | cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig | |
482 | else | |
483 | touch /tmp/cups-$user/printers.conf.orig | |
484 | fi | |
ef416fc2 | 485 | |
ef416fc2 | 486 | # |
487 | # Setup the paths... | |
488 | # | |
489 | ||
a74454a7 | 490 | echo "Setting up environment variables for test..." |
491 | ||
ef416fc2 | 492 | if test "x$LD_LIBRARY_PATH" = x; then |
82cc1f9a | 493 | LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" |
ef416fc2 | 494 | else |
82cc1f9a | 495 | LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$LD_LIBRARY_PATH" |
ef416fc2 | 496 | fi |
497 | ||
498 | export LD_LIBRARY_PATH | |
499 | ||
83e08001 | 500 | 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 |
501 | if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then |
502 | LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD" | |
503 | fi | |
ef416fc2 | 504 | export LD_PRELOAD |
505 | ||
506 | if test "x$DYLD_LIBRARY_PATH" = x; then | |
82cc1f9a | 507 | DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" |
ef416fc2 | 508 | else |
82cc1f9a | 509 | DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$DYLD_LIBRARY_PATH" |
ef416fc2 | 510 | fi |
511 | ||
512 | export DYLD_LIBRARY_PATH | |
513 | ||
514 | if test "x$SHLIB_PATH" = x; then | |
82cc1f9a | 515 | SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" |
ef416fc2 | 516 | else |
82cc1f9a | 517 | SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$SHLIB_PATH" |
ef416fc2 | 518 | fi |
519 | ||
520 | export SHLIB_PATH | |
521 | ||
ef55b745 | 522 | CUPS_DISABLE_APPLE_DEFAULT=yes; export CUPS_DISABLE_APPLE_DEFAULT |
b19ccc9e | 523 | CUPS_SERVER=localhost:8631; export CUPS_SERVER |
ef416fc2 | 524 | CUPS_SERVERROOT=/tmp/cups-$user; export CUPS_SERVERROOT |
525 | CUPS_STATEDIR=/tmp/cups-$user; export CUPS_STATEDIR | |
526 | CUPS_DATADIR=/tmp/cups-$user/share; export CUPS_DATADIR | |
4509bb49 | 527 | LOCALEDIR=/tmp/cups-$user/share/locale; export LOCALEDIR |
ef416fc2 | 528 | |
529 | # | |
530 | # Set a new home directory to avoid getting user options mixed in... | |
531 | # | |
532 | ||
533 | HOME=/tmp/cups-$user | |
534 | export HOME | |
535 | ||
f42414bf | 536 | # |
537 | # Force POSIX locale for tests... | |
538 | # | |
539 | ||
540 | LANG=C | |
541 | export LANG | |
542 | ||
0268488e MS |
543 | LC_MESSAGES=C |
544 | export LC_MESSAGES | |
545 | ||
ef416fc2 | 546 | # |
547 | # Start the server; run as foreground daemon in the background... | |
548 | # | |
549 | ||
550 | echo "Starting scheduler:" | |
a2326b5b | 551 | echo " $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &" |
ef416fc2 | 552 | echo "" |
553 | ||
a2326b5b | 554 | if test `uname` = Darwin -a "x$VALGRIND" = x; then |
85dda01c MS |
555 | DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib |
556 | ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & | |
b9faaae1 | 557 | else |
a2326b5b | 558 | $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & |
b9faaae1 MS |
559 | fi |
560 | ||
ef416fc2 | 561 | cupsd=$! |
562 | ||
ef416fc2 | 563 | if test "x$testtype" = x0; then |
b19ccc9e | 564 | # Not running tests... |
ef416fc2 | 565 | echo "Scheduler is PID $cupsd and is listening on port 8631." |
566 | echo "" | |
b19ccc9e MS |
567 | |
568 | # Create a helper script to run programs with... | |
569 | runcups="/tmp/cups-$user/runcups" | |
570 | ||
571 | echo "#!/bin/sh" >$runcups | |
572 | echo "# Helper script for running CUPS test instance." >>$runcups | |
573 | echo "" >>$runcups | |
574 | echo "# Set required environment variables..." >>$runcups | |
575 | echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups | |
576 | echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups | |
577 | echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups | |
578 | echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups | |
579 | echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups | |
580 | echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups | |
581 | echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups | |
582 | echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups | |
583 | echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups | |
c41769ff MS |
584 | if test "x$CUPS_DEBUG_LEVEL" != x; then |
585 | echo "CUPS_DEBUG_FILTER='$CUPS_DEBUG_FILTER'; export CUPS_DEBUG_FILTER" >>$runcups | |
586 | echo "CUPS_DEBUG_LEVEL=$CUPS_DEBUG_LEVEL; export CUPS_DEBUG_LEVEL" >>$runcups | |
587 | echo "CUPS_DEBUG_LOG='$CUPS_DEBUG_LOG'; export CUPS_DEBUG_LOG" >>$runcups | |
588 | fi | |
b19ccc9e MS |
589 | echo "" >>$runcups |
590 | echo "# Run command..." >>$runcups | |
591 | echo "exec \"\$@\"" >>$runcups | |
592 | ||
593 | chmod +x $runcups | |
594 | ||
595 | echo "The $runcups helper script can be used to test programs" | |
596 | echo "with the server." | |
ef416fc2 | 597 | exit 0 |
598 | fi | |
599 | ||
a74454a7 | 600 | if test $argcount -eq 0; then |
601 | echo "Scheduler is PID $cupsd; run debugger now if you need to." | |
602 | echo "" | |
603 | echo $ac_n "Press ENTER to continue... $ac_c" | |
604 | read junk | |
605 | else | |
606 | echo "Scheduler is PID $cupsd." | |
607 | sleep 2 | |
608 | fi | |
ef416fc2 | 609 | |
610 | IPP_PORT=$port; export IPP_PORT | |
611 | ||
612 | while true; do | |
613 | running=`../systemv/lpstat -r 2>/dev/null` | |
614 | if test "x$running" = "xscheduler is running"; then | |
615 | break | |
616 | fi | |
617 | ||
618 | echo "Waiting for scheduler to become ready..." | |
619 | sleep 10 | |
620 | done | |
621 | ||
622 | # | |
623 | # Create the test report source file... | |
624 | # | |
625 | ||
dd1abb6b | 626 | date=`date "+%Y-%m-%d"` |
75c167a2 | 627 | strfile=/tmp/cups-$user/cups-str-2.0-$date-$user.html |
ef416fc2 | 628 | |
629 | rm -f $strfile | |
630 | cat str-header.html >$strfile | |
631 | ||
632 | # | |
633 | # Run the IPP tests... | |
634 | # | |
635 | ||
a74454a7 | 636 | echo "" |
ef416fc2 | 637 | echo "Running IPP compliance tests..." |
638 | ||
bd7854cb | 639 | echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile |
ef416fc2 | 640 | echo "<P>This section provides the results to the IPP compliance tests" >>$strfile |
641 | echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
e1d6a774 | 642 | echo `date "+%Y-%m-%d"` by $user on `hostname`. >>$strfile |
ef416fc2 | 643 | echo "<PRE>" >>$strfile |
644 | ||
645 | fail=0 | |
a29fd7dd | 646 | for file in 4*.test ipp-2.1.test; do |
a2326b5b | 647 | echo $ac_n "Performing $file: $ac_c" |
ef416fc2 | 648 | echo "" >>$strfile |
649 | ||
a29fd7dd MS |
650 | if test $file = ipp-2.1.test; then |
651 | uri="ipp://localhost:$port/printers/Test1" | |
652 | options="-V 2.1 -d NOPRINT=1 -f testfile.ps" | |
653 | else | |
654 | uri="ipp://localhost:$port/printers" | |
655 | options="" | |
656 | fi | |
657 | $VALGRIND ./ipptool -tI $options $uri $file >> $strfile | |
ef416fc2 | 658 | status=$? |
659 | ||
660 | if test $status != 0; then | |
a2326b5b | 661 | echo FAIL |
ef416fc2 | 662 | fail=`expr $fail + 1` |
a2326b5b MS |
663 | else |
664 | echo PASS | |
ef416fc2 | 665 | fi |
666 | done | |
667 | ||
668 | echo "</PRE>" >>$strfile | |
669 | ||
670 | # | |
671 | # Run the command tests... | |
672 | # | |
673 | ||
a74454a7 | 674 | echo "" |
ef416fc2 | 675 | echo "Running command tests..." |
676 | ||
bd7854cb | 677 | echo "<H1>2 - Command Tests</H1>" >>$strfile |
ef416fc2 | 678 | echo "<P>This section provides the results to the command tests" >>$strfile |
679 | echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
dd1abb6b | 680 | echo $date by $user on `hostname`. >>$strfile |
ef416fc2 | 681 | echo "<PRE>" >>$strfile |
682 | ||
683 | for file in 5*.sh; do | |
a2326b5b | 684 | echo $ac_n "Performing $file: $ac_c" |
ef416fc2 | 685 | echo "" >>$strfile |
686 | echo "\"$file\":" >>$strfile | |
687 | ||
a2326b5b | 688 | sh $file $pjobs $pprinters >> $strfile |
ef416fc2 | 689 | status=$? |
690 | ||
691 | if test $status != 0; then | |
a2326b5b | 692 | echo FAIL |
ef416fc2 | 693 | fail=`expr $fail + 1` |
a2326b5b MS |
694 | else |
695 | echo PASS | |
ef416fc2 | 696 | fi |
697 | done | |
698 | ||
699 | echo "</PRE>" >>$strfile | |
700 | ||
ef416fc2 | 701 | # |
702 | # Stop the server... | |
703 | # | |
704 | ||
705 | kill $cupsd | |
706 | ||
707 | # | |
708 | # Append the log files for post-mortim... | |
709 | # | |
710 | ||
bd7854cb | 711 | echo "<H1>3 - Log Files</H1>" >>$strfile |
ef416fc2 | 712 | |
839a51c8 MS |
713 | # |
714 | # Verify counts... | |
715 | # | |
716 | ||
717 | echo "Test Summary" | |
718 | echo "" | |
719 | echo "<H2>Summary</H2>" >>$strfile | |
720 | ||
ba55dc12 MS |
721 | # Job control files |
722 | count=`ls -1 /tmp/cups-$user/spool | wc -l` | |
723 | count=`expr $count - 1` | |
724 | if test $count != 0; then | |
725 | echo "FAIL: $count job control files were not purged." | |
726 | echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile | |
727 | fail=`expr $fail + 1` | |
728 | else | |
729 | echo "PASS: All job control files purged." | |
730 | echo "<P>PASS: All job control files purged.</P>" >>$strfile | |
731 | fi | |
732 | ||
7a14d768 | 733 | # Pages printed on Test1 (within 1 page for timing-dependent cancel issues) |
0268488e | 734 | count=`$GREP '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` |
969307f0 MS |
735 | expected=`expr $pjobs \* 2 + 34` |
736 | expected2=`expr $expected + 2` | |
737 | if test $count -lt $expected -a $count -gt $expected2; then | |
839a51c8 MS |
738 | echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected." |
739 | echo "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile | |
740 | fail=`expr $fail + 1` | |
741 | else | |
742 | echo "PASS: Printer 'Test1' correctly produced $count page(s)." | |
743 | echo "<P>PASS: Printer 'Test1' correctly produced $count page(s).</P>" >>$strfile | |
744 | fi | |
745 | ||
746 | # Paged printed on Test2 | |
0268488e | 747 | count=`$GREP '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` |
839a51c8 MS |
748 | expected=`expr $pjobs \* 2 + 3` |
749 | if test $count != $expected; then | |
750 | echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected." | |
751 | echo "<P>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</P>" >>$strfile | |
752 | fail=`expr $fail + 1` | |
753 | else | |
754 | echo "PASS: Printer 'Test2' correctly produced $count page(s)." | |
755 | echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile | |
756 | fi | |
757 | ||
a29fd7dd MS |
758 | # Paged printed on Test3 |
759 | count=`$GREP '^Test3 ' /tmp/cups-$user/log/page_log | grep -v total | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` | |
760 | expected=2 | |
761 | if test $count != $expected; then | |
762 | echo "FAIL: Printer 'Test3' produced $count page(s), expected $expected." | |
763 | echo "<P>FAIL: Printer 'Test3' produced $count page(s), expected $expected.</P>" >>$strfile | |
764 | fail=`expr $fail + 1` | |
765 | else | |
766 | echo "PASS: Printer 'Test3' correctly produced $count page(s)." | |
767 | echo "<P>PASS: Printer 'Test3' correctly produced $count page(s).</P>" >>$strfile | |
768 | fi | |
769 | ||
e07d4801 | 770 | # Requests logged |
839a51c8 | 771 | count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'` |
a29fd7dd | 772 | expected=`expr 37 + 18 + 28 + $pjobs \* 8 + $pprinters \* $pjobs \* 4` |
e07d4801 MS |
773 | if test $count != $expected; then |
774 | echo "FAIL: $count requests logged, expected $expected." | |
775 | echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile | |
776 | fail=`expr $fail + 1` | |
777 | else | |
778 | echo "PASS: $count requests logged." | |
779 | echo "<P>PASS: $count requests logged.</P>" >>$strfile | |
780 | fi | |
781 | ||
782 | # Did CUPS-Get-Default get logged? | |
0268488e | 783 | if $GREP -q CUPS-Get-Default /tmp/cups-$user/log/access_log; then |
e07d4801 MS |
784 | echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'" |
785 | echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile | |
786 | echo "<PRE>" >>$strfile | |
0268488e | 787 | $GREP CUPS-Get-Default /tmp/cups-$user/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
e07d4801 MS |
788 | echo "</PRE>" >>$strfile |
789 | fail=`expr $fail + 1` | |
790 | else | |
791 | echo "PASS: CUPS-Get-Default not logged." | |
792 | echo "<P>PASS: CUPS-Get-Default not logged.</P>" >>$strfile | |
793 | fi | |
839a51c8 MS |
794 | |
795 | # Emergency log messages | |
0268488e | 796 | count=`$GREP '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
797 | if test $count != 0; then |
798 | echo "FAIL: $count emergency messages, expected 0." | |
0268488e | 799 | $GREP '^X ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
800 | echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile |
801 | echo "<PRE>" >>$strfile | |
0268488e | 802 | $GREP '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
803 | echo "</PRE>" >>$strfile |
804 | fail=`expr $fail + 1` | |
805 | else | |
806 | echo "PASS: $count emergency messages." | |
807 | echo "<P>PASS: $count emergency messages.</P>" >>$strfile | |
808 | fi | |
809 | ||
810 | # Alert log messages | |
0268488e | 811 | count=`$GREP '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
812 | if test $count != 0; then |
813 | echo "FAIL: $count alert messages, expected 0." | |
0268488e | 814 | $GREP '^A ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
815 | echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile |
816 | echo "<PRE>" >>$strfile | |
0268488e | 817 | $GREP '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
818 | echo "</PRE>" >>$strfile |
819 | fail=`expr $fail + 1` | |
820 | else | |
821 | echo "PASS: $count alert messages." | |
822 | echo "<P>PASS: $count alert messages.</P>" >>$strfile | |
823 | fi | |
824 | ||
825 | # Critical log messages | |
0268488e | 826 | count=`$GREP '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
827 | if test $count != 0; then |
828 | echo "FAIL: $count critical messages, expected 0." | |
0268488e | 829 | $GREP '^C ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
830 | echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile |
831 | echo "<PRE>" >>$strfile | |
0268488e | 832 | $GREP '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
833 | echo "</PRE>" >>$strfile |
834 | fail=`expr $fail + 1` | |
835 | else | |
836 | echo "PASS: $count critical messages." | |
837 | echo "<P>PASS: $count critical messages.</P>" >>$strfile | |
838 | fi | |
839 | ||
840 | # Error log messages | |
0268488e | 841 | count=`$GREP '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
a29fd7dd MS |
842 | if test $count != 33; then |
843 | echo "FAIL: $count error messages, expected 33." | |
0268488e | 844 | $GREP '^E ' /tmp/cups-$user/log/error_log |
a29fd7dd | 845 | echo "<P>FAIL: $count error messages, expected 33.</P>" >>$strfile |
839a51c8 | 846 | echo "<PRE>" >>$strfile |
0268488e | 847 | $GREP '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
848 | echo "</PRE>" >>$strfile |
849 | fail=`expr $fail + 1` | |
850 | else | |
851 | echo "PASS: $count error messages." | |
852 | echo "<P>PASS: $count error messages.</P>" >>$strfile | |
853 | fi | |
854 | ||
855 | # Warning log messages | |
0268488e | 856 | count=`$GREP '^W ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
10d09e33 MS |
857 | if test $count != 9; then |
858 | echo "FAIL: $count warning messages, expected 9." | |
0268488e | 859 | $GREP '^W ' /tmp/cups-$user/log/error_log |
10d09e33 | 860 | echo "<P>FAIL: $count warning messages, expected 9.</P>" >>$strfile |
839a51c8 | 861 | echo "<PRE>" >>$strfile |
0268488e | 862 | $GREP '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
863 | echo "</PRE>" >>$strfile |
864 | fail=`expr $fail + 1` | |
865 | else | |
866 | echo "PASS: $count warning messages." | |
867 | echo "<P>PASS: $count warning messages.</P>" >>$strfile | |
868 | fi | |
869 | ||
870 | # Notice log messages | |
0268488e | 871 | count=`$GREP '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
872 | if test $count != 0; then |
873 | echo "FAIL: $count notice messages, expected 0." | |
0268488e | 874 | $GREP '^N ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
875 | echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile |
876 | echo "<PRE>" >>$strfile | |
0268488e | 877 | $GREP '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
878 | echo "</PRE>" >>$strfile |
879 | fail=`expr $fail + 1` | |
880 | else | |
881 | echo "PASS: $count notice messages." | |
882 | echo "<P>PASS: $count notice messages.</P>" >>$strfile | |
883 | fi | |
884 | ||
885 | # Info log messages | |
0268488e | 886 | count=`$GREP '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
887 | if test $count = 0; then |
888 | echo "FAIL: $count info messages, expected more than 0." | |
889 | echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile | |
890 | fail=`expr $fail + 1` | |
891 | else | |
892 | echo "PASS: $count info messages." | |
893 | echo "<P>PASS: $count info messages.</P>" >>$strfile | |
894 | fi | |
895 | ||
896 | # Debug log messages | |
0268488e | 897 | count=`$GREP '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
898 | if test $count = 0; then |
899 | echo "FAIL: $count debug messages, expected more than 0." | |
900 | echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile | |
901 | fail=`expr $fail + 1` | |
902 | else | |
903 | echo "PASS: $count debug messages." | |
904 | echo "<P>PASS: $count debug messages.</P>" >>$strfile | |
905 | fi | |
906 | ||
907 | # Debug2 log messages | |
0268488e | 908 | count=`$GREP '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
7a14d768 MS |
909 | if test $count = 0; then |
910 | echo "FAIL: $count debug2 messages, expected more than 0." | |
911 | echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile | |
839a51c8 MS |
912 | fail=`expr $fail + 1` |
913 | else | |
914 | echo "PASS: $count debug2 messages." | |
915 | echo "<P>PASS: $count debug2 messages.</P>" >>$strfile | |
916 | fi | |
917 | ||
918 | # Log files... | |
ef416fc2 | 919 | echo "<H2>access_log</H2>" >>$strfile |
920 | echo "<PRE>" >>$strfile | |
839a51c8 | 921 | sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/access_log >>$strfile |
ef416fc2 | 922 | echo "</PRE>" >>$strfile |
923 | ||
924 | echo "<H2>error_log</H2>" >>$strfile | |
925 | echo "<PRE>" >>$strfile | |
0268488e | 926 | $GREP -v '^d' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
ef416fc2 | 927 | echo "</PRE>" >>$strfile |
928 | ||
929 | echo "<H2>page_log</H2>" >>$strfile | |
930 | echo "<PRE>" >>$strfile | |
839a51c8 | 931 | sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/page_log >>$strfile |
ef416fc2 | 932 | echo "</PRE>" >>$strfile |
933 | ||
ef416fc2 | 934 | # |
935 | # Format the reports and tell the user where to find them... | |
936 | # | |
937 | ||
ef416fc2 | 938 | cat str-trailer.html >>$strfile |
939 | ||
ef416fc2 | 940 | echo "" |
941 | ||
942 | if test $fail != 0; then | |
943 | echo "$fail tests failed." | |
dd1abb6b MS |
944 | cp /tmp/cups-$user/log/error_log error_log-$date-$user |
945 | cp $strfile . | |
ef416fc2 | 946 | else |
947 | echo "All tests were successful." | |
948 | fi | |
949 | ||
a74454a7 | 950 | echo "Log files can be found in /tmp/cups-$user/log." |
839a51c8 | 951 | echo "A HTML report was created in $strfile." |
ef416fc2 | 952 | echo "" |
953 | ||
db0bd74a | 954 | if test $fail != 0; then |
dd1abb6b MS |
955 | echo "Copies of the error_log and `basename $strfile` files are in" |
956 | echo "`pwd`." | |
957 | echo "" | |
958 | ||
db0bd74a MS |
959 | exit 1 |
960 | fi | |
961 | ||
ef416fc2 | 962 | # |
a480a1b6 | 963 | # End of "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $" |
ef416fc2 | 964 | # |