3 # "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $"
5 # Perform the complete set of IPP compliance tests specified in the
6 # CUPS Software Test Plan.
8 # Copyright 2007-2012 by Apple Inc.
9 # Copyright 1997-2007 by Easy Software Products, all rights reserved.
11 # These coded instructions, statements, and computer programs are the
12 # property of Apple Inc. and are protected by Federal copyright
13 # law. Distribution and use rights are outlined in the file "LICENSE.txt"
14 # which should have been included with this file. If this file is
15 # file is missing or damaged, see the license at "http://www.cups.org/".
21 # Don't allow "make check" or "make test" to be run by root...
24 if test "x`id -u`" = x0
; then
25 echo Please run this as a normal user. Not supported when run as root.
30 # Force the permissions of the files we create...
36 # Make the IPP test program...
42 # Solaris has a non-POSIX grep in /bin...
45 if test -x /usr
/xpg
4/bin
/grep; then
46 GREP
=/usr
/xpg
4/bin
/grep
52 # Figure out the proper echo options...
55 if (echo "testing\c"; echo 1,2,3) |
$GREP c
>/dev
/null
; then
67 echo "Welcome to the CUPS Automated Test Script."
69 echo "Before we begin, it is important that you understand that the larger"
70 echo "tests require significant amounts of RAM and disk space. If you"
71 echo "attempt to run one of the big tests on a system that lacks sufficient"
72 echo "disk and virtual memory, the UNIX kernel might decide to kill one or"
73 echo "more system processes that you've grown attached to, like the X"
74 echo "server. The question you may want to ask yourself before running a"
75 echo "large test is: Do you feel lucky?"
77 echo "OK, now that we have the Dirty Harry quote out of the way, please"
78 echo "choose the type of test you wish to perform:"
80 echo "0 - No testing, keep the scheduler running for me (all systems)"
81 echo "1 - Basic conformance test, no load testing (all systems)"
82 echo "2 - Basic conformance test, some load testing (minimum 256MB VM, 50MB disk)"
83 echo "3 - Basic conformance test, extreme load testing (minimum 1GB VM, 500MB disk)"
84 echo "4 - Basic conformance test, torture load testing (minimum 2GB VM, 1GB disk)"
86 echo $ac_n "Enter the number of the test you wish to perform: [1] $ac_c"
88 if test $# -gt 0; then
98 echo "Running in test mode (0)"
105 echo "Running the medium tests (2)"
112 echo "Running the extreme tests (3)"
119 echo "Running the torture tests (4)"
126 echo "Running the timid tests (1)"
135 # See if we want to do SSL testing...
139 echo "Now you can choose whether to create a SSL/TLS encryption key and"
140 echo "certificate for testing; these tests currently require the OpenSSL"
143 echo "0 - Do not do SSL/TLS encryption tests"
144 echo "1 - Test but do not require encryption"
145 echo "2 - Test and require encryption"
147 echo $ac_n "Enter the number of the SSL/TLS tests to perform: [0] $ac_c"
149 if test $# -gt 0; then
159 echo "Will test but not require encryption (1)"
162 echo "Will test and require encryption (2)"
165 echo "Not using SSL/TLS (0)"
171 # Information for the server/tests...
175 if test -z "$user"; then
176 if test -x /usr
/ucb
/whoami
; then
177 user
=`/usr/ucb/whoami`
182 if test -z "$user"; then
192 # Make sure that the LPDEST and PRINTER environment variables are
193 # not included in the environment that is passed to the tests. These
194 # will usually cause tests to fail erroneously...
201 # See if we want to use valgrind...
205 echo "This test script can use the Valgrind software from:"
207 echo " http://developer.kde.org/~sewardj/"
209 echo $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c"
211 if test $# -gt 0; then
219 case "$usevalgrind" in
221 VALGRIND
="valgrind --tool=memcheck --log-file=/tmp/cups-$user/log/valgrind.%p --error-limit=no --leak-check=yes --trace-children=yes --read-var-info=yes"
222 if test `uname` = Darwin
; then
223 VALGRIND
="$VALGRIND --dsymutil=yes"
226 echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..."
236 # See if we want to do debug logging of the libraries...
240 echo "If CUPS was built with the --enable-debug-printfs configure option, you"
241 echo "can enable debug logging of the libraries."
243 echo $ac_n "Enter Y or a number from 0 to 9 to enable debug logging or N to not: [N] $ac_c"
245 if test $# -gt 0; then
253 case "$usedebugprintfs" in
255 echo "Enabling debug printfs (level 5); log files can be found in /tmp/cups-$user/log..."
256 CUPS_DEBUG_LOG
="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
257 CUPS_DEBUG_LEVEL
=5; export CUPS_DEBUG_LEVEL
258 CUPS_DEBUG_FILTER
='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
261 0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9)
262 echo "Enabling debug printfs (level $usedebugprintfs); log files can be found in /tmp/cups-$user/log..."
263 CUPS_DEBUG_LOG
="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
264 CUPS_DEBUG_LEVEL
="$usedebugprintfs"; export CUPS_DEBUG_LEVEL
265 CUPS_DEBUG_FILTER
='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
273 # Start by creating temporary directories for the tests...
276 echo "Creating directories for test..."
278 rm -rf /tmp
/cups-
$user
279 mkdir
/tmp
/cups-
$user
280 mkdir
/tmp
/cups-
$user/bin
281 mkdir
/tmp
/cups-
$user/bin
/backend
282 mkdir
/tmp
/cups-
$user/bin
/driver
283 mkdir
/tmp
/cups-
$user/bin
/filter
284 mkdir
/tmp
/cups-
$user/certs
285 mkdir
/tmp
/cups-
$user/share
286 mkdir
/tmp
/cups-
$user/share
/banners
287 mkdir
/tmp
/cups-
$user/share
/drv
288 mkdir
/tmp
/cups-
$user/share
/locale
289 for file in ..
/locale
/cups_
*.po
; do
290 loc
=`basename $file .po | cut -c 6-`
291 mkdir
/tmp
/cups-
$user/share
/locale
/$loc
292 ln -s $root/locale
/cups_
$loc.po
/tmp
/cups-
$user/share
/locale
/$loc
293 ln -s $root/locale
/ppdc_
$loc.po
/tmp
/cups-
$user/share
/locale
/$loc
295 mkdir
/tmp
/cups-
$user/share
/mime
296 mkdir
/tmp
/cups-
$user/share
/model
297 mkdir
/tmp
/cups-
$user/share
/ppdc
298 mkdir
/tmp
/cups-
$user/interfaces
299 mkdir
/tmp
/cups-
$user/log
300 mkdir
/tmp
/cups-
$user/ppd
301 mkdir
/tmp
/cups-
$user/spool
302 mkdir
/tmp
/cups-
$user/spool
/temp
303 mkdir
/tmp
/cups-
$user/ssl
305 ln -s $root/backend
/dnssd
/tmp
/cups-
$user/bin
/backend
306 ln -s $root/backend
/http
/tmp
/cups-
$user/bin
/backend
307 ln -s $root/backend
/ipp
/tmp
/cups-
$user/bin
/backend
308 ln -s $root/backend
/lpd
/tmp
/cups-
$user/bin
/backend
309 ln -s $root/backend
/mdns
/tmp
/cups-
$user/bin
/backend
310 ln -s $root/backend
/pseudo
/tmp
/cups-
$user/bin
/backend
311 ln -s $root/backend
/snmp
/tmp
/cups-
$user/bin
/backend
312 ln -s $root/backend
/socket
/tmp
/cups-
$user/bin
/backend
313 ln -s $root/backend
/usb
/tmp
/cups-
$user/bin
/backend
314 ln -s $root/cgi-bin
/tmp
/cups-
$user/bin
315 ln -s $root/monitor
/tmp
/cups-
$user/bin
316 ln -s $root/notifier
/tmp
/cups-
$user/bin
317 ln -s $root/scheduler
/tmp
/cups-
$user/bin
/daemon
318 ln -s $root/filter
/commandtops
/tmp
/cups-
$user/bin
/filter
319 ln -s $root/filter
/gziptoany
/tmp
/cups-
$user/bin
/filter
320 ln -s $root/filter
/pstops
/tmp
/cups-
$user/bin
/filter
321 ln -s $root/filter
/rastertoepson
/tmp
/cups-
$user/bin
/filter
322 ln -s $root/filter
/rastertohp
/tmp
/cups-
$user/bin
/filter
323 ln -s $root/filter
/rastertolabel
/tmp
/cups-
$user/bin
/filter
324 ln -s $root/filter
/rastertopwg
/tmp
/cups-
$user/bin
/filter
326 ln -s $root/data
/classified
/tmp
/cups-
$user/share
/banners
327 ln -s $root/data
/confidential
/tmp
/cups-
$user/share
/banners
328 ln -s $root/data
/secret
/tmp
/cups-
$user/share
/banners
329 ln -s $root/data
/standard
/tmp
/cups-
$user/share
/banners
330 ln -s $root/data
/topsecret
/tmp
/cups-
$user/share
/banners
331 ln -s $root/data
/unclassified
/tmp
/cups-
$user/share
/banners
332 ln -s $root/data
/tmp
/cups-
$user/share
333 ln -s $root/ppdc
/sample.drv
/tmp
/cups-
$user/share
/drv
334 ln -s $root/conf
/mime.types
/tmp
/cups-
$user/share
/mime
335 ln -s $root/conf
/mime.convs
/tmp
/cups-
$user/share
/mime
336 ln -s $root/data
/*.h
/tmp
/cups-
$user/share
/ppdc
337 ln -s $root/data
/*.defs
/tmp
/cups-
$user/share
/ppdc
338 ln -s $root/templates
/tmp
/cups-
$user/share
341 # Local filters and configuration files...
344 if test `uname` = Darwin
; then
345 ln -s /usr
/libexec
/cups
/filter
/cgpdfto
* /tmp
/cups-
$user/bin
/filter
346 ln -s /usr
/libexec
/cups
/filter
/cgbannertopdf
/tmp
/cups-
$user/bin
/filter
347 ln -s /usr
/libexec
/cups
/filter
/cgimagetopdf
/tmp
/cups-
$user/bin
/filter
348 ln -s /usr
/libexec
/cups
/filter
/cgtexttopdf
/tmp
/cups-
$user/bin
/filter
349 ln -s /usr
/libexec
/cups
/filter
/nsimagetopdf
/tmp
/cups-
$user/bin
/filter
350 ln -s /usr
/libexec
/cups
/filter
/nstexttopdf
/tmp
/cups-
$user/bin
/filter
351 ln -s /usr
/libexec
/cups
/filter
/pictwpstops
/tmp
/cups-
$user/bin
/filter
352 ln -s /usr
/libexec
/cups
/filter
/pstoappleps
/tmp
/cups-
$user/bin
/filter
353 ln -s /usr
/libexec
/cups
/filter
/pstocupsraster
/tmp
/cups-
$user/bin
/filter
354 ln -s /usr
/libexec
/cups
/filter
/pstopdffilter
/tmp
/cups-
$user/bin
/filter
355 ln -s /usr
/libexec
/cups
/filter
/rastertourf
/tmp
/cups-
$user/bin
/filter
356 ln -s /usr
/libexec
/cups
/filter
/xhtmltopdf
/tmp
/cups-
$user/bin
/filter
358 if test -f /private
/etc
/cups
/apple.types
; then
359 ln -s /private
/etc
/cups
/apple.
* /tmp
/cups-
$user/share
/mime
360 elif test -f /usr
/share
/cups
/mime
/apple.types
; then
361 ln -s /usr
/share
/cups
/mime
/apple.
* /tmp
/cups-
$user/share
/mime
364 ln -s /usr
/lib
/cups
/filter
/bannertops
/tmp
/cups-
$user/bin
/filter
365 ln -s /usr
/lib
/cups
/filter
/imagetops
/tmp
/cups-
$user/bin
/filter
366 ln -s /usr
/lib
/cups
/filter
/imagetoraster
/tmp
/cups-
$user/bin
/filter
367 ln -s /usr
/lib
/cups
/filter
/pdftops
/tmp
/cups-
$user/bin
/filter
368 ln -s /usr
/lib
/cups
/filter
/texttops
/tmp
/cups-
$user/bin
/filter
370 ln -s /usr
/share
/cups
/mime
/legacy.convs
/tmp
/cups-
$user/share
/mime
371 ln -s /usr
/share
/cups
/charsets
/tmp
/cups-
$user/share
372 if test -f $root/data
/psglyphs
; then
373 ln -s /usr
/share
/cups
/data
/psglyphs
$root/data
375 ln -s /usr
/share
/cups
/fonts
/tmp
/cups-
$user/share
379 # Then create the necessary config files...
382 echo "Creating cupsd.conf for test..."
384 if test $ssltype = 2; then
385 encryption
="Encryption Required"
390 cat >/tmp
/cups-
$user/cupsd.conf
<<EOF
391 StrictConformance Yes
393 Listen localhost:$port
395 PassEnv DYLD_INSERT_LIBRARIES
398 AccessLogLevel actions
401 PreserveJobHistory Yes
410 cat >/tmp
/cups-
$user/cups-files.conf
<<EOF
414 ServerRoot /tmp/cups-$user
415 StateDir /tmp/cups-$user
416 ServerBin /tmp/cups-$user/bin
417 CacheDir /tmp/cups-$user/share
418 DataDir /tmp/cups-$user/share
419 FontPath /tmp/cups-$user/share/fonts
420 DocumentRoot $root/doc
421 RequestRoot /tmp/cups-$user/spool
422 TempDir /tmp/cups-$user/spool/temp
423 AccessLog /tmp/cups-$user/log/access_log
424 ErrorLog /tmp/cups-$user/log/error_log
425 PageLog /tmp/cups-$user/log/page_log
429 # Setup lots of test queues - half with PPD files, half without...
432 echo "Creating printers.conf for test..."
435 while test $i -le $nprinters1; do
436 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
439 DeviceURI file:/dev/null
440 Info Test PS printer $i
442 Location CUPS test suite
444 StateMessage Printer $1 is idle.
448 cp testps.ppd
/tmp
/cups-
$user/ppd
/test-
$i.ppd
453 while test $i -le $nprinters2; do
454 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
457 DeviceURI file:/dev/null
458 Info Test raw printer $i
460 Location CUPS test suite
462 StateMessage Printer $1 is idle.
469 if test -f /tmp
/cups-
$user/printers.conf
; then
470 cp /tmp
/cups-
$user/printers.conf
/tmp
/cups-
$user/printers.conf.orig
472 touch /tmp
/cups-
$user/printers.conf.orig
479 echo "Setting up environment variables for test..."
481 if test "x$LD_LIBRARY_PATH" = x
; then
482 LD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
484 LD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$LD_LIBRARY_PATH"
487 export LD_LIBRARY_PATH
489 LD_PRELOAD
="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2:$root/cgi-bin/libcupscgi.so.1:$root/scheduler/libcupsmime.so.1:$root/ppdc/libcupsppdc.so.1"
490 if test `uname` = SunOS
-a -r /usr
/lib
/libCrun.so
.1; then
491 LD_PRELOAD
="/usr/lib/libCrun.so.1:$LD_PRELOAD"
495 if test "x$DYLD_LIBRARY_PATH" = x
; then
496 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
498 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$DYLD_LIBRARY_PATH"
501 export DYLD_LIBRARY_PATH
503 if test "x$SHLIB_PATH" = x
; then
504 SHLIB_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
506 SHLIB_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$SHLIB_PATH"
511 CUPS_DISABLE_APPLE_DEFAULT
=yes; export CUPS_DISABLE_APPLE_DEFAULT
512 CUPS_SERVER
=localhost
:8631; export CUPS_SERVER
513 CUPS_SERVERROOT
=/tmp
/cups-
$user; export CUPS_SERVERROOT
514 CUPS_STATEDIR
=/tmp
/cups-
$user; export CUPS_STATEDIR
515 CUPS_DATADIR
=/tmp
/cups-
$user/share
; export CUPS_DATADIR
516 LOCALEDIR
=/tmp
/cups-
$user/share
/locale
; export LOCALEDIR
519 # Set a new home directory to avoid getting user options mixed in...
526 # Force POSIX locale for tests...
536 # Start the server; run as foreground daemon in the background...
539 echo "Starting scheduler:"
540 echo " $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &"
543 if test `uname` = Darwin
-a "x$VALGRIND" = x
; then
544 DYLD_INSERT_LIBRARIES
=/usr
/lib
/libgmalloc.dylib
545 ..
/scheduler
/cupsd
-c /tmp
/cups-
$user/cupsd.conf
-f >/tmp
/cups-
$user/log
/debug_log
2>&1 &
547 $VALGRIND ..
/scheduler
/cupsd
-c /tmp
/cups-
$user/cupsd.conf
-f >/tmp
/cups-
$user/log
/debug_log
2>&1 &
552 if test "x$testtype" = x0
; then
553 # Not running tests...
554 echo "Scheduler is PID $cupsd and is listening on port 8631."
557 # Create a helper script to run programs with...
558 runcups
="/tmp/cups-$user/runcups"
560 echo "#!/bin/sh" >$runcups
561 echo "# Helper script for running CUPS test instance." >>$runcups
563 echo "# Set required environment variables..." >>$runcups
564 echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups
565 echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups
566 echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups
567 echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups
568 echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups
569 echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups
570 echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups
571 echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups
572 echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups
573 if test "x$CUPS_DEBUG_LEVEL" != x
; then
574 echo "CUPS_DEBUG_FILTER='$CUPS_DEBUG_FILTER'; export CUPS_DEBUG_FILTER" >>$runcups
575 echo "CUPS_DEBUG_LEVEL=$CUPS_DEBUG_LEVEL; export CUPS_DEBUG_LEVEL" >>$runcups
576 echo "CUPS_DEBUG_LOG='$CUPS_DEBUG_LOG'; export CUPS_DEBUG_LOG" >>$runcups
579 echo "# Run command..." >>$runcups
580 echo "exec \"\$@\"" >>$runcups
584 echo "The $runcups helper script can be used to test programs"
585 echo "with the server."
589 if test $argcount -eq 0; then
590 echo "Scheduler is PID $cupsd; run debugger now if you need to."
592 echo $ac_n "Press ENTER to continue... $ac_c"
595 echo "Scheduler is PID $cupsd."
599 IPP_PORT
=$port; export IPP_PORT
602 running
=`../systemv/lpstat -r 2>/dev/null`
603 if test "x$running" = "xscheduler is running"; then
607 echo "Waiting for scheduler to become ready..."
612 # Create the test report source file...
615 date=`date "+%Y-%m-%d"`
616 strfile
=/tmp
/cups-
$user/cups-str-1.7
-$date-$user.html
619 cat str-header.html
>$strfile
622 # Run the IPP tests...
626 echo "Running IPP compliance tests..."
628 echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile
629 echo "<P>This section provides the results to the IPP compliance tests" >>$strfile
630 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
631 echo `date "+%Y-%m-%d"` by
$user on
`hostname`.
>>$strfile
632 echo "<PRE>" >>$strfile
635 for file in 4*.
test ipp-2.1.
test; do
636 echo $ac_n "Performing $file: $ac_c"
639 if test $file = ipp-2.1.
test; then
640 uri
="ipp://localhost:$port/printers/Test1"
641 options
="-V 2.1 -d NOPRINT=1 -f testfile.ps"
643 uri
="ipp://localhost:$port/printers"
646 $VALGRIND .
/ipptool
-tI $options $uri $file >> $strfile
649 if test $status != 0; then
651 fail
=`expr $fail + 1`
657 echo "</PRE>" >>$strfile
660 # Run the command tests...
664 echo "Running command tests..."
666 echo "<H1>2 - Command Tests</H1>" >>$strfile
667 echo "<P>This section provides the results to the command tests" >>$strfile
668 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
669 echo $date by
$user on
`hostname`.
>>$strfile
670 echo "<PRE>" >>$strfile
672 for file in 5*.sh
; do
673 echo $ac_n "Performing $file: $ac_c"
675 echo "\"$file\":" >>$strfile
677 sh
$file $pjobs $pprinters >> $strfile
680 if test $status != 0; then
682 fail
=`expr $fail + 1`
688 echo "</PRE>" >>$strfile
697 # Append the log files for post-mortim...
700 echo "<H1>3 - Log Files</H1>" >>$strfile
708 echo "<H2>Summary</H2>" >>$strfile
711 count
=`ls -1 /tmp/cups-$user/spool | wc -l`
712 count
=`expr $count - 1`
713 if test $count != 0; then
714 echo "FAIL: $count job control files were not purged."
715 echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile
716 fail
=`expr $fail + 1`
718 echo "PASS: All job control files purged."
719 echo "<P>PASS: All job control files purged.</P>" >>$strfile
722 # Pages printed on Test1 (within 1 page for timing-dependent cancel issues)
723 count
=`$GREP '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
724 expected
=`expr $pjobs \* 2 + 34`
725 expected2
=`expr $expected + 2`
726 if test $count -lt $expected -a $count -gt $expected2; then
727 echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected."
728 echo "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile
729 fail
=`expr $fail + 1`
731 echo "PASS: Printer 'Test1' correctly produced $count page(s)."
732 echo "<P>PASS: Printer 'Test1' correctly produced $count page(s).</P>" >>$strfile
735 # Paged printed on Test2
736 count
=`$GREP '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
737 expected
=`expr $pjobs \* 2 + 3`
738 if test $count != $expected; then
739 echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected."
740 echo "<P>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</P>" >>$strfile
741 fail
=`expr $fail + 1`
743 echo "PASS: Printer 'Test2' correctly produced $count page(s)."
744 echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile
747 # Paged printed on Test3
748 count
=`$GREP '^Test3 ' /tmp/cups-$user/log/page_log | grep -v total | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
750 if test $count != $expected; then
751 echo "FAIL: Printer 'Test3' produced $count page(s), expected $expected."
752 echo "<P>FAIL: Printer 'Test3' produced $count page(s), expected $expected.</P>" >>$strfile
753 fail
=`expr $fail + 1`
755 echo "PASS: Printer 'Test3' correctly produced $count page(s)."
756 echo "<P>PASS: Printer 'Test3' correctly produced $count page(s).</P>" >>$strfile
760 count
=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
761 expected
=`expr 37 + 18 + 28 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
762 if test $count != $expected; then
763 echo "FAIL: $count requests logged, expected $expected."
764 echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile
765 fail
=`expr $fail + 1`
767 echo "PASS: $count requests logged."
768 echo "<P>PASS: $count requests logged.</P>" >>$strfile
771 # Did CUPS-Get-Default get logged?
772 if $GREP -q CUPS-Get-Default
/tmp
/cups-
$user/log
/access_log
; then
773 echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'"
774 echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile
775 echo "<PRE>" >>$strfile
776 $GREP CUPS-Get-Default
/tmp
/cups-
$user/log
/access_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
777 echo "</PRE>" >>$strfile
778 fail
=`expr $fail + 1`
780 echo "PASS: CUPS-Get-Default not logged."
781 echo "<P>PASS: CUPS-Get-Default not logged.</P>" >>$strfile
784 # Emergency log messages
785 count
=`$GREP '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
786 if test $count != 0; then
787 echo "FAIL: $count emergency messages, expected 0."
788 $GREP '^X ' /tmp
/cups-
$user/log
/error_log
789 echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile
790 echo "<PRE>" >>$strfile
791 $GREP '^X ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
792 echo "</PRE>" >>$strfile
793 fail
=`expr $fail + 1`
795 echo "PASS: $count emergency messages."
796 echo "<P>PASS: $count emergency messages.</P>" >>$strfile
800 count
=`$GREP '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
801 if test $count != 0; then
802 echo "FAIL: $count alert messages, expected 0."
803 $GREP '^A ' /tmp
/cups-
$user/log
/error_log
804 echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile
805 echo "<PRE>" >>$strfile
806 $GREP '^A ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
807 echo "</PRE>" >>$strfile
808 fail
=`expr $fail + 1`
810 echo "PASS: $count alert messages."
811 echo "<P>PASS: $count alert messages.</P>" >>$strfile
814 # Critical log messages
815 count
=`$GREP '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
816 if test $count != 0; then
817 echo "FAIL: $count critical messages, expected 0."
818 $GREP '^C ' /tmp
/cups-
$user/log
/error_log
819 echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile
820 echo "<PRE>" >>$strfile
821 $GREP '^C ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
822 echo "</PRE>" >>$strfile
823 fail
=`expr $fail + 1`
825 echo "PASS: $count critical messages."
826 echo "<P>PASS: $count critical messages.</P>" >>$strfile
830 count
=`$GREP '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
831 if test $count != 33; then
832 echo "FAIL: $count error messages, expected 33."
833 $GREP '^E ' /tmp
/cups-
$user/log
/error_log
834 echo "<P>FAIL: $count error messages, expected 33.</P>" >>$strfile
835 echo "<PRE>" >>$strfile
836 $GREP '^E ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
837 echo "</PRE>" >>$strfile
838 fail
=`expr $fail + 1`
840 echo "PASS: $count error messages."
841 echo "<P>PASS: $count error messages.</P>" >>$strfile
844 # Warning log messages
845 count
=`$GREP '^W ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
846 if test $count != 9; then
847 echo "FAIL: $count warning messages, expected 9."
848 $GREP '^W ' /tmp
/cups-
$user/log
/error_log
849 echo "<P>FAIL: $count warning messages, expected 9.</P>" >>$strfile
850 echo "<PRE>" >>$strfile
851 $GREP '^W ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
852 echo "</PRE>" >>$strfile
853 fail
=`expr $fail + 1`
855 echo "PASS: $count warning messages."
856 echo "<P>PASS: $count warning messages.</P>" >>$strfile
859 # Notice log messages
860 count
=`$GREP '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
861 if test $count != 0; then
862 echo "FAIL: $count notice messages, expected 0."
863 $GREP '^N ' /tmp
/cups-
$user/log
/error_log
864 echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile
865 echo "<PRE>" >>$strfile
866 $GREP '^N ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
867 echo "</PRE>" >>$strfile
868 fail
=`expr $fail + 1`
870 echo "PASS: $count notice messages."
871 echo "<P>PASS: $count notice messages.</P>" >>$strfile
875 count
=`$GREP '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
876 if test $count = 0; then
877 echo "FAIL: $count info messages, expected more than 0."
878 echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile
879 fail
=`expr $fail + 1`
881 echo "PASS: $count info messages."
882 echo "<P>PASS: $count info messages.</P>" >>$strfile
886 count
=`$GREP '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
887 if test $count = 0; then
888 echo "FAIL: $count debug messages, expected more than 0."
889 echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile
890 fail
=`expr $fail + 1`
892 echo "PASS: $count debug messages."
893 echo "<P>PASS: $count debug messages.</P>" >>$strfile
896 # Debug2 log messages
897 count
=`$GREP '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
898 if test $count = 0; then
899 echo "FAIL: $count debug2 messages, expected more than 0."
900 echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile
901 fail
=`expr $fail + 1`
903 echo "PASS: $count debug2 messages."
904 echo "<P>PASS: $count debug2 messages.</P>" >>$strfile
908 echo "<H2>access_log</H2>" >>$strfile
909 echo "<PRE>" >>$strfile
910 sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp
/cups-
$user/log
/access_log
>>$strfile
911 echo "</PRE>" >>$strfile
913 echo "<H2>error_log</H2>" >>$strfile
914 echo "<PRE>" >>$strfile
915 $GREP -v '^d' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
916 echo "</PRE>" >>$strfile
918 echo "<H2>page_log</H2>" >>$strfile
919 echo "<PRE>" >>$strfile
920 sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp
/cups-
$user/log
/page_log
>>$strfile
921 echo "</PRE>" >>$strfile
924 # Format the reports and tell the user where to find them...
927 cat str-trailer.html
>>$strfile
931 if test $fail != 0; then
932 echo "$fail tests failed."
933 cp /tmp
/cups-
$user/log
/error_log error_log-
$date-$user
936 echo "All tests were successful."
939 echo "Log files can be found in /tmp/cups-$user/log."
940 echo "A HTML report was created in $strfile."
943 if test $fail != 0; then
944 echo "Copies of the error_log and `basename $strfile` files are in"
952 # End of "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $"