]>
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 | ||
215 | # | |
216 | # Start by creating temporary directories for the tests... | |
217 | # | |
218 | ||
a74454a7 | 219 | echo "Creating directories for test..." |
220 | ||
ef416fc2 | 221 | rm -rf /tmp/cups-$user |
222 | mkdir /tmp/cups-$user | |
223 | mkdir /tmp/cups-$user/bin | |
224 | mkdir /tmp/cups-$user/bin/backend | |
839a51c8 | 225 | mkdir /tmp/cups-$user/bin/driver |
ef416fc2 | 226 | mkdir /tmp/cups-$user/bin/filter |
227 | mkdir /tmp/cups-$user/certs | |
228 | mkdir /tmp/cups-$user/share | |
229 | mkdir /tmp/cups-$user/share/banners | |
7a14d768 | 230 | mkdir /tmp/cups-$user/share/drv |
4509bb49 MS |
231 | mkdir /tmp/cups-$user/share/locale |
232 | for file in ../locale/cups_*.po; do | |
233 | loc=`basename $file .po | cut -c 6-` | |
234 | mkdir /tmp/cups-$user/share/locale/$loc | |
235 | ln -s $root/locale/cups_$loc.po /tmp/cups-$user/share/locale/$loc | |
236 | ln -s $root/locale/ppdc_$loc.po /tmp/cups-$user/share/locale/$loc | |
237 | done | |
75bd9771 | 238 | mkdir /tmp/cups-$user/share/mime |
ef416fc2 | 239 | mkdir /tmp/cups-$user/share/model |
7a14d768 | 240 | mkdir /tmp/cups-$user/share/ppdc |
ef416fc2 | 241 | mkdir /tmp/cups-$user/interfaces |
242 | mkdir /tmp/cups-$user/log | |
243 | mkdir /tmp/cups-$user/ppd | |
244 | mkdir /tmp/cups-$user/spool | |
245 | mkdir /tmp/cups-$user/spool/temp | |
246 | mkdir /tmp/cups-$user/ssl | |
247 | ||
b19ccc9e | 248 | ln -s $root/backend/dnssd /tmp/cups-$user/bin/backend |
ef416fc2 | 249 | ln -s $root/backend/http /tmp/cups-$user/bin/backend |
250 | ln -s $root/backend/ipp /tmp/cups-$user/bin/backend | |
251 | ln -s $root/backend/lpd /tmp/cups-$user/bin/backend | |
7a14d768 | 252 | ln -s $root/backend/mdns /tmp/cups-$user/bin/backend |
ef416fc2 | 253 | ln -s $root/backend/parallel /tmp/cups-$user/bin/backend |
254 | ln -s $root/backend/serial /tmp/cups-$user/bin/backend | |
a74454a7 | 255 | ln -s $root/backend/snmp /tmp/cups-$user/bin/backend |
ef416fc2 | 256 | ln -s $root/backend/socket /tmp/cups-$user/bin/backend |
257 | ln -s $root/backend/usb /tmp/cups-$user/bin/backend | |
258 | ln -s $root/cgi-bin /tmp/cups-$user/bin | |
bd7854cb | 259 | ln -s $root/monitor /tmp/cups-$user/bin |
ef416fc2 | 260 | ln -s $root/notifier /tmp/cups-$user/bin |
261 | ln -s $root/scheduler /tmp/cups-$user/bin/daemon | |
cda47a96 | 262 | ln -s $root/filter/bannertops /tmp/cups-$user/bin/filter |
7a14d768 | 263 | ln -s $root/filter/commandtops /tmp/cups-$user/bin/filter |
7a0cbd5e | 264 | ln -s $root/filter/gziptoany /tmp/cups-$user/bin/filter |
ef416fc2 | 265 | ln -s $root/filter/hpgltops /tmp/cups-$user/bin/filter |
ef416fc2 | 266 | ln -s $root/filter/pstops /tmp/cups-$user/bin/filter |
267 | ln -s $root/filter/rastertoepson /tmp/cups-$user/bin/filter | |
268 | ln -s $root/filter/rastertohp /tmp/cups-$user/bin/filter | |
269 | ln -s $root/filter/texttops /tmp/cups-$user/bin/filter | |
ef416fc2 | 270 | |
271 | ln -s $root/data/classified /tmp/cups-$user/share/banners | |
272 | ln -s $root/data/confidential /tmp/cups-$user/share/banners | |
273 | ln -s $root/data/secret /tmp/cups-$user/share/banners | |
274 | ln -s $root/data/standard /tmp/cups-$user/share/banners | |
275 | ln -s $root/data/topsecret /tmp/cups-$user/share/banners | |
276 | ln -s $root/data/unclassified /tmp/cups-$user/share/banners | |
a74454a7 | 277 | ln -s $root/data /tmp/cups-$user/share/charmaps |
ef416fc2 | 278 | ln -s $root/data /tmp/cups-$user/share/charsets |
279 | ln -s $root/data /tmp/cups-$user/share | |
280 | ln -s $root/fonts /tmp/cups-$user/share | |
7a14d768 | 281 | ln -s $root/ppdc/sample.drv /tmp/cups-$user/share/drv |
75bd9771 MS |
282 | ln -s $root/conf/mime.types /tmp/cups-$user/share/mime |
283 | ln -s $root/conf/mime.convs /tmp/cups-$user/share/mime | |
7a14d768 MS |
284 | ln -s $root/data/*.h /tmp/cups-$user/share/ppdc |
285 | ln -s $root/data/*.defs /tmp/cups-$user/share/ppdc | |
ef416fc2 | 286 | ln -s $root/templates /tmp/cups-$user/share |
287 | ||
bc44d920 | 288 | # |
289 | # Mac OS X filters and configuration files... | |
290 | # | |
291 | ||
292 | if test `uname` = Darwin; then | |
293 | ln -s /usr/libexec/cups/filter/cgpdfto* /tmp/cups-$user/bin/filter | |
f0ab5bff MS |
294 | ln -s /usr/libexec/cups/filter/cgbannertopdf /tmp/cups-$user/bin/filter |
295 | ln -s /usr/libexec/cups/filter/cgimagetopdf /tmp/cups-$user/bin/filter | |
296 | ln -s /usr/libexec/cups/filter/cgtexttopdf /tmp/cups-$user/bin/filter | |
bc44d920 | 297 | ln -s /usr/libexec/cups/filter/nsimagetopdf /tmp/cups-$user/bin/filter |
298 | ln -s /usr/libexec/cups/filter/nstexttopdf /tmp/cups-$user/bin/filter | |
299 | ln -s /usr/libexec/cups/filter/pictwpstops /tmp/cups-$user/bin/filter | |
300 | ln -s /usr/libexec/cups/filter/pstoappleps /tmp/cups-$user/bin/filter | |
301 | ln -s /usr/libexec/cups/filter/pstocupsraster /tmp/cups-$user/bin/filter | |
302 | ln -s /usr/libexec/cups/filter/pstopdffilter /tmp/cups-$user/bin/filter | |
303 | ||
4509bb49 MS |
304 | if test -f /private/etc/cups/apple.types; then |
305 | ln -s /private/etc/cups/apple.* /tmp/cups-$user/share/mime | |
306 | elif test -f /usr/share/cups/mime/apple.types; then | |
307 | ln -s /usr/share/cups/mime/apple.* /tmp/cups-$user/share/mime | |
308 | fi | |
839a51c8 MS |
309 | else |
310 | ln -s $root/filter/imagetops /tmp/cups-$user/bin/filter | |
311 | ln -s $root/filter/imagetoraster /tmp/cups-$user/bin/filter | |
312 | ln -s $root/filter/pdftops /tmp/cups-$user/bin/filter | |
bc44d920 | 313 | fi |
314 | ||
ef416fc2 | 315 | # |
316 | # Then create the necessary config files... | |
317 | # | |
318 | ||
a74454a7 | 319 | echo "Creating cupsd.conf for test..." |
320 | ||
ef416fc2 | 321 | if test $ssltype = 2; then |
322 | encryption="Encryption Required" | |
323 | else | |
324 | encryption="" | |
325 | fi | |
326 | ||
327 | cat >/tmp/cups-$user/cupsd.conf <<EOF | |
328 | Browsing Off | |
329 | FileDevice yes | |
330 | Printcap | |
331 | Listen 127.0.0.1:$port | |
332 | User $user | |
333 | ServerRoot /tmp/cups-$user | |
334 | StateDir /tmp/cups-$user | |
335 | ServerBin /tmp/cups-$user/bin | |
336 | CacheDir /tmp/cups-$user/share | |
337 | DataDir /tmp/cups-$user/share | |
338 | FontPath /tmp/cups-$user/share/fonts | |
4509bb49 | 339 | PassEnv LOCALEDIR |
ef416fc2 | 340 | DocumentRoot $root/doc |
341 | RequestRoot /tmp/cups-$user/spool | |
342 | TempDir /tmp/cups-$user/spool/temp | |
52f6f666 | 343 | MaxSubscriptions 3 |
ef416fc2 | 344 | MaxLogSize 0 |
345 | AccessLog /tmp/cups-$user/log/access_log | |
346 | ErrorLog /tmp/cups-$user/log/error_log | |
347 | PageLog /tmp/cups-$user/log/page_log | |
e07d4801 | 348 | AccessLogLevel actions |
7a14d768 | 349 | LogLevel debug2 |
b9faaae1 | 350 | LogTimeFormat usecs |
ef416fc2 | 351 | PreserveJobHistory Yes |
352 | <Policy default> | |
353 | <Limit All> | |
354 | Order Deny,Allow | |
355 | Deny from all | |
356 | Allow from 127.0.0.1 | |
357 | $encryption | |
358 | </Limit> | |
359 | </Policy> | |
360 | EOF | |
361 | ||
ef416fc2 | 362 | # |
75bd9771 | 363 | # Setup lots of test queues - half with PPD files, half without... |
ef416fc2 | 364 | # |
365 | ||
a74454a7 | 366 | echo "Creating printers.conf for test..." |
367 | ||
ef416fc2 | 368 | i=1 |
369 | while test $i -le $nprinters1; do | |
370 | cat >>/tmp/cups-$user/printers.conf <<EOF | |
371 | <Printer test-$i> | |
372 | Accepting Yes | |
373 | DeviceURI file:/dev/null | |
374 | Info Test PS printer $i | |
375 | JobSheets none none | |
376 | Location CUPS test suite | |
377 | State Idle | |
378 | StateMessage Printer $1 is idle. | |
379 | </Printer> | |
380 | EOF | |
381 | ||
382 | cp testps.ppd /tmp/cups-$user/ppd/test-$i.ppd | |
383 | ||
384 | i=`expr $i + 1` | |
385 | done | |
386 | ||
387 | while test $i -le $nprinters2; do | |
388 | cat >>/tmp/cups-$user/printers.conf <<EOF | |
389 | <Printer test-$i> | |
390 | Accepting Yes | |
391 | DeviceURI file:/dev/null | |
392 | Info Test raw printer $i | |
393 | JobSheets none none | |
394 | Location CUPS test suite | |
395 | State Idle | |
396 | StateMessage Printer $1 is idle. | |
397 | </Printer> | |
398 | EOF | |
399 | ||
400 | i=`expr $i + 1` | |
401 | done | |
402 | ||
426c6a59 MS |
403 | if test -f /tmp/cups-$user/printers.conf; then |
404 | cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig | |
405 | else | |
406 | touch /tmp/cups-$user/printers.conf.orig | |
407 | fi | |
ef416fc2 | 408 | |
ef416fc2 | 409 | # |
410 | # Setup the paths... | |
411 | # | |
412 | ||
a74454a7 | 413 | echo "Setting up environment variables for test..." |
414 | ||
ef416fc2 | 415 | if test "x$LD_LIBRARY_PATH" = x; then |
50fe7201 | 416 | LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc" |
ef416fc2 | 417 | else |
50fe7201 | 418 | LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$LD_LIBRARY_PATH" |
ef416fc2 | 419 | fi |
420 | ||
421 | export LD_LIBRARY_PATH | |
422 | ||
50fe7201 | 423 | 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 |
424 | if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then |
425 | LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD" | |
426 | fi | |
ef416fc2 | 427 | export LD_PRELOAD |
428 | ||
429 | if test "x$DYLD_LIBRARY_PATH" = x; then | |
50fe7201 | 430 | DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc" |
ef416fc2 | 431 | else |
50fe7201 | 432 | DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$DYLD_LIBRARY_PATH" |
ef416fc2 | 433 | fi |
434 | ||
435 | export DYLD_LIBRARY_PATH | |
436 | ||
437 | if test "x$SHLIB_PATH" = x; then | |
50fe7201 | 438 | SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc" |
ef416fc2 | 439 | else |
50fe7201 | 440 | SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$SHLIB_PATH" |
ef416fc2 | 441 | fi |
442 | ||
443 | export SHLIB_PATH | |
444 | ||
ef55b745 | 445 | CUPS_DISABLE_APPLE_DEFAULT=yes; export CUPS_DISABLE_APPLE_DEFAULT |
b19ccc9e | 446 | CUPS_SERVER=localhost:8631; export CUPS_SERVER |
ef416fc2 | 447 | CUPS_SERVERROOT=/tmp/cups-$user; export CUPS_SERVERROOT |
448 | CUPS_STATEDIR=/tmp/cups-$user; export CUPS_STATEDIR | |
449 | CUPS_DATADIR=/tmp/cups-$user/share; export CUPS_DATADIR | |
4509bb49 | 450 | LOCALEDIR=/tmp/cups-$user/share/locale; export LOCALEDIR |
ef416fc2 | 451 | |
452 | # | |
453 | # Set a new home directory to avoid getting user options mixed in... | |
454 | # | |
455 | ||
456 | HOME=/tmp/cups-$user | |
457 | export HOME | |
458 | ||
f42414bf | 459 | # |
460 | # Force POSIX locale for tests... | |
461 | # | |
462 | ||
463 | LANG=C | |
464 | export LANG | |
465 | ||
0268488e MS |
466 | LC_MESSAGES=C |
467 | export LC_MESSAGES | |
468 | ||
ef416fc2 | 469 | # |
470 | # Start the server; run as foreground daemon in the background... | |
471 | # | |
472 | ||
473 | echo "Starting scheduler:" | |
a74454a7 | 474 | echo " $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &" |
ef416fc2 | 475 | echo "" |
476 | ||
b9faaae1 MS |
477 | if test `uname` = Darwin -a "x$valgrind" = x; then |
478 | DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib \ | |
479 | $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & | |
480 | else | |
481 | $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & | |
482 | fi | |
483 | ||
ef416fc2 | 484 | cupsd=$! |
485 | ||
ef416fc2 | 486 | if test "x$testtype" = x0; then |
b19ccc9e | 487 | # Not running tests... |
ef416fc2 | 488 | echo "Scheduler is PID $cupsd and is listening on port 8631." |
489 | echo "" | |
b19ccc9e MS |
490 | |
491 | # Create a helper script to run programs with... | |
492 | runcups="/tmp/cups-$user/runcups" | |
493 | ||
494 | echo "#!/bin/sh" >$runcups | |
495 | echo "# Helper script for running CUPS test instance." >>$runcups | |
496 | echo "" >>$runcups | |
497 | echo "# Set required environment variables..." >>$runcups | |
498 | echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups | |
499 | echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups | |
500 | echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups | |
501 | echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups | |
502 | echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups | |
503 | echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups | |
504 | echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups | |
505 | echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups | |
506 | echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups | |
507 | echo "" >>$runcups | |
508 | echo "# Run command..." >>$runcups | |
509 | echo "exec \"\$@\"" >>$runcups | |
510 | ||
511 | chmod +x $runcups | |
512 | ||
513 | echo "The $runcups helper script can be used to test programs" | |
514 | echo "with the server." | |
ef416fc2 | 515 | exit 0 |
516 | fi | |
517 | ||
a74454a7 | 518 | if test $argcount -eq 0; then |
519 | echo "Scheduler is PID $cupsd; run debugger now if you need to." | |
520 | echo "" | |
521 | echo $ac_n "Press ENTER to continue... $ac_c" | |
522 | read junk | |
523 | else | |
524 | echo "Scheduler is PID $cupsd." | |
525 | sleep 2 | |
526 | fi | |
ef416fc2 | 527 | |
528 | IPP_PORT=$port; export IPP_PORT | |
529 | ||
530 | while true; do | |
531 | running=`../systemv/lpstat -r 2>/dev/null` | |
532 | if test "x$running" = "xscheduler is running"; then | |
533 | break | |
534 | fi | |
535 | ||
536 | echo "Waiting for scheduler to become ready..." | |
537 | sleep 10 | |
538 | done | |
539 | ||
540 | # | |
541 | # Create the test report source file... | |
542 | # | |
543 | ||
dd1abb6b | 544 | date=`date "+%Y-%m-%d"` |
a480a1b6 | 545 | strfile=/tmp/cups-$user/cups-str-1.5-$date-$user.html |
ef416fc2 | 546 | |
547 | rm -f $strfile | |
548 | cat str-header.html >$strfile | |
549 | ||
550 | # | |
551 | # Run the IPP tests... | |
552 | # | |
553 | ||
a74454a7 | 554 | echo "" |
ef416fc2 | 555 | echo "Running IPP compliance tests..." |
556 | ||
bd7854cb | 557 | echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile |
ef416fc2 | 558 | echo "<P>This section provides the results to the IPP compliance tests" >>$strfile |
559 | echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
e1d6a774 | 560 | echo `date "+%Y-%m-%d"` by $user on `hostname`. >>$strfile |
ef416fc2 | 561 | echo "<PRE>" >>$strfile |
562 | ||
563 | fail=0 | |
564 | for file in 4*.test; do | |
565 | echo "Performing $file..." | |
566 | echo "" >>$strfile | |
567 | ||
aaf19ab0 | 568 | ./ipptool -t ipp://localhost:$port/printers $file | tee -a $strfile |
ef416fc2 | 569 | status=$? |
570 | ||
571 | if test $status != 0; then | |
572 | echo Test failed. | |
573 | fail=`expr $fail + 1` | |
574 | fi | |
575 | done | |
576 | ||
577 | echo "</PRE>" >>$strfile | |
578 | ||
579 | # | |
580 | # Run the command tests... | |
581 | # | |
582 | ||
a74454a7 | 583 | echo "" |
ef416fc2 | 584 | echo "Running command tests..." |
585 | ||
bd7854cb | 586 | echo "<H1>2 - Command Tests</H1>" >>$strfile |
ef416fc2 | 587 | echo "<P>This section provides the results to the command tests" >>$strfile |
588 | echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
dd1abb6b | 589 | echo $date by $user on `hostname`. >>$strfile |
ef416fc2 | 590 | echo "<PRE>" >>$strfile |
591 | ||
592 | for file in 5*.sh; do | |
593 | echo "Performing $file..." | |
594 | echo "" >>$strfile | |
595 | echo "\"$file\":" >>$strfile | |
596 | ||
b9faaae1 | 597 | sh $file $pjobs $pprinters | tee -a $strfile |
ef416fc2 | 598 | status=$? |
599 | ||
600 | if test $status != 0; then | |
601 | echo Test failed. | |
602 | fail=`expr $fail + 1` | |
603 | fi | |
604 | done | |
605 | ||
606 | echo "</PRE>" >>$strfile | |
607 | ||
ef416fc2 | 608 | # |
609 | # Stop the server... | |
610 | # | |
611 | ||
612 | kill $cupsd | |
613 | ||
614 | # | |
615 | # Append the log files for post-mortim... | |
616 | # | |
617 | ||
bd7854cb | 618 | echo "<H1>3 - Log Files</H1>" >>$strfile |
ef416fc2 | 619 | |
839a51c8 MS |
620 | # |
621 | # Verify counts... | |
622 | # | |
623 | ||
624 | echo "Test Summary" | |
625 | echo "" | |
626 | echo "<H2>Summary</H2>" >>$strfile | |
627 | ||
ba55dc12 MS |
628 | # Job control files |
629 | count=`ls -1 /tmp/cups-$user/spool | wc -l` | |
630 | count=`expr $count - 1` | |
631 | if test $count != 0; then | |
632 | echo "FAIL: $count job control files were not purged." | |
633 | echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile | |
634 | fail=`expr $fail + 1` | |
635 | else | |
636 | echo "PASS: All job control files purged." | |
637 | echo "<P>PASS: All job control files purged.</P>" >>$strfile | |
638 | fi | |
639 | ||
7a14d768 | 640 | # Pages printed on Test1 (within 1 page for timing-dependent cancel issues) |
0268488e | 641 | count=`$GREP '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` |
969307f0 MS |
642 | expected=`expr $pjobs \* 2 + 34` |
643 | expected2=`expr $expected + 2` | |
644 | if test $count -lt $expected -a $count -gt $expected2; then | |
839a51c8 MS |
645 | echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected." |
646 | echo "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile | |
647 | fail=`expr $fail + 1` | |
648 | else | |
649 | echo "PASS: Printer 'Test1' correctly produced $count page(s)." | |
650 | echo "<P>PASS: Printer 'Test1' correctly produced $count page(s).</P>" >>$strfile | |
651 | fi | |
652 | ||
653 | # Paged printed on Test2 | |
0268488e | 654 | count=`$GREP '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` |
839a51c8 MS |
655 | expected=`expr $pjobs \* 2 + 3` |
656 | if test $count != $expected; then | |
657 | echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected." | |
658 | echo "<P>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</P>" >>$strfile | |
659 | fail=`expr $fail + 1` | |
660 | else | |
661 | echo "PASS: Printer 'Test2' correctly produced $count page(s)." | |
662 | echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile | |
663 | fi | |
664 | ||
e07d4801 | 665 | # Requests logged |
839a51c8 | 666 | count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'` |
7cf5915e | 667 | expected=`expr 37 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4` |
e07d4801 MS |
668 | if test $count != $expected; then |
669 | echo "FAIL: $count requests logged, expected $expected." | |
670 | echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile | |
671 | fail=`expr $fail + 1` | |
672 | else | |
673 | echo "PASS: $count requests logged." | |
674 | echo "<P>PASS: $count requests logged.</P>" >>$strfile | |
675 | fi | |
676 | ||
677 | # Did CUPS-Get-Default get logged? | |
0268488e | 678 | if $GREP -q CUPS-Get-Default /tmp/cups-$user/log/access_log; then |
e07d4801 MS |
679 | echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'" |
680 | echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile | |
681 | echo "<PRE>" >>$strfile | |
0268488e | 682 | $GREP CUPS-Get-Default /tmp/cups-$user/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
e07d4801 MS |
683 | echo "</PRE>" >>$strfile |
684 | fail=`expr $fail + 1` | |
685 | else | |
686 | echo "PASS: CUPS-Get-Default not logged." | |
687 | echo "<P>PASS: CUPS-Get-Default not logged.</P>" >>$strfile | |
688 | fi | |
839a51c8 MS |
689 | |
690 | # Emergency log messages | |
0268488e | 691 | count=`$GREP '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
692 | if test $count != 0; then |
693 | echo "FAIL: $count emergency messages, expected 0." | |
0268488e | 694 | $GREP '^X ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
695 | echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile |
696 | echo "<PRE>" >>$strfile | |
0268488e | 697 | $GREP '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
698 | echo "</PRE>" >>$strfile |
699 | fail=`expr $fail + 1` | |
700 | else | |
701 | echo "PASS: $count emergency messages." | |
702 | echo "<P>PASS: $count emergency messages.</P>" >>$strfile | |
703 | fi | |
704 | ||
705 | # Alert log messages | |
0268488e | 706 | count=`$GREP '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
707 | if test $count != 0; then |
708 | echo "FAIL: $count alert messages, expected 0." | |
0268488e | 709 | $GREP '^A ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
710 | echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile |
711 | echo "<PRE>" >>$strfile | |
0268488e | 712 | $GREP '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
713 | echo "</PRE>" >>$strfile |
714 | fail=`expr $fail + 1` | |
715 | else | |
716 | echo "PASS: $count alert messages." | |
717 | echo "<P>PASS: $count alert messages.</P>" >>$strfile | |
718 | fi | |
719 | ||
720 | # Critical log messages | |
0268488e | 721 | count=`$GREP '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
722 | if test $count != 0; then |
723 | echo "FAIL: $count critical messages, expected 0." | |
0268488e | 724 | $GREP '^C ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
725 | echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile |
726 | echo "<PRE>" >>$strfile | |
0268488e | 727 | $GREP '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
728 | echo "</PRE>" >>$strfile |
729 | fail=`expr $fail + 1` | |
730 | else | |
731 | echo "PASS: $count critical messages." | |
732 | echo "<P>PASS: $count critical messages.</P>" >>$strfile | |
733 | fi | |
734 | ||
735 | # Error log messages | |
0268488e | 736 | count=`$GREP '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
d2354e63 MS |
737 | if test $count != 18; then |
738 | echo "FAIL: $count error messages, expected 18." | |
0268488e | 739 | $GREP '^E ' /tmp/cups-$user/log/error_log |
d2354e63 | 740 | echo "<P>FAIL: $count error messages, expected 18.</P>" >>$strfile |
839a51c8 | 741 | echo "<PRE>" >>$strfile |
0268488e | 742 | $GREP '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
743 | echo "</PRE>" >>$strfile |
744 | fail=`expr $fail + 1` | |
745 | else | |
746 | echo "PASS: $count error messages." | |
747 | echo "<P>PASS: $count error messages.</P>" >>$strfile | |
748 | fi | |
749 | ||
750 | # Warning log messages | |
0268488e | 751 | count=`$GREP '^W ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
10d09e33 MS |
752 | if test $count != 9; then |
753 | echo "FAIL: $count warning messages, expected 9." | |
0268488e | 754 | $GREP '^W ' /tmp/cups-$user/log/error_log |
10d09e33 | 755 | echo "<P>FAIL: $count warning messages, expected 9.</P>" >>$strfile |
839a51c8 | 756 | echo "<PRE>" >>$strfile |
0268488e | 757 | $GREP '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
758 | echo "</PRE>" >>$strfile |
759 | fail=`expr $fail + 1` | |
760 | else | |
761 | echo "PASS: $count warning messages." | |
762 | echo "<P>PASS: $count warning messages.</P>" >>$strfile | |
763 | fi | |
764 | ||
765 | # Notice log messages | |
0268488e | 766 | count=`$GREP '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
767 | if test $count != 0; then |
768 | echo "FAIL: $count notice messages, expected 0." | |
0268488e | 769 | $GREP '^N ' /tmp/cups-$user/log/error_log |
839a51c8 MS |
770 | echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile |
771 | echo "<PRE>" >>$strfile | |
0268488e | 772 | $GREP '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
839a51c8 MS |
773 | echo "</PRE>" >>$strfile |
774 | fail=`expr $fail + 1` | |
775 | else | |
776 | echo "PASS: $count notice messages." | |
777 | echo "<P>PASS: $count notice messages.</P>" >>$strfile | |
778 | fi | |
779 | ||
780 | # Info log messages | |
0268488e | 781 | count=`$GREP '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
782 | if test $count = 0; then |
783 | echo "FAIL: $count info messages, expected more than 0." | |
784 | echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile | |
785 | fail=`expr $fail + 1` | |
786 | else | |
787 | echo "PASS: $count info messages." | |
788 | echo "<P>PASS: $count info messages.</P>" >>$strfile | |
789 | fi | |
790 | ||
791 | # Debug log messages | |
0268488e | 792 | count=`$GREP '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
839a51c8 MS |
793 | if test $count = 0; then |
794 | echo "FAIL: $count debug messages, expected more than 0." | |
795 | echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile | |
796 | fail=`expr $fail + 1` | |
797 | else | |
798 | echo "PASS: $count debug messages." | |
799 | echo "<P>PASS: $count debug messages.</P>" >>$strfile | |
800 | fi | |
801 | ||
802 | # Debug2 log messages | |
0268488e | 803 | count=`$GREP '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` |
7a14d768 MS |
804 | if test $count = 0; then |
805 | echo "FAIL: $count debug2 messages, expected more than 0." | |
806 | echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile | |
839a51c8 MS |
807 | fail=`expr $fail + 1` |
808 | else | |
809 | echo "PASS: $count debug2 messages." | |
810 | echo "<P>PASS: $count debug2 messages.</P>" >>$strfile | |
811 | fi | |
812 | ||
75bd9771 | 813 | # Page log file... |
0268488e MS |
814 | if test `uname` = Darwin; then |
815 | # Currently just test for Mac OS X since others do not have UI to | |
816 | # select a user-wide default media size... | |
817 | if $GREP -iq 'testfile.pdf na_letter_8.5x11in' /tmp/cups-$user/log/page_log; then | |
818 | echo "PASS: page_log formatted correctly." | |
819 | echo "<P>PASS: page_log formatted correctly.</P>" >>$strfile | |
820 | else | |
821 | echo "FAIL: page_log formatted incorrectly." | |
822 | echo "<P>FAIL: page_log formatted incorrectly - no page size information.</P>" >>$strfile | |
823 | fail=`expr $fail + 1` | |
824 | fi | |
75bd9771 MS |
825 | fi |
826 | ||
839a51c8 | 827 | # Log files... |
ef416fc2 | 828 | echo "<H2>access_log</H2>" >>$strfile |
829 | echo "<PRE>" >>$strfile | |
839a51c8 | 830 | sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/access_log >>$strfile |
ef416fc2 | 831 | echo "</PRE>" >>$strfile |
832 | ||
833 | echo "<H2>error_log</H2>" >>$strfile | |
834 | echo "<PRE>" >>$strfile | |
0268488e | 835 | $GREP -v '^d' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile |
ef416fc2 | 836 | echo "</PRE>" >>$strfile |
837 | ||
838 | echo "<H2>page_log</H2>" >>$strfile | |
839 | echo "<PRE>" >>$strfile | |
839a51c8 | 840 | sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/page_log >>$strfile |
ef416fc2 | 841 | echo "</PRE>" >>$strfile |
842 | ||
ef416fc2 | 843 | # |
844 | # Format the reports and tell the user where to find them... | |
845 | # | |
846 | ||
ef416fc2 | 847 | cat str-trailer.html >>$strfile |
848 | ||
ef416fc2 | 849 | echo "" |
850 | ||
851 | if test $fail != 0; then | |
852 | echo "$fail tests failed." | |
dd1abb6b MS |
853 | cp /tmp/cups-$user/log/error_log error_log-$date-$user |
854 | cp $strfile . | |
ef416fc2 | 855 | else |
856 | echo "All tests were successful." | |
857 | fi | |
858 | ||
a74454a7 | 859 | echo "Log files can be found in /tmp/cups-$user/log." |
839a51c8 | 860 | echo "A HTML report was created in $strfile." |
ef416fc2 | 861 | echo "" |
862 | ||
db0bd74a | 863 | if test $fail != 0; then |
dd1abb6b MS |
864 | echo "Copies of the error_log and `basename $strfile` files are in" |
865 | echo "`pwd`." | |
866 | echo "" | |
867 | ||
db0bd74a MS |
868 | exit 1 |
869 | fi | |
870 | ||
ef416fc2 | 871 | # |
a480a1b6 | 872 | # End of "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $" |
ef416fc2 | 873 | # |