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