]>
git.ipfire.org Git - thirdparty/cups.git/blob - test/run-stp-tests.sh
43a0f9c258c369f5cb772a92adca42e33205a975
3 # "$Id: run-stp-tests.sh 6297 2007-02-21 02:24:16Z mike $"
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 - Test but do not require encryption"
124 echo "2 - Test 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 echo "Will test but not require encryption (1)"
141 echo "Will test and require encryption (2)"
144 echo "Not using SSL/TLS (0)"
150 # Information for the server/tests...
154 if test -z "$user"; then
155 if test -x /usr
/ucb
/whoami
; then
156 user
=`/usr/ucb/whoami`
161 if test -z "$user"; then
171 # Make sure that the LPDEST and PRINTER environment variables are
172 # not included in the environment that is passed to the tests. These
173 # will usually cause tests to fail erroneously...
180 # See if we want to use valgrind...
184 echo "This test script can use the Valgrind software from:"
186 echo " http://developer.kde.org/~sewardj/"
188 echo $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c"
190 if test $# -gt 0; then
198 case "$usevalgrind" in
200 valgrind
="valgrind --tool=memcheck --log-file=/tmp/cups-$user/log/valgrind --error-limit=no --leak-check=yes --trace-children=yes"
201 echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..."
210 # Start by creating temporary directories for the tests...
213 echo "Creating directories for test..."
215 rm -rf /tmp
/cups-
$user
216 mkdir
/tmp
/cups-
$user
217 mkdir
/tmp
/cups-
$user/bin
218 mkdir
/tmp
/cups-
$user/bin
/backend
219 mkdir
/tmp
/cups-
$user/bin
/filter
220 mkdir
/tmp
/cups-
$user/certs
221 mkdir
/tmp
/cups-
$user/share
222 mkdir
/tmp
/cups-
$user/share
/banners
223 mkdir
/tmp
/cups-
$user/share
/model
224 mkdir
/tmp
/cups-
$user/interfaces
225 mkdir
/tmp
/cups-
$user/log
226 mkdir
/tmp
/cups-
$user/ppd
227 mkdir
/tmp
/cups-
$user/spool
228 mkdir
/tmp
/cups-
$user/spool
/temp
229 mkdir
/tmp
/cups-
$user/ssl
231 ln -s $root/backend
/http
/tmp
/cups-
$user/bin
/backend
232 ln -s $root/backend
/ipp
/tmp
/cups-
$user/bin
/backend
233 ln -s $root/backend
/lpd
/tmp
/cups-
$user/bin
/backend
234 ln -s $root/backend
/parallel
/tmp
/cups-
$user/bin
/backend
235 ln -s $root/backend
/serial
/tmp
/cups-
$user/bin
/backend
236 ln -s $root/backend
/snmp
/tmp
/cups-
$user/bin
/backend
237 ln -s $root/backend
/socket
/tmp
/cups-
$user/bin
/backend
238 ln -s $root/backend
/usb
/tmp
/cups-
$user/bin
/backend
239 ln -s $root/cgi-bin
/tmp
/cups-
$user/bin
240 ln -s $root/monitor
/tmp
/cups-
$user/bin
241 ln -s $root/notifier
/tmp
/cups-
$user/bin
242 ln -s $root/scheduler
/tmp
/cups-
$user/bin
/daemon
243 ln -s $root/filter
/hpgltops
/tmp
/cups-
$user/bin
/filter
244 ln -s $root/filter
/imagetops
/tmp
/cups-
$user/bin
/filter
245 ln -s $root/filter
/imagetoraster
/tmp
/cups-
$user/bin
/filter
246 ln -s $root/filter
/pstops
/tmp
/cups-
$user/bin
/filter
247 ln -s $root/filter
/rastertoepson
/tmp
/cups-
$user/bin
/filter
248 ln -s $root/filter
/rastertohp
/tmp
/cups-
$user/bin
/filter
249 ln -s $root/filter
/texttops
/tmp
/cups-
$user/bin
/filter
250 ln -s $root/pdftops
/pdftops
/tmp
/cups-
$user/bin
/filter
252 ln -s $root/data
/classified
/tmp
/cups-
$user/share
/banners
253 ln -s $root/data
/confidential
/tmp
/cups-
$user/share
/banners
254 ln -s $root/data
/secret
/tmp
/cups-
$user/share
/banners
255 ln -s $root/data
/standard
/tmp
/cups-
$user/share
/banners
256 ln -s $root/data
/topsecret
/tmp
/cups-
$user/share
/banners
257 ln -s $root/data
/unclassified
/tmp
/cups-
$user/share
/banners
258 ln -s $root/data
/tmp
/cups-
$user/share
/charmaps
259 ln -s $root/data
/tmp
/cups-
$user/share
/charsets
260 ln -s $root/data
/tmp
/cups-
$user/share
261 ln -s $root/fonts
/tmp
/cups-
$user/share
262 ln -s $root/ppd
/*.ppd
/tmp
/cups-
$user/share
/model
263 ln -s $root/templates
/tmp
/cups-
$user/share
265 if test $ssltype != 0; then
267 cp server.
* $root/ssl
271 # Then create the necessary config files...
274 echo "Creating cupsd.conf for test..."
276 if test $ssltype = 2; then
277 encryption
="Encryption Required"
282 cat >/tmp
/cups-
$user/cupsd.conf
<<EOF
286 Listen 127.0.0.1:$port
288 ServerRoot /tmp/cups-$user
289 StateDir /tmp/cups-$user
290 ServerBin /tmp/cups-$user/bin
291 CacheDir /tmp/cups-$user/share
292 DataDir /tmp/cups-$user/share
293 FontPath /tmp/cups-$user/share/fonts
294 DocumentRoot $root/doc
295 RequestRoot /tmp/cups-$user/spool
296 TempDir /tmp/cups-$user/spool/temp
298 AccessLog /tmp/cups-$user/log/access_log
299 ErrorLog /tmp/cups-$user/log/error_log
300 PageLog /tmp/cups-$user/log/page_log
302 PreserveJobHistory Yes
313 touch /tmp
/cups-
$user/classes.conf
314 touch /tmp
/cups-
$user/printers.conf
317 # Setup lots of test queues - 500 with PPD files, 500 without...
320 echo "Creating printers.conf for test..."
323 while test $i -le $nprinters1; do
324 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
327 DeviceURI file:/dev/null
328 Info Test PS printer $i
330 Location CUPS test suite
332 StateMessage Printer $1 is idle.
336 cp testps.ppd
/tmp
/cups-
$user/ppd
/test-
$i.ppd
341 while test $i -le $nprinters2; do
342 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
345 DeviceURI file:/dev/null
346 Info Test raw printer $i
348 Location CUPS test suite
350 StateMessage Printer $1 is idle.
357 cp /tmp
/cups-
$user/printers.conf
/tmp
/cups-
$user/printers.conf.orig
359 cp $root/conf
/mime.types
/tmp
/cups-
$user/mime.types
360 cp $root/conf
/mime.convs
/tmp
/cups-
$user/mime.convs
366 echo "Setting up environment variables for test..."
368 if test "x$LD_LIBRARY_PATH" = x
; then
369 LD_LIBRARY_PATH
="$root/cups:$root/filter"
371 LD_LIBRARY_PATH
="$root/cups:$root/filter:$LD_LIBRARY_PATH"
374 export LD_LIBRARY_PATH
376 LD_PRELOAD
="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2"
379 if test "x$DYLD_LIBRARY_PATH" = x
; then
380 DYLD_LIBRARY_PATH
="$root/cups:$root/filter"
382 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$DYLD_LIBRARY_PATH"
385 export DYLD_LIBRARY_PATH
387 if test "x$SHLIB_PATH" = x
; then
388 SHLIB_PATH
="$root/cups:$root/filter"
390 SHLIB_PATH
="$root/cups:$root/filter:$SHLIB_PATH"
395 CUPS_SERVER
=localhost
; export CUPS_SERVER
396 CUPS_SERVERROOT
=/tmp
/cups-
$user; export CUPS_SERVERROOT
397 CUPS_STATEDIR
=/tmp
/cups-
$user; export CUPS_STATEDIR
398 CUPS_DATADIR
=/tmp
/cups-
$user/share
; export CUPS_DATADIR
401 # Set a new home directory to avoid getting user options mixed in...
408 # Start the server; run as foreground daemon in the background...
411 echo "Starting scheduler:"
412 echo " $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &"
415 $valgrind ..
/scheduler
/cupsd
-c /tmp
/cups-
$user/cupsd.conf
-f >/tmp
/cups-
$user/log
/debug_log
2>&1 &
418 #if test -x /usr/bin/strace; then
419 # # Trace system calls in cupsd if we have strace...
420 # /usr/bin/strace -tt -o /tmp/cups-$user/log/cupsd.trace -p $cupsd &
423 if test "x$testtype" = x0
; then
424 echo "Scheduler is PID $cupsd and is listening on port 8631."
426 echo "Set the IPP_PORT environment variable to 8631 to test the software"
427 echo "interactively from the command-line."
431 if test $argcount -eq 0; then
432 echo "Scheduler is PID $cupsd; run debugger now if you need to."
434 echo $ac_n "Press ENTER to continue... $ac_c"
437 echo "Scheduler is PID $cupsd."
441 IPP_PORT
=$port; export IPP_PORT
444 running
=`../systemv/lpstat -r 2>/dev/null`
445 if test "x$running" = "xscheduler is running"; then
449 echo "Waiting for scheduler to become ready..."
454 # Create the test report source file...
457 strfile
=cups-str-1.3
-`date +%Y-%m-%d`-$user.html
460 cat str-header.html
>$strfile
463 # Run the IPP tests...
467 echo "Running IPP compliance tests..."
469 echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile
470 echo "<P>This section provides the results to the IPP compliance tests" >>$strfile
471 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
472 echo `date "+%Y-%m-%d"` by
$user on
`hostname`.
>>$strfile
473 echo "<PRE>" >>$strfile
476 for file in 4*.
test; do
477 echo "Performing $file..."
480 .
/ipptest ipp
://localhost
:$port/printers
$file >>$strfile
483 if test $status != 0; then
485 fail
=`expr $fail + 1`
489 echo "</PRE>" >>$strfile
492 # Run the command tests...
496 echo "Running command tests..."
498 echo "<H1>2 - Command Tests</H1>" >>$strfile
499 echo "<P>This section provides the results to the command tests" >>$strfile
500 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
501 echo `date "+%Y-%m-%d"` by
$user on
`hostname`.
>>$strfile
502 echo "<PRE>" >>$strfile
504 for file in 5*.sh
; do
505 echo "Performing $file..."
507 echo "\"$file\":" >>$strfile
509 sh
$file $pjobs >>$strfile
512 if test $status != 0; then
514 fail
=`expr $fail + 1`
518 echo "</PRE>" >>$strfile
521 # Wait for jobs to complete...
525 jobs=`../systemv/lpstat 2>/dev/null`
526 if test "x$jobs" = "x"; then
530 echo "Waiting for jobs to complete..."
541 # Append the log files for post-mortim...
544 echo "<H1>3 - Log Files</H1>" >>$strfile
546 echo "<H2>access_log</H2>" >>$strfile
547 echo "<PRE>" >>$strfile
548 cat /tmp
/cups-
$user/log
/access_log
>>$strfile
549 echo "</PRE>" >>$strfile
551 echo "<H2>error_log</H2>" >>$strfile
552 echo "<PRE>" >>$strfile
553 cat /tmp
/cups-
$user/log
/error_log
>>$strfile
554 echo "</PRE>" >>$strfile
556 echo "<H2>page_log</H2>" >>$strfile
557 echo "<PRE>" >>$strfile
558 cat /tmp
/cups-
$user/log
/page_log
>>$strfile
559 echo "</PRE>" >>$strfile
561 if test -f /tmp
/cups-
$user/log
/cupsd.trace
; then
562 echo "<H2>cupsd.trace</H2>" >>$strfile
563 echo "<PRE>" >>$strfile
564 cat /tmp
/cups-
$user/log
/cupsd.trace
>>$strfile
565 echo "</PRE>" >>$strfile
569 # Format the reports and tell the user where to find them...
572 cat str-trailer.html
>>$strfile
576 if test $fail != 0; then
577 echo "$fail tests failed."
579 echo "All tests were successful."
582 echo "Log files can be found in /tmp/cups-$user/log."
583 echo "A HTML report was created in test/$strfile."
587 # End of "$Id: run-stp-tests.sh 6297 2007-02-21 02:24:16Z mike $"