]>
Commit | Line | Data |
---|---|---|
a61a2be6 | 1 | #!/bin/sh |
2 | # | |
5934328c | 3 | # "$Id: run-stp-tests.sh,v 1.4.2.22 2004/06/30 21:18:32 mike Exp $" |
a61a2be6 | 4 | # |
74464516 | 5 | # Perform the complete set of IPP compliance tests specified in the |
6 | # CUPS Software Test Plan. | |
7 | # | |
974f62b4 | 8 | # Copyright 1997-2002 by Easy Software Products, all rights reserved. |
74464516 | 9 | # |
10 | # These coded instructions, statements, and computer programs are the | |
11 | # property of Easy Software Products and are protected by Federal | |
12 | # copyright law. Distribution and use rights are outlined in the file | |
13 | # "LICENSE.txt" which should have been included with this file. If this | |
14 | # file is missing or damaged please contact Easy Software Products | |
15 | # at: | |
16 | # | |
17 | # Attn: CUPS Licensing Information | |
18 | # Easy Software Products | |
19 | # 44141 Airport View Drive, Suite 204 | |
20 | # Hollywood, Maryland 20636-3111 USA | |
21 | # | |
22 | # Voice: (301) 373-9603 | |
23 | # EMail: cups-info@cups.org | |
24 | # WWW: http://www.cups.org | |
a61a2be6 | 25 | # |
26 | ||
27 | # | |
28 | # Make the IPP test program... | |
29 | # | |
30 | ||
31 | make | |
32 | ||
34271358 | 33 | # |
34 | # Greet the tester... | |
35 | # | |
36 | ||
37 | echo "Welcome to the CUPS Automated Test Script." | |
38 | echo "" | |
39 | echo "Before we begin, it is important that you understand that the larger" | |
40 | echo "tests require significant amounts of RAM and disk space. If you" | |
41 | echo "attempt to run one of the big tests on a system that lacks sufficient" | |
42 | echo "disk and virtual memory, the UNIX kernel might decide to kill one or" | |
43 | echo "more system processes that you've grown attached to, like the X" | |
44 | echo "server. The question you may want to ask yourself before running a" | |
45 | echo "large test is: Do you feel lucky?" | |
46 | echo "" | |
47 | echo "OK, now that we have the Dirty Harry quote out of the way, please" | |
48 | echo "choose the type of test you wish to perform:" | |
49 | echo "" | |
3f5dfefd | 50 | echo "0 - No testing, keep the scheduler running for me (all systems)" |
254aa207 | 51 | echo "1 - Basic conformance test, no load testing (all systems)" |
52 | echo "2 - Basic conformance test, some load testing (minimum 256MB VM, 50MB disk)" | |
53 | echo "3 - Basic conformance test, extreme load testing (minimum 1GB VM, 500MB disk)" | |
54 | echo "4 - Basic conformance test, torture load testing (minimum 2GB VM, 1GB disk)" | |
34271358 | 55 | echo "" |
56 | echo "Please enter the number of the test you wish to perform:" | |
57 | ||
58 | read testtype | |
59 | ||
60 | case "$testtype" in | |
3f5dfefd | 61 | 0) |
62 | echo "Running in test mode (0)" | |
63 | nprinters1=0 | |
64 | nprinters2=0 | |
65 | pjobs=0 | |
66 | ;; | |
34271358 | 67 | 2) |
68 | echo "Running the medium tests (2)" | |
69 | nprinters1=10 | |
70 | nprinters2=20 | |
71 | pjobs=20 | |
72 | ;; | |
73 | 3) | |
74 | echo "Running the extreme tests (3)" | |
75 | nprinters1=500 | |
76 | nprinters2=1000 | |
77 | pjobs=100 | |
78 | ;; | |
4d520ad4 | 79 | 4) |
80 | echo "Running the torture tests (4)" | |
81 | nprinters1=10000 | |
82 | nprinters2=20000 | |
83 | pjobs=200 | |
84 | ;; | |
34271358 | 85 | *) |
86 | echo "Running the timid tests (1)" | |
87 | nprinters1=0 | |
88 | nprinters2=0 | |
89 | pjobs=0 | |
90 | ;; | |
91 | esac | |
92 | ||
a61a2be6 | 93 | # |
94 | # Information for the server/tests... | |
95 | # | |
96 | ||
97 | user=`whoami` | |
98 | port=8631 | |
bd917997 | 99 | cwd=`pwd` |
100 | root=`dirname $cwd` | |
a61a2be6 | 101 | |
4f6178db | 102 | # |
103 | # Make sure that the LPDEST and PRINTER environment variables are | |
104 | # not included in the environment that is passed to the tests. These | |
105 | # will usually cause tests to fail erroneously... | |
106 | # | |
107 | ||
108 | typeset +x LPDEST | |
109 | typeset +x PRINTER | |
110 | ||
ff40b65e | 111 | # |
112 | # See if we want to use valgrind... | |
113 | # | |
114 | ||
115 | echo "" | |
116 | echo "This test script can use the Valgrind software from:" | |
117 | echo "" | |
118 | echo " http://developer.kde.org/~sewardj/" | |
119 | echo "" | |
120 | echo "Please enter Y to use Valgrind or N to not use Valgrind:" | |
121 | ||
122 | read usevalgrind | |
123 | ||
124 | case "$usevalgrind" in | |
125 | Y* | y*) | |
ba886a95 | 126 | valgrind="valgrind --tool=memcheck --logfile=/tmp/$user/log/valgrind --error-limit=no --leak-check=yes --trace-children=yes" |
ff40b65e | 127 | echo "Using Valgrind; log files can be found in /tmp/$user/log..." |
128 | ;; | |
129 | ||
130 | *) | |
131 | valgrind="" | |
132 | ;; | |
133 | esac | |
134 | ||
a61a2be6 | 135 | # |
bd917997 | 136 | # Start by creating temporary directories for the tests... |
a61a2be6 | 137 | # |
138 | ||
139 | rm -rf /tmp/$user | |
140 | mkdir /tmp/$user | |
bd917997 | 141 | mkdir /tmp/$user/bin |
142 | mkdir /tmp/$user/bin/backend | |
143 | mkdir /tmp/$user/bin/filter | |
a61a2be6 | 144 | mkdir /tmp/$user/certs |
bd917997 | 145 | mkdir /tmp/$user/share |
146 | mkdir /tmp/$user/share/banners | |
147 | mkdir /tmp/$user/share/model | |
148 | mkdir /tmp/$user/interfaces | |
a61a2be6 | 149 | mkdir /tmp/$user/log |
bd917997 | 150 | mkdir /tmp/$user/ppd |
a61a2be6 | 151 | mkdir /tmp/$user/spool |
152 | mkdir /tmp/$user/spool/temp | |
bd917997 | 153 | mkdir /tmp/$user/ssl |
154 | ||
155 | ln -s $root/backend/http /tmp/$user/bin/backend | |
156 | ln -s $root/backend/ipp /tmp/$user/bin/backend | |
157 | ln -s $root/backend/lpd /tmp/$user/bin/backend | |
158 | ln -s $root/backend/parallel /tmp/$user/bin/backend | |
159 | ln -s $root/backend/serial /tmp/$user/bin/backend | |
160 | ln -s $root/backend/socket /tmp/$user/bin/backend | |
161 | ln -s $root/backend/usb /tmp/$user/bin/backend | |
162 | ln -s $root/cgi-bin /tmp/$user/bin | |
163 | ln -s $root/filter/hpgltops /tmp/$user/bin/filter | |
164 | ln -s $root/filter/imagetops /tmp/$user/bin/filter | |
165 | ln -s $root/filter/imagetoraster /tmp/$user/bin/filter | |
166 | ln -s $root/filter/pstops /tmp/$user/bin/filter | |
167 | ln -s $root/filter/rastertoepson /tmp/$user/bin/filter | |
168 | ln -s $root/filter/rastertohp /tmp/$user/bin/filter | |
169 | ln -s $root/filter/texttops /tmp/$user/bin/filter | |
50b9556e | 170 | ln -s $root/pdftops/pdftops /tmp/$user/bin/filter |
bd917997 | 171 | |
172 | ln -s $root/data/classified /tmp/$user/share/banners | |
173 | ln -s $root/data/confidential /tmp/$user/share/banners | |
174 | ln -s $root/data/secret /tmp/$user/share/banners | |
175 | ln -s $root/data/standard /tmp/$user/share/banners | |
176 | ln -s $root/data/topsecret /tmp/$user/share/banners | |
177 | ln -s $root/data/unclassified /tmp/$user/share/banners | |
178 | ln -s $root/data /tmp/$user/share/charsets | |
179 | ln -s $root/data /tmp/$user/share | |
180 | ln -s $root/fonts /tmp/$user/share | |
181 | ln -s $root/ppd/*.ppd /tmp/$user/share/model | |
bd917997 | 182 | ln -s $root/templates /tmp/$user/share |
a61a2be6 | 183 | |
184 | # | |
185 | # Then create the necessary config files... | |
186 | # | |
187 | ||
188 | cat >/tmp/$user/cupsd.conf <<EOF | |
bd917997 | 189 | Browsing Off |
9767abb4 | 190 | FileDevice yes |
27d9c868 | 191 | Printcap |
a61a2be6 | 192 | Listen 127.0.0.1:$port |
193 | User $user | |
194 | ServerRoot /tmp/$user | |
bd917997 | 195 | ServerBin /tmp/$user/bin |
196 | DataDir /tmp/$user/share | |
50b9556e | 197 | FontPath /tmp/$user/share/fonts |
bd917997 | 198 | DocumentRoot $root/doc |
a61a2be6 | 199 | RequestRoot /tmp/$user/spool |
200 | TempDir /tmp/$user/spool/temp | |
254aa207 | 201 | MaxLogSize 0 |
a61a2be6 | 202 | AccessLog /tmp/$user/log/access_log |
203 | ErrorLog /tmp/$user/log/error_log | |
204 | PageLog /tmp/$user/log/page_log | |
dd63ebe2 | 205 | LogLevel debug2 |
bd917997 | 206 | PreserveJobHistory Yes |
a61a2be6 | 207 | <Location /> |
208 | Order deny,allow | |
209 | Deny from all | |
210 | Allow from 127.0.0.1 | |
211 | </Location> | |
212 | <Location /admin> | |
213 | Order deny,allow | |
214 | Deny from all | |
215 | Allow from 127.0.0.1 | |
216 | Require valid-user | |
217 | </Location> | |
5934328c | 218 | <Policy default> |
219 | <Limit All> | |
220 | Order Deny,Allow | |
221 | </Limit> | |
222 | </Policy> | |
a61a2be6 | 223 | EOF |
224 | ||
225 | touch /tmp/$user/classes.conf | |
226 | touch /tmp/$user/printers.conf | |
227 | ||
d47f8ebe | 228 | # |
229 | # Setup lots of test queues - 500 with PPD files, 500 without... | |
230 | # | |
231 | ||
232 | i=1 | |
34271358 | 233 | while test $i -le $nprinters1; do |
d47f8ebe | 234 | cat >>/tmp/$user/printers.conf <<EOF |
235 | <Printer test-$i> | |
236 | Accepting Yes | |
237 | DeviceURI file:/dev/null | |
238 | Info Test PS printer $i | |
239 | JobSheets none none | |
240 | Location CUPS test suite | |
241 | State Idle | |
242 | StateMessage Printer $1 is idle. | |
243 | </Printer> | |
244 | EOF | |
245 | ||
246 | cp testps.ppd /tmp/$user/ppd/test-$i.ppd | |
247 | ||
248 | i=`expr $i + 1` | |
249 | done | |
250 | ||
34271358 | 251 | while test $i -le $nprinters2; do |
d47f8ebe | 252 | cat >>/tmp/$user/printers.conf <<EOF |
253 | <Printer test-$i> | |
254 | Accepting Yes | |
255 | DeviceURI file:/dev/null | |
256 | Info Test raw printer $i | |
257 | JobSheets none none | |
258 | Location CUPS test suite | |
259 | State Idle | |
260 | StateMessage Printer $1 is idle. | |
261 | </Printer> | |
262 | EOF | |
263 | ||
264 | i=`expr $i + 1` | |
265 | done | |
266 | ||
267 | cp /tmp/$user/printers.conf /tmp/$user/printers.conf.orig | |
268 | ||
4124de73 | 269 | cp $root/conf/mime.types /tmp/$user/mime.types |
270 | cp $root/conf/mime.convs /tmp/$user/mime.convs | |
a61a2be6 | 271 | |
bd917997 | 272 | # |
4124de73 | 273 | # Setup the paths... |
bd917997 | 274 | # |
275 | ||
974f62b4 | 276 | if test "x$LD_LIBRARY_PATH" = x; then |
8a18d4da | 277 | LD_LIBRARY_PATH="$root/cups:$root/filter" |
974f62b4 | 278 | else |
8a18d4da | 279 | LD_LIBRARY_PATH="$root/cups:$root/filter:$LD_LIBRARY_PATH" |
974f62b4 | 280 | fi |
281 | ||
282 | export LD_LIBRARY_PATH | |
283 | ||
6f8d474c | 284 | LD_PRELOAD="$root/cups/libcups.so:$root/filter/libcupsimage.so" |
285 | export LD_PRELOAD | |
286 | ||
5f46b7d1 | 287 | if test "x$DYLD_LIBRARY_PATH" = x; then |
8a18d4da | 288 | DYLD_LIBRARY_PATH="$root/cups:$root/filter" |
5f46b7d1 | 289 | else |
8a18d4da | 290 | DYLD_LIBRARY_PATH="$root/cups:$root/filter:$DYLD_LIBRARY_PATH" |
5f46b7d1 | 291 | fi |
292 | ||
8a18d4da | 293 | export SHLIB_PATH |
294 | ||
295 | if test "x$SHLIB_PATH" = x; then | |
296 | SHLIB_PATH="$root/cups:$root/filter" | |
297 | else | |
298 | SHLIB_PATH="$root/cups:$root/filter:$SHLIB_PATH" | |
299 | fi | |
300 | ||
301 | export SHLIB_PATH | |
5f46b7d1 | 302 | |
4124de73 | 303 | CUPS_SERVERROOT=/tmp/$user; export CUPS_SERVERROOT |
304 | CUPS_DATADIR=/tmp/$user/share; export CUPS_DATADIR | |
bd917997 | 305 | |
74464516 | 306 | # |
307 | # Set a new home directory to avoid getting user options mixed in... | |
308 | # | |
309 | ||
310 | HOME=/tmp/$user | |
311 | export HOME | |
312 | ||
a61a2be6 | 313 | # |
314 | # Start the server; run as foreground daemon in the background... | |
315 | # | |
316 | ||
ba886a95 | 317 | echo "Starting scheduler:" |
318 | echo " $valgrind ../scheduler/cupsd -c /tmp/$user/cupsd.conf -f >/tmp/$user/log/debug_log &" | |
3f5dfefd | 319 | echo "" |
a61a2be6 | 320 | |
ff40b65e | 321 | $valgrind ../scheduler/cupsd -c /tmp/$user/cupsd.conf -f >/tmp/$user/log/debug_log & |
a61a2be6 | 322 | cupsd=$! |
323 | ||
d47f8ebe | 324 | #if test -x /usr/bin/strace; then |
325 | # # Trace system calls in cupsd if we have strace... | |
326 | # /usr/bin/strace -tt -o /tmp/$user/log/cupsd.trace -p $cupsd & | |
327 | #fi | |
18fe941f | 328 | |
3f5dfefd | 329 | if test "x$testtype" = x0; then |
330 | echo "Scheduler is PID $cupsd and is listening on port 8631." | |
331 | echo "" | |
332 | echo "Set the IPP_PORT environment variable to 8631 to test the software" | |
333 | echo "interactively from the command-line." | |
334 | exit 0 | |
335 | fi | |
336 | ||
974f62b4 | 337 | echo "Scheduler is PID $cupsd; run debugger now if you need to." |
338 | echo "" | |
339 | echo "Press ENTER to continue..." | |
340 | read junk | |
341 | ||
a61a2be6 | 342 | IPP_PORT=$port; export IPP_PORT |
343 | ||
344 | while true; do | |
a61a2be6 | 345 | running=`../systemv/lpstat -r 2>/dev/null` |
346 | if test "x$running" = "xscheduler is running"; then | |
347 | break | |
348 | fi | |
349 | ||
bd917997 | 350 | echo "Waiting for scheduler to become ready..." |
351 | sleep 10 | |
a61a2be6 | 352 | done |
353 | ||
354 | # | |
74464516 | 355 | # Create the test report source file... |
a61a2be6 | 356 | # |
357 | ||
974f62b4 | 358 | strfile=cups-str-1.2-`date +%Y-%m-%d`-`whoami`.shtml |
74464516 | 359 | |
360 | rm -f $strfile | |
361 | cat str-header.html >$strfile | |
362 | ||
363 | # | |
364 | # Run the IPP tests... | |
365 | # | |
a61a2be6 | 366 | |
74464516 | 367 | echo "Running IPP compliance tests..." |
a61a2be6 | 368 | |
74464516 | 369 | echo "<H1>IPP Compliance Tests</H1>" >>$strfile |
370 | echo "<P>This section provides the results to the IPP compliance tests" >>$strfile | |
371 | echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
372 | echo `date "+%Y-%m-%d"` by `whoami` on `hostname`. >>$strfile | |
373 | echo "<PRE>" >>$strfile | |
a61a2be6 | 374 | |
74464516 | 375 | fail=0 |
376 | for file in 4*.test; do | |
bd917997 | 377 | echo "Performing $file..." |
74464516 | 378 | echo "" >>$strfile |
bd917997 | 379 | |
4124de73 | 380 | ./ipptest ipp://localhost:$port/printers $file >>$strfile |
bd917997 | 381 | status=$? |
382 | ||
383 | if test $status != 0; then | |
74464516 | 384 | echo Test failed. |
974f62b4 | 385 | fail=`expr $fail + 1` |
bd917997 | 386 | fi |
a61a2be6 | 387 | done |
388 | ||
74464516 | 389 | echo "</PRE>" >>$strfile |
390 | ||
391 | # | |
392 | # Run the command tests... | |
393 | # | |
394 | ||
395 | echo "Running command tests..." | |
396 | ||
397 | echo "<H1>Command Tests</H1>" >>$strfile | |
398 | echo "<P>This section provides the results to the command tests" >>$strfile | |
399 | echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile | |
400 | echo `date "+%Y-%m-%d"` by `whoami` on `hostname`. >>$strfile | |
401 | echo "<PRE>" >>$strfile | |
402 | ||
74464516 | 403 | for file in 5*.sh; do |
404 | echo "Performing $file..." | |
405 | echo "" >>$strfile | |
50b9556e | 406 | echo "\"$file\":" >>$strfile |
74464516 | 407 | |
34271358 | 408 | sh $file $pjobs >>$strfile |
74464516 | 409 | status=$? |
410 | ||
411 | if test $status != 0; then | |
412 | echo Test failed. | |
974f62b4 | 413 | fail=`expr $fail + 1` |
74464516 | 414 | fi |
415 | done | |
416 | ||
417 | echo "</PRE>" >>$strfile | |
a61a2be6 | 418 | |
bd917997 | 419 | # |
420 | # Wait for jobs to complete... | |
421 | # | |
422 | ||
423 | while true; do | |
424 | jobs=`../systemv/lpstat 2>/dev/null` | |
425 | if test "x$jobs" = "x"; then | |
426 | break | |
427 | fi | |
428 | ||
429 | echo "Waiting for jobs to complete..." | |
430 | sleep 10 | |
431 | done | |
432 | ||
a61a2be6 | 433 | # |
434 | # Stop the server... | |
435 | # | |
436 | ||
437 | kill $cupsd | |
438 | ||
439 | # | |
74464516 | 440 | # Append the log files for post-mortim... |
441 | # | |
442 | ||
443 | echo "<H1>Log Files</H1>" >>$strfile | |
444 | ||
445 | echo "<H2>access_log</H2>" >>$strfile | |
446 | echo "<PRE>" >>$strfile | |
447 | cat /tmp/$user/log/access_log >>$strfile | |
448 | echo "</PRE>" >>$strfile | |
449 | ||
450 | echo "<H2>error_log</H2>" >>$strfile | |
451 | echo "<PRE>" >>$strfile | |
452 | cat /tmp/$user/log/error_log >>$strfile | |
453 | echo "</PRE>" >>$strfile | |
454 | ||
455 | echo "<H2>page_log</H2>" >>$strfile | |
456 | echo "<PRE>" >>$strfile | |
457 | cat /tmp/$user/log/page_log >>$strfile | |
458 | echo "</PRE>" >>$strfile | |
459 | ||
18fe941f | 460 | if test -f /tmp/$user/log/cupsd.trace; then |
461 | echo "<H2>cupsd.trace</H2>" >>$strfile | |
462 | echo "<PRE>" >>$strfile | |
463 | cat /tmp/$user/log/cupsd.trace >>$strfile | |
464 | echo "</PRE>" >>$strfile | |
465 | fi | |
466 | ||
74464516 | 467 | # |
468 | # Format the reports and tell the user where to find them... | |
469 | # | |
470 | ||
dbb05cda | 471 | echo "Formatting reports..." |
74464516 | 472 | |
dbb05cda | 473 | cat str-trailer.html >>$strfile |
74464516 | 474 | |
475 | htmlfile=`basename $strfile .shtml`.html | |
476 | pdffile=`basename $strfile .shtml`.pdf | |
477 | ||
478 | htmldoc --numbered --verbose --titleimage ../doc/images/cups-large.gif \ | |
479 | -f $htmlfile $strfile | |
480 | htmldoc --numbered --verbose --titleimage ../doc/images/cups-large.gif \ | |
481 | -f $pdffile $strfile | |
482 | ||
74464516 | 483 | echo "" |
484 | ||
485 | if test $fail != 0; then | |
974f62b4 | 486 | echo "$fail tests failed." |
74464516 | 487 | else |
974f62b4 | 488 | echo "All tests were successful." |
74464516 | 489 | fi |
490 | ||
59406620 | 491 | if test "x$valgrind" != x; then |
cf859e99 | 492 | echo "Valgrind log files can be found in /tmp/$user/log." |
59406620 | 493 | fi |
494 | ||
74464516 | 495 | echo "" |
496 | echo "See the following files for details:" | |
497 | echo "" | |
498 | echo " $htmlfile" | |
499 | echo " $pdffile" | |
500 | echo "" | |
501 | ||
502 | # | |
5934328c | 503 | # End of "$Id: run-stp-tests.sh,v 1.4.2.22 2004/06/30 21:18:32 mike Exp $" |
a61a2be6 | 504 | # |