]>
git.ipfire.org Git - thirdparty/cups.git/blob - test/run-stp-tests.sh
659a68a3a81446bb62fae7a9dc26a743c3bcc562
3 # "$Id: run-stp-tests.sh 177 2006-06-21 00:20:03Z jlovell $"
5 # Perform the complete set of IPP compliance tests specified in the
6 # CUPS Software Test Plan.
8 # Copyright 1997-2006 by Easy Software Products, all rights reserved.
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
17 # Attn: CUPS Licensing Information
18 # Easy Software Products
19 # 44141 Airport View Drive, Suite 204
20 # Hollywood, Maryland 20636 USA
22 # Voice: (301) 373-9600
23 # EMail: cups-info@cups.org
24 # WWW: http://www.cups.org
30 # Make the IPP test program...
36 # Figure out the proper echo options...
39 if (echo "testing\c"; echo 1,2,3) |
grep c
>/dev
/null
; then
51 echo "Welcome to the CUPS Automated Test Script."
53 echo "Before we begin, it is important that you understand that the larger"
54 echo "tests require significant amounts of RAM and disk space. If you"
55 echo "attempt to run one of the big tests on a system that lacks sufficient"
56 echo "disk and virtual memory, the UNIX kernel might decide to kill one or"
57 echo "more system processes that you've grown attached to, like the X"
58 echo "server. The question you may want to ask yourself before running a"
59 echo "large test is: Do you feel lucky?"
61 echo "OK, now that we have the Dirty Harry quote out of the way, please"
62 echo "choose the type of test you wish to perform:"
64 echo "0 - No testing, keep the scheduler running for me (all systems)"
65 echo "1 - Basic conformance test, no load testing (all systems)"
66 echo "2 - Basic conformance test, some load testing (minimum 256MB VM, 50MB disk)"
67 echo "3 - Basic conformance test, extreme load testing (minimum 1GB VM, 500MB disk)"
68 echo "4 - Basic conformance test, torture load testing (minimum 2GB VM, 1GB disk)"
70 echo $ac_n "Enter the number of the test you wish to perform: [1] $ac_c"
72 if test $# -gt 0; then
82 echo "Running in test mode (0)"
88 echo "Running the medium tests (2)"
94 echo "Running the extreme tests (3)"
100 echo "Running the torture tests (4)"
106 echo "Running the timid tests (1)"
114 # See if we want to do SSL testing...
118 echo "Now you can choose whether to create a SSL/TLS encryption key and"
119 echo "certificate for testing; these tests currently require the OpenSSL"
122 echo "0 - Do not do SSL/TLS encryption tests"
123 echo "1 - Create a SSL/TLS certificate and key, but do not require encryption"
124 echo "2 - Create a SSL/TLS certificate and key and require encryption"
126 echo $ac_n "Enter the number of the SSL/TLS tests to perform: [0] $ac_c"
128 if test $# -gt 0; then
138 if test -f server.key
; then
139 echo "Using existing SSL/TLS certificate and key..."
141 echo "Generating SSL/TLS certificate and key..."
142 openssl req
-new -x509 -keyout server.key
-out server.crt
-days 3650 -nodes >/dev
/null
<<EOF
155 echo "Not using SSL/TLS..."
161 # Information for the server/tests...
165 if test -z "$user"; then
166 if test -x /usr
/ucb
/whoami
; then
167 user
=`/usr/ucb/whoami`
172 if test -z "$user"; then
182 # Make sure that the LPDEST and PRINTER environment variables are
183 # not included in the environment that is passed to the tests. These
184 # will usually cause tests to fail erroneously...
191 # See if we want to use valgrind...
195 echo "This test script can use the Valgrind software from:"
197 echo " http://developer.kde.org/~sewardj/"
199 echo $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c"
201 if test $# -gt 0; then
209 case "$usevalgrind" in
211 valgrind
="valgrind --tool=memcheck --log-file=/tmp/cups-$user/log/valgrind --error-limit=no --leak-check=yes --trace-children=yes"
212 echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..."
221 # Start by creating temporary directories for the tests...
224 echo "Creating directories for test..."
226 rm -rf /tmp
/cups-
$user
227 mkdir
/tmp
/cups-
$user
228 mkdir
/tmp
/cups-
$user/bin
229 mkdir
/tmp
/cups-
$user/bin
/backend
230 mkdir
/tmp
/cups-
$user/bin
/filter
231 mkdir
/tmp
/cups-
$user/certs
232 mkdir
/tmp
/cups-
$user/share
233 mkdir
/tmp
/cups-
$user/share
/banners
234 mkdir
/tmp
/cups-
$user/share
/model
235 mkdir
/tmp
/cups-
$user/interfaces
236 mkdir
/tmp
/cups-
$user/log
237 mkdir
/tmp
/cups-
$user/ppd
238 mkdir
/tmp
/cups-
$user/spool
239 mkdir
/tmp
/cups-
$user/spool
/temp
240 mkdir
/tmp
/cups-
$user/ssl
242 ln -s $root/backend
/http
/tmp
/cups-
$user/bin
/backend
243 ln -s $root/backend
/ipp
/tmp
/cups-
$user/bin
/backend
244 ln -s $root/backend
/lpd
/tmp
/cups-
$user/bin
/backend
245 ln -s $root/backend
/parallel
/tmp
/cups-
$user/bin
/backend
246 ln -s $root/backend
/serial
/tmp
/cups-
$user/bin
/backend
247 ln -s $root/backend
/snmp
/tmp
/cups-
$user/bin
/backend
248 ln -s $root/backend
/socket
/tmp
/cups-
$user/bin
/backend
249 ln -s $root/backend
/usb
/tmp
/cups-
$user/bin
/backend
250 ln -s $root/cgi-bin
/tmp
/cups-
$user/bin
251 ln -s $root/monitor
/tmp
/cups-
$user/bin
252 ln -s $root/notifier
/tmp
/cups-
$user/bin
253 ln -s $root/scheduler
/tmp
/cups-
$user/bin
/daemon
254 ln -s $root/filter
/hpgltops
/tmp
/cups-
$user/bin
/filter
255 ln -s $root/filter
/imagetops
/tmp
/cups-
$user/bin
/filter
256 ln -s $root/filter
/imagetoraster
/tmp
/cups-
$user/bin
/filter
257 ln -s $root/filter
/pstops
/tmp
/cups-
$user/bin
/filter
258 ln -s $root/filter
/rastertoepson
/tmp
/cups-
$user/bin
/filter
259 ln -s $root/filter
/rastertohp
/tmp
/cups-
$user/bin
/filter
260 ln -s $root/filter
/texttops
/tmp
/cups-
$user/bin
/filter
261 ln -s $root/pdftops
/pdftops
/tmp
/cups-
$user/bin
/filter
263 ln -s $root/data
/classified
/tmp
/cups-
$user/share
/banners
264 ln -s $root/data
/confidential
/tmp
/cups-
$user/share
/banners
265 ln -s $root/data
/secret
/tmp
/cups-
$user/share
/banners
266 ln -s $root/data
/standard
/tmp
/cups-
$user/share
/banners
267 ln -s $root/data
/topsecret
/tmp
/cups-
$user/share
/banners
268 ln -s $root/data
/unclassified
/tmp
/cups-
$user/share
/banners
269 ln -s $root/data
/tmp
/cups-
$user/share
/charmaps
270 ln -s $root/data
/tmp
/cups-
$user/share
/charsets
271 ln -s $root/data
/tmp
/cups-
$user/share
272 ln -s $root/fonts
/tmp
/cups-
$user/share
273 ln -s $root/ppd
/*.ppd
/tmp
/cups-
$user/share
/model
274 ln -s $root/templates
/tmp
/cups-
$user/share
276 if test $ssltype != 0; then
278 cp server.
* $root/ssl
282 # Then create the necessary config files...
285 echo "Creating cupsd.conf for test..."
287 if test $ssltype = 2; then
288 encryption
="Encryption Required"
293 cat >/tmp
/cups-
$user/cupsd.conf
<<EOF
297 Listen 127.0.0.1:$port
299 ServerRoot /tmp/cups-$user
300 StateDir /tmp/cups-$user
301 ServerBin /tmp/cups-$user/bin
302 CacheDir /tmp/cups-$user/share
303 DataDir /tmp/cups-$user/share
304 FontPath /tmp/cups-$user/share/fonts
305 DocumentRoot $root/doc
306 RequestRoot /tmp/cups-$user/spool
307 TempDir /tmp/cups-$user/spool/temp
309 AccessLog /tmp/cups-$user/log/access_log
310 ErrorLog /tmp/cups-$user/log/error_log
311 PageLog /tmp/cups-$user/log/page_log
313 PreserveJobHistory Yes
324 touch /tmp
/cups-
$user/classes.conf
325 touch /tmp
/cups-
$user/printers.conf
328 # Setup lots of test queues - 500 with PPD files, 500 without...
331 echo "Creating printers.conf for test..."
334 while test $i -le $nprinters1; do
335 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
338 DeviceURI file:/dev/null
339 Info Test PS printer $i
341 Location CUPS test suite
343 StateMessage Printer $1 is idle.
347 cp testps.ppd
/tmp
/cups-
$user/ppd
/test-
$i.ppd
352 while test $i -le $nprinters2; do
353 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
356 DeviceURI file:/dev/null
357 Info Test raw printer $i
359 Location CUPS test suite
361 StateMessage Printer $1 is idle.
368 cp /tmp
/cups-
$user/printers.conf
/tmp
/cups-
$user/printers.conf.orig
370 cp $root/conf
/mime.types
/tmp
/cups-
$user/mime.types
371 cp $root/conf
/mime.convs
/tmp
/cups-
$user/mime.convs
377 echo "Setting up environment variables for test..."
379 if test "x$LD_LIBRARY_PATH" = x
; then
380 LD_LIBRARY_PATH
="$root/cups:$root/filter"
382 LD_LIBRARY_PATH
="$root/cups:$root/filter:$LD_LIBRARY_PATH"
385 export LD_LIBRARY_PATH
387 LD_PRELOAD
="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2"
390 if test "x$DYLD_LIBRARY_PATH" = x
; then
391 DYLD_LIBRARY_PATH
="$root/cups:$root/filter"
393 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$DYLD_LIBRARY_PATH"
396 export DYLD_LIBRARY_PATH
398 if test "x$SHLIB_PATH" = x
; then
399 SHLIB_PATH
="$root/cups:$root/filter"
401 SHLIB_PATH
="$root/cups:$root/filter:$SHLIB_PATH"
406 CUPS_SERVER
=localhost
; export CUPS_SERVER
407 CUPS_SERVERROOT
=/tmp
/cups-
$user; export CUPS_SERVERROOT
408 CUPS_STATEDIR
=/tmp
/cups-
$user; export CUPS_STATEDIR
409 CUPS_DATADIR
=/tmp
/cups-
$user/share
; export CUPS_DATADIR
412 # Set a new home directory to avoid getting user options mixed in...
419 # Start the server; run as foreground daemon in the background...
422 echo "Starting scheduler:"
423 echo " $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &"
426 $valgrind ..
/scheduler
/cupsd
-c /tmp
/cups-
$user/cupsd.conf
-f >/tmp
/cups-
$user/log
/debug_log
2>&1 &
429 #if test -x /usr/bin/strace; then
430 # # Trace system calls in cupsd if we have strace...
431 # /usr/bin/strace -tt -o /tmp/cups-$user/log/cupsd.trace -p $cupsd &
434 if test "x$testtype" = x0
; then
435 echo "Scheduler is PID $cupsd and is listening on port 8631."
437 echo "Set the IPP_PORT environment variable to 8631 to test the software"
438 echo "interactively from the command-line."
442 if test $argcount -eq 0; then
443 echo "Scheduler is PID $cupsd; run debugger now if you need to."
445 echo $ac_n "Press ENTER to continue... $ac_c"
448 echo "Scheduler is PID $cupsd."
452 IPP_PORT
=$port; export IPP_PORT
455 running
=`../systemv/lpstat -r 2>/dev/null`
456 if test "x$running" = "xscheduler is running"; then
460 echo "Waiting for scheduler to become ready..."
465 # Create the test report source file...
468 strfile
=cups-str-1.2
-`date +%Y-%m-%d`-$user.html
471 cat str-header.html
>$strfile
474 # Run the IPP tests...
478 echo "Running IPP compliance tests..."
480 echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile
481 echo "<P>This section provides the results to the IPP compliance tests" >>$strfile
482 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
483 echo `date "+%Y-%m-%d"` by
$user on
`hostname`.
>>$strfile
484 echo "<PRE>" >>$strfile
487 for file in 4*.
test; do
488 echo "Performing $file..."
491 .
/ipptest ipp
://localhost
:$port/printers
$file >>$strfile
494 if test $status != 0; then
496 fail
=`expr $fail + 1`
500 echo "</PRE>" >>$strfile
503 # Run the command tests...
507 echo "Running command tests..."
509 echo "<H1>2 - Command Tests</H1>" >>$strfile
510 echo "<P>This section provides the results to the command tests" >>$strfile
511 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
512 echo `date "+%Y-%m-%d"` by
$user on
`hostname`.
>>$strfile
513 echo "<PRE>" >>$strfile
515 for file in 5*.sh
; do
516 echo "Performing $file..."
518 echo "\"$file\":" >>$strfile
520 sh
$file $pjobs >>$strfile
523 if test $status != 0; then
525 fail
=`expr $fail + 1`
529 echo "</PRE>" >>$strfile
532 # Wait for jobs to complete...
536 jobs=`../systemv/lpstat 2>/dev/null`
537 if test "x$jobs" = "x"; then
541 echo "Waiting for jobs to complete..."
552 # Append the log files for post-mortim...
555 echo "<H1>3 - Log Files</H1>" >>$strfile
557 echo "<H2>access_log</H2>" >>$strfile
558 echo "<PRE>" >>$strfile
559 cat /tmp
/cups-
$user/log
/access_log
>>$strfile
560 echo "</PRE>" >>$strfile
562 echo "<H2>error_log</H2>" >>$strfile
563 echo "<PRE>" >>$strfile
564 cat /tmp
/cups-
$user/log
/error_log
>>$strfile
565 echo "</PRE>" >>$strfile
567 echo "<H2>page_log</H2>" >>$strfile
568 echo "<PRE>" >>$strfile
569 cat /tmp
/cups-
$user/log
/page_log
>>$strfile
570 echo "</PRE>" >>$strfile
572 if test -f /tmp
/cups-
$user/log
/cupsd.trace
; then
573 echo "<H2>cupsd.trace</H2>" >>$strfile
574 echo "<PRE>" >>$strfile
575 cat /tmp
/cups-
$user/log
/cupsd.trace
>>$strfile
576 echo "</PRE>" >>$strfile
580 # Format the reports and tell the user where to find them...
583 cat str-trailer.html
>>$strfile
587 if test $fail != 0; then
588 echo "$fail tests failed."
590 echo "All tests were successful."
593 echo "Log files can be found in /tmp/cups-$user/log."
594 echo "A HTML report was created in test/$strfile."
598 # End of "$Id: run-stp-tests.sh 177 2006-06-21 00:20:03Z jlovell $"