]>
git.ipfire.org Git - thirdparty/cups.git/blob - test/run-stp-tests.sh
5 # Perform the complete set of IPP compliance tests specified in the
6 # CUPS Software Test Plan.
8 # Copyright 1997-2005 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
28 # Make the IPP test program...
37 echo "Welcome to the CUPS Automated Test Script."
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?"
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:"
50 echo "0 - No testing, keep the scheduler running for me (all systems)"
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)"
56 echo "Please enter the number of the test you wish to perform:"
62 echo "Running in test mode (0)"
68 echo "Running the medium tests (2)"
74 echo "Running the extreme tests (3)"
80 echo "Running the torture tests (4)"
86 echo "Running the timid tests (1)"
94 # See if we want to do SSL testing...
98 echo "Now you can choose whether to create a SSL/TLS encryption key and"
99 echo "certificate for testing; these tests currently require the OpenSSL"
102 echo "0 - Do not do SSL/TLS encryption tests"
103 echo "1 - Create a SSL/TLS certificate and key, but do not require encryption"
104 echo "2 - Create a SSL/TLS certificate and key and require encryption"
111 if test -f server.key
; then
112 echo "Using existing SSL/TLS certificate and key..."
114 echo "Generating SSL/TLS certificate and key..."
115 openssl req
-new -x509 -keyout server.key
-out server.crt
-days 3650 -nodes >/dev
/null
<<EOF
128 echo "Not using SSL/TLS ($ssltype)..."
134 # Information for the server/tests...
143 # Make sure that the LPDEST and PRINTER environment variables are
144 # not included in the environment that is passed to the tests. These
145 # will usually cause tests to fail erroneously...
152 # See if we want to use valgrind...
156 echo "This test script can use the Valgrind software from:"
158 echo " http://developer.kde.org/~sewardj/"
160 echo "Please enter Y to use Valgrind or N to not use Valgrind:"
164 case "$usevalgrind" in
166 valgrind
="valgrind --tool=memcheck --logfile=/tmp/$user/log/valgrind --error-limit=no --leak-check=yes --trace-children=yes"
167 echo "Using Valgrind; log files can be found in /tmp/$user/log..."
176 # Start by creating temporary directories for the tests...
182 mkdir
/tmp
/$user/bin
/backend
183 mkdir
/tmp
/$user/bin
/filter
184 mkdir
/tmp
/$user/certs
185 mkdir
/tmp
/$user/share
186 mkdir
/tmp
/$user/share
/banners
187 mkdir
/tmp
/$user/share
/model
188 mkdir
/tmp
/$user/interfaces
191 mkdir
/tmp
/$user/spool
192 mkdir
/tmp
/$user/spool
/temp
195 ln -s $root/backend
/http
/tmp
/$user/bin
/backend
196 ln -s $root/backend
/ipp
/tmp
/$user/bin
/backend
197 ln -s $root/backend
/lpd
/tmp
/$user/bin
/backend
198 ln -s $root/backend
/parallel
/tmp
/$user/bin
/backend
199 ln -s $root/backend
/serial
/tmp
/$user/bin
/backend
200 ln -s $root/backend
/socket
/tmp
/$user/bin
/backend
201 ln -s $root/backend
/usb
/tmp
/$user/bin
/backend
202 ln -s $root/cgi-bin
/tmp
/$user/bin
203 ln -s $root/scheduler
/tmp
/$user/bin
/daemon
204 ln -s $root/filter
/hpgltops
/tmp
/$user/bin
/filter
205 ln -s $root/filter
/imagetops
/tmp
/$user/bin
/filter
206 ln -s $root/filter
/imagetoraster
/tmp
/$user/bin
/filter
207 ln -s $root/filter
/pstops
/tmp
/$user/bin
/filter
208 ln -s $root/filter
/rastertoepson
/tmp
/$user/bin
/filter
209 ln -s $root/filter
/rastertohp
/tmp
/$user/bin
/filter
210 ln -s $root/filter
/texttops
/tmp
/$user/bin
/filter
211 ln -s $root/pdftops
/pdftops
/tmp
/$user/bin
/filter
213 ln -s $root/data
/classified
/tmp
/$user/share
/banners
214 ln -s $root/data
/confidential
/tmp
/$user/share
/banners
215 ln -s $root/data
/secret
/tmp
/$user/share
/banners
216 ln -s $root/data
/standard
/tmp
/$user/share
/banners
217 ln -s $root/data
/topsecret
/tmp
/$user/share
/banners
218 ln -s $root/data
/unclassified
/tmp
/$user/share
/banners
219 ln -s $root/data
/tmp
/$user/share
/charsets
220 ln -s $root/data
/tmp
/$user/share
221 ln -s $root/fonts
/tmp
/$user/share
222 ln -s $root/ppd
/*.ppd
/tmp
/$user/share
/model
223 ln -s $root/templates
/tmp
/$user/share
225 if test $ssltype != 0; then
227 cp server.
* $root/ssl
231 # Then create the necessary config files...
234 if test $ssltype = 2; then
235 encryption
="Encryption Required"
240 cat >/tmp
/$user/cupsd.conf
<<EOF
244 Listen 127.0.0.1:$port
246 ServerRoot /tmp/$user
248 ServerBin /tmp/$user/bin
249 CacheDir /tmp/$user/share
250 DataDir /tmp/$user/share
251 FontPath /tmp/$user/share/fonts
252 DocumentRoot $root/doc
253 RequestRoot /tmp/$user/spool
254 TempDir /tmp/$user/spool/temp
256 AccessLog /tmp/$user/log/access_log
257 ErrorLog /tmp/$user/log/error_log
258 PageLog /tmp/$user/log/page_log
260 PreserveJobHistory Yes
281 touch /tmp
/$user/classes.conf
282 touch /tmp
/$user/printers.conf
285 # Setup lots of test queues - 500 with PPD files, 500 without...
289 while test $i -le $nprinters1; do
290 cat >>/tmp
/$user/printers.conf
<<EOF
293 DeviceURI file:/dev/null
294 Info Test PS printer $i
296 Location CUPS test suite
298 StateMessage Printer $1 is idle.
302 cp testps.ppd
/tmp
/$user/ppd
/test-
$i.ppd
307 while test $i -le $nprinters2; do
308 cat >>/tmp
/$user/printers.conf
<<EOF
311 DeviceURI file:/dev/null
312 Info Test raw printer $i
314 Location CUPS test suite
316 StateMessage Printer $1 is idle.
323 cp /tmp
/$user/printers.conf
/tmp
/$user/printers.conf.orig
325 cp $root/conf
/mime.types
/tmp
/$user/mime.types
326 cp $root/conf
/mime.convs
/tmp
/$user/mime.convs
332 if test "x$LD_LIBRARY_PATH" = x
; then
333 LD_LIBRARY_PATH
="$root/cups:$root/filter"
335 LD_LIBRARY_PATH
="$root/cups:$root/filter:$LD_LIBRARY_PATH"
338 export LD_LIBRARY_PATH
340 LD_PRELOAD
="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2"
343 if test "x$DYLD_LIBRARY_PATH" = x
; then
344 DYLD_LIBRARY_PATH
="$root/cups:$root/filter"
346 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$DYLD_LIBRARY_PATH"
349 export DYLD_LIBRARY_PATH
351 if test "x$SHLIB_PATH" = x
; then
352 SHLIB_PATH
="$root/cups:$root/filter"
354 SHLIB_PATH
="$root/cups:$root/filter:$SHLIB_PATH"
359 CUPS_SERVERROOT
=/tmp
/$user; export CUPS_SERVERROOT
360 CUPS_STATEDIR
=/tmp
/$user; export CUPS_STATEDIR
361 CUPS_DATADIR
=/tmp
/$user/share
; export CUPS_DATADIR
364 # Set a new home directory to avoid getting user options mixed in...
371 # Start the server; run as foreground daemon in the background...
374 echo "Starting scheduler:"
375 echo " $valgrind ../scheduler/cupsd -c /tmp/$user/cupsd.conf -f >/tmp/$user/log/debug_log &"
378 $valgrind ..
/scheduler
/cupsd
-c /tmp
/$user/cupsd.conf
-f >/tmp
/$user/log
/debug_log
&
381 #if test -x /usr/bin/strace; then
382 # # Trace system calls in cupsd if we have strace...
383 # /usr/bin/strace -tt -o /tmp/$user/log/cupsd.trace -p $cupsd &
386 if test "x$testtype" = x0
; then
387 echo "Scheduler is PID $cupsd and is listening on port 8631."
389 echo "Set the IPP_PORT environment variable to 8631 to test the software"
390 echo "interactively from the command-line."
394 echo "Scheduler is PID $cupsd; run debugger now if you need to."
396 echo "Press ENTER to continue..."
399 IPP_PORT
=$port; export IPP_PORT
402 running
=`../systemv/lpstat -r 2>/dev/null`
403 if test "x$running" = "xscheduler is running"; then
407 echo "Waiting for scheduler to become ready..."
412 # Create the test report source file...
415 strfile
=cups-str-1.2
-`date +%Y-%m-%d`-`whoami`.shtml
418 cat str-header.html
>$strfile
421 # Run the IPP tests...
424 echo "Running IPP compliance tests..."
426 echo "<H1>IPP Compliance Tests</H1>" >>$strfile
427 echo "<P>This section provides the results to the IPP compliance tests" >>$strfile
428 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
429 echo `date "+%Y-%m-%d"` by
`whoami` on
`hostname`.
>>$strfile
430 echo "<PRE>" >>$strfile
433 for file in 4*.
test; do
434 echo "Performing $file..."
437 .
/ipptest ipp
://localhost
:$port/printers
$file >>$strfile
440 if test $status != 0; then
442 fail
=`expr $fail + 1`
446 echo "</PRE>" >>$strfile
449 # Run the command tests...
452 echo "Running command tests..."
454 echo "<H1>Command Tests</H1>" >>$strfile
455 echo "<P>This section provides the results to the command tests" >>$strfile
456 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
457 echo `date "+%Y-%m-%d"` by
`whoami` on
`hostname`.
>>$strfile
458 echo "<PRE>" >>$strfile
460 for file in 5*.sh
; do
461 echo "Performing $file..."
463 echo "\"$file\":" >>$strfile
465 sh
$file $pjobs >>$strfile
468 if test $status != 0; then
470 fail
=`expr $fail + 1`
474 echo "</PRE>" >>$strfile
477 # Wait for jobs to complete...
481 jobs=`../systemv/lpstat 2>/dev/null`
482 if test "x$jobs" = "x"; then
486 echo "Waiting for jobs to complete..."
497 # Append the log files for post-mortim...
500 echo "<H1>Log Files</H1>" >>$strfile
502 echo "<H2>access_log</H2>" >>$strfile
503 echo "<PRE>" >>$strfile
504 cat /tmp
/$user/log
/access_log
>>$strfile
505 echo "</PRE>" >>$strfile
507 echo "<H2>error_log</H2>" >>$strfile
508 echo "<PRE>" >>$strfile
509 cat /tmp
/$user/log
/error_log
>>$strfile
510 echo "</PRE>" >>$strfile
512 echo "<H2>page_log</H2>" >>$strfile
513 echo "<PRE>" >>$strfile
514 cat /tmp
/$user/log
/page_log
>>$strfile
515 echo "</PRE>" >>$strfile
517 if test -f /tmp
/$user/log
/cupsd.trace
; then
518 echo "<H2>cupsd.trace</H2>" >>$strfile
519 echo "<PRE>" >>$strfile
520 cat /tmp
/$user/log
/cupsd.trace
>>$strfile
521 echo "</PRE>" >>$strfile
525 # Format the reports and tell the user where to find them...
528 echo "Formatting reports..."
530 cat str-trailer.html
>>$strfile
532 htmlfile
=`basename $strfile .shtml`.html
533 pdffile
=`basename $strfile .shtml`.pdf
535 htmldoc
--numbered --verbose --titleimage ..
/doc
/images
/cups-large.gif \
536 -f $htmlfile $strfile
537 htmldoc
--numbered --verbose --titleimage ..
/doc
/images
/cups-large.gif \
542 if test $fail != 0; then
543 echo "$fail tests failed."
545 echo "All tests were successful."
548 if test "x$valgrind" != x
; then
549 echo "Valgrind log files can be found in /tmp/$user/log."
553 echo "See the following files for details:"