]>
git.ipfire.org Git - thirdparty/cups.git/blob - test/run-stp-tests.sh
3 # "$Id: run-stp-tests.sh,v 1.4.2.22 2004/06/30 21:18:32 mike Exp $"
5 # Perform the complete set of IPP compliance tests specified in the
6 # CUPS Software Test Plan.
8 # Copyright 1997-2002 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-3111 USA
22 # Voice: (301) 373-9603
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 # Information for the server/tests...
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...
112 # See if we want to use valgrind...
116 echo "This test script can use the Valgrind software from:"
118 echo " http://developer.kde.org/~sewardj/"
120 echo "Please enter Y to use Valgrind or N to not use Valgrind:"
124 case "$usevalgrind" in
126 valgrind
="valgrind --tool=memcheck --logfile=/tmp/$user/log/valgrind --error-limit=no --leak-check=yes --trace-children=yes"
127 echo "Using Valgrind; log files can be found in /tmp/$user/log..."
136 # Start by creating temporary directories for the tests...
142 mkdir
/tmp
/$user/bin
/backend
143 mkdir
/tmp
/$user/bin
/filter
144 mkdir
/tmp
/$user/certs
145 mkdir
/tmp
/$user/share
146 mkdir
/tmp
/$user/share
/banners
147 mkdir
/tmp
/$user/share
/model
148 mkdir
/tmp
/$user/interfaces
151 mkdir
/tmp
/$user/spool
152 mkdir
/tmp
/$user/spool
/temp
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
170 ln -s $root/pdftops
/pdftops
/tmp
/$user/bin
/filter
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
182 ln -s $root/templates
/tmp
/$user/share
185 # Then create the necessary config files...
188 cat >/tmp
/$user/cupsd.conf
<<EOF
192 Listen 127.0.0.1:$port
194 ServerRoot /tmp/$user
195 ServerBin /tmp/$user/bin
196 DataDir /tmp/$user/share
197 FontPath /tmp/$user/share/fonts
198 DocumentRoot $root/doc
199 RequestRoot /tmp/$user/spool
200 TempDir /tmp/$user/spool/temp
202 AccessLog /tmp/$user/log/access_log
203 ErrorLog /tmp/$user/log/error_log
204 PageLog /tmp/$user/log/page_log
206 PreserveJobHistory Yes
225 touch /tmp
/$user/classes.conf
226 touch /tmp
/$user/printers.conf
229 # Setup lots of test queues - 500 with PPD files, 500 without...
233 while test $i -le $nprinters1; do
234 cat >>/tmp
/$user/printers.conf
<<EOF
237 DeviceURI file:/dev/null
238 Info Test PS printer $i
240 Location CUPS test suite
242 StateMessage Printer $1 is idle.
246 cp testps.ppd
/tmp
/$user/ppd
/test-
$i.ppd
251 while test $i -le $nprinters2; do
252 cat >>/tmp
/$user/printers.conf
<<EOF
255 DeviceURI file:/dev/null
256 Info Test raw printer $i
258 Location CUPS test suite
260 StateMessage Printer $1 is idle.
267 cp /tmp
/$user/printers.conf
/tmp
/$user/printers.conf.orig
269 cp $root/conf
/mime.types
/tmp
/$user/mime.types
270 cp $root/conf
/mime.convs
/tmp
/$user/mime.convs
276 if test "x$LD_LIBRARY_PATH" = x
; then
277 LD_LIBRARY_PATH
="$root/cups:$root/filter"
279 LD_LIBRARY_PATH
="$root/cups:$root/filter:$LD_LIBRARY_PATH"
282 export LD_LIBRARY_PATH
284 LD_PRELOAD
="$root/cups/libcups.so:$root/filter/libcupsimage.so"
287 if test "x$DYLD_LIBRARY_PATH" = x
; then
288 DYLD_LIBRARY_PATH
="$root/cups:$root/filter"
290 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$DYLD_LIBRARY_PATH"
295 if test "x$SHLIB_PATH" = x
; then
296 SHLIB_PATH
="$root/cups:$root/filter"
298 SHLIB_PATH
="$root/cups:$root/filter:$SHLIB_PATH"
303 CUPS_SERVERROOT
=/tmp
/$user; export CUPS_SERVERROOT
304 CUPS_DATADIR
=/tmp
/$user/share
; export CUPS_DATADIR
307 # Set a new home directory to avoid getting user options mixed in...
314 # Start the server; run as foreground daemon in the background...
317 echo "Starting scheduler:"
318 echo " $valgrind ../scheduler/cupsd -c /tmp/$user/cupsd.conf -f >/tmp/$user/log/debug_log &"
321 $valgrind ..
/scheduler
/cupsd
-c /tmp
/$user/cupsd.conf
-f >/tmp
/$user/log
/debug_log
&
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 &
329 if test "x$testtype" = x0
; then
330 echo "Scheduler is PID $cupsd and is listening on port 8631."
332 echo "Set the IPP_PORT environment variable to 8631 to test the software"
333 echo "interactively from the command-line."
337 echo "Scheduler is PID $cupsd; run debugger now if you need to."
339 echo "Press ENTER to continue..."
342 IPP_PORT
=$port; export IPP_PORT
345 running
=`../systemv/lpstat -r 2>/dev/null`
346 if test "x$running" = "xscheduler is running"; then
350 echo "Waiting for scheduler to become ready..."
355 # Create the test report source file...
358 strfile
=cups-str-1.2
-`date +%Y-%m-%d`-`whoami`.shtml
361 cat str-header.html
>$strfile
364 # Run the IPP tests...
367 echo "Running IPP compliance tests..."
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
376 for file in 4*.
test; do
377 echo "Performing $file..."
380 .
/ipptest ipp
://localhost
:$port/printers
$file >>$strfile
383 if test $status != 0; then
385 fail
=`expr $fail + 1`
389 echo "</PRE>" >>$strfile
392 # Run the command tests...
395 echo "Running command tests..."
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
403 for file in 5*.sh
; do
404 echo "Performing $file..."
406 echo "\"$file\":" >>$strfile
408 sh
$file $pjobs >>$strfile
411 if test $status != 0; then
413 fail
=`expr $fail + 1`
417 echo "</PRE>" >>$strfile
420 # Wait for jobs to complete...
424 jobs=`../systemv/lpstat 2>/dev/null`
425 if test "x$jobs" = "x"; then
429 echo "Waiting for jobs to complete..."
440 # Append the log files for post-mortim...
443 echo "<H1>Log Files</H1>" >>$strfile
445 echo "<H2>access_log</H2>" >>$strfile
446 echo "<PRE>" >>$strfile
447 cat /tmp
/$user/log
/access_log
>>$strfile
448 echo "</PRE>" >>$strfile
450 echo "<H2>error_log</H2>" >>$strfile
451 echo "<PRE>" >>$strfile
452 cat /tmp
/$user/log
/error_log
>>$strfile
453 echo "</PRE>" >>$strfile
455 echo "<H2>page_log</H2>" >>$strfile
456 echo "<PRE>" >>$strfile
457 cat /tmp
/$user/log
/page_log
>>$strfile
458 echo "</PRE>" >>$strfile
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
468 # Format the reports and tell the user where to find them...
471 echo "Formatting reports..."
473 cat str-trailer.html
>>$strfile
475 htmlfile
=`basename $strfile .shtml`.html
476 pdffile
=`basename $strfile .shtml`.pdf
478 htmldoc
--numbered --verbose --titleimage ..
/doc
/images
/cups-large.gif \
479 -f $htmlfile $strfile
480 htmldoc
--numbered --verbose --titleimage ..
/doc
/images
/cups-large.gif \
485 if test $fail != 0; then
486 echo "$fail tests failed."
488 echo "All tests were successful."
491 if test "x$valgrind" != x
; then
492 echo "Valgrind log files can be found in /tmp/$user/log."
496 echo "See the following files for details:"
503 # End of "$Id: run-stp-tests.sh,v 1.4.2.22 2004/06/30 21:18:32 mike Exp $"