]>
git.ipfire.org Git - thirdparty/cups.git/blob - test/run-stp-tests.sh
3 # "$Id: run-stp-tests.sh 4891 2006-01-07 04:50:14Z mike $"
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 --log-file=/tmp/cups-$user/log/valgrind --error-limit=no --leak-check=yes --trace-children=yes"
167 echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..."
176 # Start by creating temporary directories for the tests...
179 rm -rf /tmp
/cups-
$user
180 mkdir
/tmp
/cups-
$user
181 mkdir
/tmp
/cups-
$user/bin
182 mkdir
/tmp
/cups-
$user/bin
/backend
183 mkdir
/tmp
/cups-
$user/bin
/filter
184 mkdir
/tmp
/cups-
$user/certs
185 mkdir
/tmp
/cups-
$user/share
186 mkdir
/tmp
/cups-
$user/share
/banners
187 mkdir
/tmp
/cups-
$user/share
/model
188 mkdir
/tmp
/cups-
$user/interfaces
189 mkdir
/tmp
/cups-
$user/log
190 mkdir
/tmp
/cups-
$user/ppd
191 mkdir
/tmp
/cups-
$user/spool
192 mkdir
/tmp
/cups-
$user/spool
/temp
193 mkdir
/tmp
/cups-
$user/ssl
195 ln -s $root/backend
/http
/tmp
/cups-
$user/bin
/backend
196 ln -s $root/backend
/ipp
/tmp
/cups-
$user/bin
/backend
197 ln -s $root/backend
/lpd
/tmp
/cups-
$user/bin
/backend
198 ln -s $root/backend
/parallel
/tmp
/cups-
$user/bin
/backend
199 ln -s $root/backend
/serial
/tmp
/cups-
$user/bin
/backend
200 ln -s $root/backend
/socket
/tmp
/cups-
$user/bin
/backend
201 ln -s $root/backend
/usb
/tmp
/cups-
$user/bin
/backend
202 ln -s $root/cgi-bin
/tmp
/cups-
$user/bin
203 ln -s $root/notifier
/tmp
/cups-
$user/bin
204 ln -s $root/scheduler
/tmp
/cups-
$user/bin
/daemon
205 ln -s $root/filter
/hpgltops
/tmp
/cups-
$user/bin
/filter
206 ln -s $root/filter
/imagetops
/tmp
/cups-
$user/bin
/filter
207 ln -s $root/filter
/imagetoraster
/tmp
/cups-
$user/bin
/filter
208 ln -s $root/filter
/pstops
/tmp
/cups-
$user/bin
/filter
209 ln -s $root/filter
/rastertoepson
/tmp
/cups-
$user/bin
/filter
210 ln -s $root/filter
/rastertohp
/tmp
/cups-
$user/bin
/filter
211 ln -s $root/filter
/texttops
/tmp
/cups-
$user/bin
/filter
212 ln -s $root/pdftops
/pdftops
/tmp
/cups-
$user/bin
/filter
214 ln -s $root/data
/classified
/tmp
/cups-
$user/share
/banners
215 ln -s $root/data
/confidential
/tmp
/cups-
$user/share
/banners
216 ln -s $root/data
/secret
/tmp
/cups-
$user/share
/banners
217 ln -s $root/data
/standard
/tmp
/cups-
$user/share
/banners
218 ln -s $root/data
/topsecret
/tmp
/cups-
$user/share
/banners
219 ln -s $root/data
/unclassified
/tmp
/cups-
$user/share
/banners
220 ln -s $root/data
/tmp
/cups-
$user/share
/charsets
221 ln -s $root/data
/tmp
/cups-
$user/share
222 ln -s $root/fonts
/tmp
/cups-
$user/share
223 ln -s $root/ppd
/*.ppd
/tmp
/cups-
$user/share
/model
224 ln -s $root/templates
/tmp
/cups-
$user/share
226 if test $ssltype != 0; then
228 cp server.
* $root/ssl
232 # Then create the necessary config files...
235 if test $ssltype = 2; then
236 encryption
="Encryption Required"
241 cat >/tmp
/cups-
$user/cupsd.conf
<<EOF
245 Listen 127.0.0.1:$port
247 ServerRoot /tmp/cups-$user
248 StateDir /tmp/cups-$user
249 ServerBin /tmp/cups-$user/bin
250 CacheDir /tmp/cups-$user/share
251 DataDir /tmp/cups-$user/share
252 FontPath /tmp/cups-$user/share/fonts
253 DocumentRoot $root/doc
254 RequestRoot /tmp/cups-$user/spool
255 TempDir /tmp/cups-$user/spool/temp
257 AccessLog /tmp/cups-$user/log/access_log
258 ErrorLog /tmp/cups-$user/log/error_log
259 PageLog /tmp/cups-$user/log/page_log
261 PreserveJobHistory Yes
272 touch /tmp
/cups-
$user/classes.conf
273 touch /tmp
/cups-
$user/printers.conf
276 # Setup lots of test queues - 500 with PPD files, 500 without...
280 while test $i -le $nprinters1; do
281 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
284 DeviceURI file:/dev/null
285 Info Test PS printer $i
287 Location CUPS test suite
289 StateMessage Printer $1 is idle.
293 cp testps.ppd
/tmp
/cups-
$user/ppd
/test-
$i.ppd
298 while test $i -le $nprinters2; do
299 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
302 DeviceURI file:/dev/null
303 Info Test raw printer $i
305 Location CUPS test suite
307 StateMessage Printer $1 is idle.
314 cp /tmp
/cups-
$user/printers.conf
/tmp
/cups-
$user/printers.conf.orig
316 cp $root/conf
/mime.types
/tmp
/cups-
$user/mime.types
317 cp $root/conf
/mime.convs
/tmp
/cups-
$user/mime.convs
323 if test "x$LD_LIBRARY_PATH" = x
; then
324 LD_LIBRARY_PATH
="$root/cups:$root/filter"
326 LD_LIBRARY_PATH
="$root/cups:$root/filter:$LD_LIBRARY_PATH"
329 export LD_LIBRARY_PATH
331 LD_PRELOAD
="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2"
334 if test "x$DYLD_LIBRARY_PATH" = x
; then
335 DYLD_LIBRARY_PATH
="$root/cups:$root/filter"
337 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$DYLD_LIBRARY_PATH"
340 export DYLD_LIBRARY_PATH
342 if test "x$SHLIB_PATH" = x
; then
343 SHLIB_PATH
="$root/cups:$root/filter"
345 SHLIB_PATH
="$root/cups:$root/filter:$SHLIB_PATH"
350 CUPS_SERVER
=localhost
; export CUPS_SERVER
351 CUPS_SERVERROOT
=/tmp
/cups-
$user; export CUPS_SERVERROOT
352 CUPS_STATEDIR
=/tmp
/cups-
$user; export CUPS_STATEDIR
353 CUPS_DATADIR
=/tmp
/cups-
$user/share
; export CUPS_DATADIR
356 # Set a new home directory to avoid getting user options mixed in...
363 # Start the server; run as foreground daemon in the background...
366 echo "Starting scheduler:"
367 echo " $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log &"
370 $valgrind ..
/scheduler
/cupsd
-c /tmp
/cups-
$user/cupsd.conf
-f >/tmp
/cups-
$user/log
/debug_log
&
373 #if test -x /usr/bin/strace; then
374 # # Trace system calls in cupsd if we have strace...
375 # /usr/bin/strace -tt -o /tmp/cups-$user/log/cupsd.trace -p $cupsd &
378 if test "x$testtype" = x0
; then
379 echo "Scheduler is PID $cupsd and is listening on port 8631."
381 echo "Set the IPP_PORT environment variable to 8631 to test the software"
382 echo "interactively from the command-line."
386 echo "Scheduler is PID $cupsd; run debugger now if you need to."
388 echo "Press ENTER to continue..."
391 IPP_PORT
=$port; export IPP_PORT
394 running
=`../systemv/lpstat -r 2>/dev/null`
395 if test "x$running" = "xscheduler is running"; then
399 echo "Waiting for scheduler to become ready..."
404 # Create the test report source file...
407 strfile
=cups-str-1.2
-`date +%Y-%m-%d`-`whoami`.shtml
410 cat str-header.html
>$strfile
413 # Run the IPP tests...
416 echo "Running IPP compliance tests..."
418 echo "<H1>IPP Compliance Tests</H1>" >>$strfile
419 echo "<P>This section provides the results to the IPP compliance tests" >>$strfile
420 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
421 echo `date "+%Y-%m-%d"` by
`whoami` on
`hostname`.
>>$strfile
422 echo "<PRE>" >>$strfile
425 for file in 4*.
test; do
426 echo "Performing $file..."
429 .
/ipptest ipp
://localhost
:$port/printers
$file >>$strfile
432 if test $status != 0; then
434 fail
=`expr $fail + 1`
438 echo "</PRE>" >>$strfile
441 # Run the command tests...
444 echo "Running command tests..."
446 echo "<H1>Command Tests</H1>" >>$strfile
447 echo "<P>This section provides the results to the command tests" >>$strfile
448 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
449 echo `date "+%Y-%m-%d"` by
`whoami` on
`hostname`.
>>$strfile
450 echo "<PRE>" >>$strfile
452 for file in 5*.sh
; do
453 echo "Performing $file..."
455 echo "\"$file\":" >>$strfile
457 sh
$file $pjobs >>$strfile
460 if test $status != 0; then
462 fail
=`expr $fail + 1`
466 echo "</PRE>" >>$strfile
469 # Wait for jobs to complete...
473 jobs=`../systemv/lpstat 2>/dev/null`
474 if test "x$jobs" = "x"; then
478 echo "Waiting for jobs to complete..."
489 # Append the log files for post-mortim...
492 echo "<H1>Log Files</H1>" >>$strfile
494 echo "<H2>access_log</H2>" >>$strfile
495 echo "<PRE>" >>$strfile
496 cat /tmp
/cups-
$user/log
/access_log
>>$strfile
497 echo "</PRE>" >>$strfile
499 echo "<H2>error_log</H2>" >>$strfile
500 echo "<PRE>" >>$strfile
501 cat /tmp
/cups-
$user/log
/error_log
>>$strfile
502 echo "</PRE>" >>$strfile
504 echo "<H2>page_log</H2>" >>$strfile
505 echo "<PRE>" >>$strfile
506 cat /tmp
/cups-
$user/log
/page_log
>>$strfile
507 echo "</PRE>" >>$strfile
509 if test -f /tmp
/cups-
$user/log
/cupsd.trace
; then
510 echo "<H2>cupsd.trace</H2>" >>$strfile
511 echo "<PRE>" >>$strfile
512 cat /tmp
/cups-
$user/log
/cupsd.trace
>>$strfile
513 echo "</PRE>" >>$strfile
517 # Format the reports and tell the user where to find them...
520 echo "Formatting reports..."
522 cat str-trailer.html
>>$strfile
524 htmlfile
=`basename $strfile .shtml`.html
525 pdffile
=`basename $strfile .shtml`.pdf
527 htmldoc
--numbered --verbose --titleimage ..
/doc
/images
/cups-large.gif \
528 -f $htmlfile $strfile
529 htmldoc
--numbered --verbose --titleimage ..
/doc
/images
/cups-large.gif \
534 if test $fail != 0; then
535 echo "$fail tests failed."
537 echo "All tests were successful."
540 if test "x$valgrind" != x
; then
541 echo "Valgrind log files can be found in /tmp/cups-$user/log."
545 echo "See the following files for details:"
552 # End of "$Id: run-stp-tests.sh 4891 2006-01-07 04:50:14Z mike $"