5 # Perform the complete set of IPP compliance tests specified in the
6 # CUPS Software Test Plan.
8 # Copyright 2007-2013 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)"
106 echo "Running the medium tests (2)"
114 echo "Running the extreme tests (3)"
122 echo "Running the torture tests (4)"
130 echo "Running the timid tests (1)"
140 # See if we want to do SSL testing...
144 echo "Now you can choose whether to create a SSL/TLS encryption key and"
145 echo "certificate for testing; these tests currently require the OpenSSL"
148 echo "0 - Do not do SSL/TLS encryption tests"
149 echo "1 - Test but do not require encryption"
150 echo "2 - Test and require encryption"
152 echo $ac_n "Enter the number of the SSL/TLS tests to perform: [0] $ac_c"
154 if test $# -gt 0; then
164 echo "Will test but not require encryption (1)"
167 echo "Will test and require encryption (2)"
170 echo "Not using SSL/TLS (0)"
176 # Information for the server/tests...
180 if test -z "$user"; then
181 if test -x /usr
/ucb
/whoami
; then
182 user
=`/usr/ucb/whoami`
187 if test -z "$user"; then
197 # Make sure that the LPDEST and PRINTER environment variables are
198 # not included in the environment that is passed to the tests. These
199 # will usually cause tests to fail erroneously...
206 # See if we want to use valgrind...
210 echo "This test script can use the Valgrind software from:"
212 echo " http://developer.kde.org/~sewardj/"
214 echo $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c"
216 if test $# -gt 0; then
224 case "$usevalgrind" in
226 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"
227 if test `uname` = Darwin
; then
228 VALGRIND
="$VALGRIND --dsymutil=yes"
231 echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..."
241 # See if we want to do debug logging of the libraries...
245 echo "If CUPS was built with the --enable-debug-printfs configure option, you"
246 echo "can enable debug logging of the libraries."
248 echo $ac_n "Enter Y or a number from 0 to 9 to enable debug logging or N to not: [N] $ac_c"
250 if test $# -gt 0; then
258 case "$usedebugprintfs" in
260 echo "Enabling debug printfs (level 5); log files can be found in /tmp/cups-$user/log..."
261 CUPS_DEBUG_LOG
="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
262 CUPS_DEBUG_LEVEL
=5; export CUPS_DEBUG_LEVEL
263 CUPS_DEBUG_FILTER
='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
266 0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9)
267 echo "Enabling debug printfs (level $usedebugprintfs); log files can be found in /tmp/cups-$user/log..."
268 CUPS_DEBUG_LOG
="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
269 CUPS_DEBUG_LEVEL
="$usedebugprintfs"; export CUPS_DEBUG_LEVEL
270 CUPS_DEBUG_FILTER
='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
278 # Start by creating temporary directories for the tests...
281 echo "Creating directories for test..."
283 rm -rf /tmp
/cups-
$user
284 mkdir
/tmp
/cups-
$user
285 mkdir
/tmp
/cups-
$user/bin
286 mkdir
/tmp
/cups-
$user/bin
/backend
287 mkdir
/tmp
/cups-
$user/bin
/driver
288 mkdir
/tmp
/cups-
$user/bin
/filter
289 mkdir
/tmp
/cups-
$user/certs
290 mkdir
/tmp
/cups-
$user/share
291 mkdir
/tmp
/cups-
$user/share
/banners
292 mkdir
/tmp
/cups-
$user/share
/drv
293 mkdir
/tmp
/cups-
$user/share
/locale
294 for file in ..
/locale
/cups_
*.po
; do
295 loc
=`basename $file .po | cut -c 6-`
296 mkdir
/tmp
/cups-
$user/share
/locale
/$loc
297 ln -s $root/locale
/cups_
$loc.po
/tmp
/cups-
$user/share
/locale
/$loc
298 ln -s $root/locale
/ppdc_
$loc.po
/tmp
/cups-
$user/share
/locale
/$loc
300 mkdir
/tmp
/cups-
$user/share
/mime
301 mkdir
/tmp
/cups-
$user/share
/model
302 mkdir
/tmp
/cups-
$user/share
/ppdc
303 mkdir
/tmp
/cups-
$user/interfaces
304 mkdir
/tmp
/cups-
$user/log
305 mkdir
/tmp
/cups-
$user/ppd
306 mkdir
/tmp
/cups-
$user/spool
307 mkdir
/tmp
/cups-
$user/spool
/temp
308 mkdir
/tmp
/cups-
$user/ssl
310 ln -s $root/backend
/dnssd
/tmp
/cups-
$user/bin
/backend
311 ln -s $root/backend
/http
/tmp
/cups-
$user/bin
/backend
312 ln -s $root/backend
/ipp
/tmp
/cups-
$user/bin
/backend
313 ln -s $root/backend
/lpd
/tmp
/cups-
$user/bin
/backend
314 ln -s $root/backend
/mdns
/tmp
/cups-
$user/bin
/backend
315 ln -s $root/backend
/pseudo
/tmp
/cups-
$user/bin
/backend
316 ln -s $root/backend
/snmp
/tmp
/cups-
$user/bin
/backend
317 ln -s $root/backend
/socket
/tmp
/cups-
$user/bin
/backend
318 ln -s $root/backend
/usb
/tmp
/cups-
$user/bin
/backend
319 ln -s $root/cgi-bin
/tmp
/cups-
$user/bin
320 ln -s $root/monitor
/tmp
/cups-
$user/bin
321 ln -s $root/notifier
/tmp
/cups-
$user/bin
322 ln -s $root/scheduler
/tmp
/cups-
$user/bin
/daemon
323 ln -s $root/filter
/commandtops
/tmp
/cups-
$user/bin
/filter
324 ln -s $root/filter
/gziptoany
/tmp
/cups-
$user/bin
/filter
325 ln -s $root/filter
/pstops
/tmp
/cups-
$user/bin
/filter
326 ln -s $root/filter
/rastertoepson
/tmp
/cups-
$user/bin
/filter
327 ln -s $root/filter
/rastertohp
/tmp
/cups-
$user/bin
/filter
328 ln -s $root/filter
/rastertolabel
/tmp
/cups-
$user/bin
/filter
329 ln -s $root/filter
/rastertopwg
/tmp
/cups-
$user/bin
/filter
331 ln -s $root/data
/classified
/tmp
/cups-
$user/share
/banners
332 ln -s $root/data
/confidential
/tmp
/cups-
$user/share
/banners
333 ln -s $root/data
/secret
/tmp
/cups-
$user/share
/banners
334 ln -s $root/data
/standard
/tmp
/cups-
$user/share
/banners
335 ln -s $root/data
/topsecret
/tmp
/cups-
$user/share
/banners
336 ln -s $root/data
/unclassified
/tmp
/cups-
$user/share
/banners
337 ln -s $root/data
/tmp
/cups-
$user/share
338 ln -s $root/ppdc
/sample.drv
/tmp
/cups-
$user/share
/drv
339 ln -s $root/conf
/mime.types
/tmp
/cups-
$user/share
/mime
340 ln -s $root/conf
/mime.convs
/tmp
/cups-
$user/share
/mime
341 ln -s $root/data
/*.h
/tmp
/cups-
$user/share
/ppdc
342 ln -s $root/data
/*.defs
/tmp
/cups-
$user/share
/ppdc
343 ln -s $root/templates
/tmp
/cups-
$user/share
346 # Local filters and configuration files...
350 # instfilter src dst format
352 # See if the filter exists in a standard location; if so, make a
353 # symlink, otherwise create a dummy script for the specified format.
359 for dir
in /usr
/libexec
/cups
/filter
/usr
/lib
/cups
/filter
; do
360 if test -x "$dir/$src"; then
361 ln -s "$dir/$src" "/tmp/cups-$user/bin/filter/$dst"
366 # Source filter not present, create a dummy filter
369 ln -s gziptoany
"/tmp/cups-$user/bin/filter/$dst"
372 cat >"/tmp/cups-$user/bin/filter/$dst" <<EOF
375 *media=a4* | *media=iso_a4* | *PageSize=A4*)
376 cat "$root/test/onepage-a4.pdf"
379 cat "$root/test/onepage-letter.pdf"
383 chmod +x
"/tmp/cups-$user/bin/filter/$dst"
386 cat >"/tmp/cups-$user/bin/filter/$dst" <<EOF
389 *media=a4* | *media=iso_a4* | *PageSize=A4*)
390 cat "$root/test/onepage-a4.ps"
393 cat "$root/test/onepage-letter.ps"
397 chmod +x
"/tmp/cups-$user/bin/filter/$dst"
400 cat >"/tmp/cups-$user/bin/filter/$dst" <<EOF
403 *media=a4* | *media=iso_a4* | *PageSize=A4*)
404 gunzip -c "$root/test/onepage-a4-300-black-1.pwg.gz"
407 gunzip -c "$root/test/onepage-letter-300-black-1.pwg.gz"
411 chmod +x
"/tmp/cups-$user/bin/filter/$dst"
416 ln -s $root/test
/test.convs
/tmp
/cups-
$user/share
/mime
418 if test `uname` = Darwin
; then
419 instfilter cgbannertopdf bannertopdf pdf
420 instfilter cgimagetopdf imagetopdf pdf
421 instfilter cgpdftopdf pdftopdf passthru
422 instfilter cgpdftops pdftops ps
423 instfilter cgpdftoraster pdftoraster raster
424 instfilter cgtexttopdf texttopdf pdf
425 instfilter pstocupsraster pstoraster raster
426 instfilter pstopdffilter pstopdf pdf
428 instfilter bannertopdf bannertopdf pdf
429 instfilter bannertops bannertops ps
430 instfilter imagetopdf imagetopdf pdf
431 instfilter pdftopdf pdftopdf passthru
432 instfilter pdftops pdftops ps
433 instfilter pdftoraster pdftoraster raster
434 instfilter pstoraster pstoraster raster
435 instfilter texttopdf texttopdf pdf
437 if test -d /usr
/share
/cups
/charsets
; then
438 ln -s /usr
/share
/cups
/charsets
/tmp
/cups-
$user/share
443 # Then create the necessary config files...
446 echo "Creating cupsd.conf for test..."
448 if test $ssltype = 2; then
449 encryption
="Encryption Required"
454 cat >/tmp
/cups-
$user/cupsd.conf
<<EOF
455 StrictConformance Yes
457 Listen localhost:$port
458 Listen /tmp/cups-$user/sock
460 PassEnv DYLD_INSERT_LIBRARIES
463 AccessLogLevel actions
466 PreserveJobHistory Yes
476 if test $testtype = 0; then
477 echo WebInterface
yes >>/tmp
/cups-
$user/cupsd.conf
480 cat >/tmp
/cups-
$user/cups-files.conf
<<EOF
484 ServerRoot /tmp/cups-$user
485 StateDir /tmp/cups-$user
486 ServerBin /tmp/cups-$user/bin
487 CacheDir /tmp/cups-$user/share
488 DataDir /tmp/cups-$user/share
489 FontPath /tmp/cups-$user/share/fonts
490 DocumentRoot $root/doc
491 RequestRoot /tmp/cups-$user/spool
492 TempDir /tmp/cups-$user/spool/temp
493 AccessLog /tmp/cups-$user/log/access_log
494 ErrorLog /tmp/cups-$user/log/error_log
495 PageLog /tmp/cups-$user/log/page_log
498 if test $ssltype != 0 -a `uname` = Darwin
; then
499 echo "ServerKeychain $HOME/Library/Keychains/login.keychain" >> /tmp
/cups-
$user/cups-files.conf
503 # Setup lots of test queues - half with PPD files, half without...
506 echo "Creating printers.conf for test..."
509 while test $i -le $nprinters1; do
510 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
513 DeviceURI file:/dev/null
514 Info Test PS printer $i
516 Location CUPS test suite
518 StateMessage Printer $1 is idle.
522 cp testps.ppd
/tmp
/cups-
$user/ppd
/test-
$i.ppd
527 while test $i -le $nprinters2; do
528 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
531 DeviceURI file:/dev/null
532 Info Test raw printer $i
534 Location CUPS test suite
536 StateMessage Printer $1 is idle.
543 if test -f /tmp
/cups-
$user/printers.conf
; then
544 cp /tmp
/cups-
$user/printers.conf
/tmp
/cups-
$user/printers.conf.orig
546 touch /tmp
/cups-
$user/printers.conf.orig
553 echo "Setting up environment variables for test..."
555 if test "x$LD_LIBRARY_PATH" = x
; then
556 LD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
558 LD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$LD_LIBRARY_PATH"
561 export LD_LIBRARY_PATH
563 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"
564 if test `uname` = SunOS
-a -r /usr
/lib
/libCrun.so
.1; then
565 LD_PRELOAD
="/usr/lib/libCrun.so.1:$LD_PRELOAD"
569 if test "x$DYLD_LIBRARY_PATH" = x
; then
570 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
572 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$DYLD_LIBRARY_PATH"
575 export DYLD_LIBRARY_PATH
577 if test "x$SHLIB_PATH" = x
; then
578 SHLIB_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
580 SHLIB_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$SHLIB_PATH"
585 CUPS_DISABLE_APPLE_DEFAULT
=yes; export CUPS_DISABLE_APPLE_DEFAULT
586 CUPS_SERVER
=localhost
:8631; export CUPS_SERVER
587 CUPS_SERVERROOT
=/tmp
/cups-
$user; export CUPS_SERVERROOT
588 CUPS_STATEDIR
=/tmp
/cups-
$user; export CUPS_STATEDIR
589 CUPS_DATADIR
=/tmp
/cups-
$user/share
; export CUPS_DATADIR
590 LOCALEDIR
=/tmp
/cups-
$user/share
/locale
; export LOCALEDIR
593 # Set a new home directory to avoid getting user options mixed in...
600 # Force POSIX locale for tests...
610 # Start the server; run as foreground daemon in the background...
613 echo "Starting scheduler:"
614 echo " $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &"
617 if test `uname` = Darwin
-a "x$VALGRIND" = x
; then
618 DYLD_INSERT_LIBRARIES
=/usr
/lib
/libgmalloc.dylib
619 ..
/scheduler
/cupsd
-c /tmp
/cups-
$user/cupsd.conf
-f >/tmp
/cups-
$user/log
/debug_log
2>&1 &
621 $VALGRIND ..
/scheduler
/cupsd
-c /tmp
/cups-
$user/cupsd.conf
-f >/tmp
/cups-
$user/log
/debug_log
2>&1 &
626 if test "x$testtype" = x0
; then
627 # Not running tests...
628 echo "Scheduler is PID $cupsd and is listening on port 8631."
631 # Create a helper script to run programs with...
632 runcups
="/tmp/cups-$user/runcups"
634 echo "#!/bin/sh" >$runcups
635 echo "# Helper script for running CUPS test instance." >>$runcups
637 echo "# Set required environment variables..." >>$runcups
638 echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups
639 echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups
640 echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups
641 echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups
642 echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups
643 echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups
644 echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups
645 echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups
646 echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups
647 if test "x$CUPS_DEBUG_LEVEL" != x
; then
648 echo "CUPS_DEBUG_FILTER='$CUPS_DEBUG_FILTER'; export CUPS_DEBUG_FILTER" >>$runcups
649 echo "CUPS_DEBUG_LEVEL=$CUPS_DEBUG_LEVEL; export CUPS_DEBUG_LEVEL" >>$runcups
650 echo "CUPS_DEBUG_LOG='$CUPS_DEBUG_LOG'; export CUPS_DEBUG_LOG" >>$runcups
653 echo "# Run command..." >>$runcups
654 echo "exec \"\$@\"" >>$runcups
658 echo "The $runcups helper script can be used to test programs"
659 echo "with the server."
663 if test $argcount -eq 0; then
664 echo "Scheduler is PID $cupsd; run debugger now if you need to."
666 echo $ac_n "Press ENTER to continue... $ac_c"
669 echo "Scheduler is PID $cupsd."
673 IPP_PORT
=$port; export IPP_PORT
676 running
=`../systemv/lpstat -r 2>/dev/null`
677 if test "x$running" = "xscheduler is running"; then
681 echo "Waiting for scheduler to become ready..."
686 # Create the test report source file...
689 date=`date "+%Y-%m-%d"`
690 strfile
=/tmp
/cups-
$user/cups-str-2.0
-$date-$user.html
693 cat str-header.html
>$strfile
696 # Run the IPP tests...
700 echo "Running IPP compliance tests..."
702 echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile
703 echo "<P>This section provides the results to the IPP compliance tests" >>$strfile
704 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
705 echo `date "+%Y-%m-%d"` by
$user on
`hostname`.
>>$strfile
706 echo "<PRE>" >>$strfile
709 for file in 4*.
test ipp-2.1.
test; do
710 echo $ac_n "Performing $file: $ac_c"
713 if test $file = ipp-2.1.
test; then
714 uri
="ipp://localhost:$port/printers/Test1"
715 options
="-V 2.1 -d NOPRINT=1 -f testfile.ps"
717 uri
="ipp://localhost:$port/printers"
720 $VALGRIND .
/ipptool
-tI $options $uri $file >> $strfile
723 if test $status != 0; then
725 fail
=`expr $fail + 1`
731 echo "</PRE>" >>$strfile
734 # Run the command tests...
738 echo "Running command tests..."
740 echo "<H1>2 - Command Tests</H1>" >>$strfile
741 echo "<P>This section provides the results to the command tests" >>$strfile
742 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
743 echo $date by
$user on
`hostname`.
>>$strfile
744 echo "<PRE>" >>$strfile
746 for file in 5*.sh
; do
747 echo $ac_n "Performing $file: $ac_c"
749 echo "\"$file\":" >>$strfile
751 sh
$file $pjobs $pprinters >> $strfile
754 if test $status != 0; then
756 fail
=`expr $fail + 1`
762 echo "</PRE>" >>$strfile
771 # Append the log files for post-mortim...
774 echo "<H1>3 - Log Files</H1>" >>$strfile
782 echo "<H2>Summary</H2>" >>$strfile
785 count
=`ls -1 /tmp/cups-$user/spool | wc -l`
786 count
=`expr $count - 1`
787 if test $count != 0; then
788 echo "FAIL: $count job control files were not purged."
789 echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile
790 fail
=`expr $fail + 1`
792 echo "PASS: All job control files purged."
793 echo "<P>PASS: All job control files purged.</P>" >>$strfile
796 # Pages printed on Test1 (within 1 page for timing-dependent cancel issues)
797 count
=`$GREP '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
798 expected
=`expr $pjobs \* 2 + 34`
799 expected2
=`expr $expected + 2`
800 if test $count -lt $expected -a $count -gt $expected2; then
801 echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected."
802 echo "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile
803 fail
=`expr $fail + 1`
805 echo "PASS: Printer 'Test1' correctly produced $count page(s)."
806 echo "<P>PASS: Printer 'Test1' correctly produced $count page(s).</P>" >>$strfile
809 # Paged printed on Test2
810 count
=`$GREP '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
811 expected
=`expr $pjobs \* 2 + 3`
812 if test $count != $expected; then
813 echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected."
814 echo "<P>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</P>" >>$strfile
815 fail
=`expr $fail + 1`
817 echo "PASS: Printer 'Test2' correctly produced $count page(s)."
818 echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile
821 # Paged printed on Test3
822 count
=`$GREP '^Test3 ' /tmp/cups-$user/log/page_log | grep -v total | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
824 if test $count != $expected; then
825 echo "FAIL: Printer 'Test3' produced $count page(s), expected $expected."
826 echo "<P>FAIL: Printer 'Test3' produced $count page(s), expected $expected.</P>" >>$strfile
827 fail
=`expr $fail + 1`
829 echo "PASS: Printer 'Test3' correctly produced $count page(s)."
830 echo "<P>PASS: Printer 'Test3' correctly produced $count page(s).</P>" >>$strfile
834 count
=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
835 expected
=`expr 37 + 18 + 28 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
836 if test $count != $expected; then
837 echo "FAIL: $count requests logged, expected $expected."
838 echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile
839 fail
=`expr $fail + 1`
841 echo "PASS: $count requests logged."
842 echo "<P>PASS: $count requests logged.</P>" >>$strfile
845 # Did CUPS-Get-Default get logged?
846 if $GREP -q CUPS-Get-Default
/tmp
/cups-
$user/log
/access_log
; then
847 echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'"
848 echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile
849 echo "<PRE>" >>$strfile
850 $GREP CUPS-Get-Default
/tmp
/cups-
$user/log
/access_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
851 echo "</PRE>" >>$strfile
852 fail
=`expr $fail + 1`
854 echo "PASS: CUPS-Get-Default not logged."
855 echo "<P>PASS: CUPS-Get-Default not logged.</P>" >>$strfile
858 # Emergency log messages
859 count
=`$GREP '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
860 if test $count != 0; then
861 echo "FAIL: $count emergency messages, expected 0."
862 $GREP '^X ' /tmp
/cups-
$user/log
/error_log
863 echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile
864 echo "<PRE>" >>$strfile
865 $GREP '^X ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
866 echo "</PRE>" >>$strfile
867 fail
=`expr $fail + 1`
869 echo "PASS: $count emergency messages."
870 echo "<P>PASS: $count emergency messages.</P>" >>$strfile
874 count
=`$GREP '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
875 if test $count != 0; then
876 echo "FAIL: $count alert messages, expected 0."
877 $GREP '^A ' /tmp
/cups-
$user/log
/error_log
878 echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile
879 echo "<PRE>" >>$strfile
880 $GREP '^A ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
881 echo "</PRE>" >>$strfile
882 fail
=`expr $fail + 1`
884 echo "PASS: $count alert messages."
885 echo "<P>PASS: $count alert messages.</P>" >>$strfile
888 # Critical log messages
889 count
=`$GREP '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
890 if test $count != 0; then
891 echo "FAIL: $count critical messages, expected 0."
892 $GREP '^C ' /tmp
/cups-
$user/log
/error_log
893 echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile
894 echo "<PRE>" >>$strfile
895 $GREP '^C ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
896 echo "</PRE>" >>$strfile
897 fail
=`expr $fail + 1`
899 echo "PASS: $count critical messages."
900 echo "<P>PASS: $count critical messages.</P>" >>$strfile
904 count
=`$GREP '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
905 if test $count != 33; then
906 echo "FAIL: $count error messages, expected 33."
907 $GREP '^E ' /tmp
/cups-
$user/log
/error_log
908 echo "<P>FAIL: $count error messages, expected 33.</P>" >>$strfile
909 echo "<PRE>" >>$strfile
910 $GREP '^E ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
911 echo "</PRE>" >>$strfile
912 fail
=`expr $fail + 1`
914 echo "PASS: $count error messages."
915 echo "<P>PASS: $count error messages.</P>" >>$strfile
918 # Warning log messages
919 count
=`$GREP '^W ' /tmp/cups-$user/log/error_log | $GREP -v CreateProfile | wc -l | awk '{print $1}'`
920 if test $count != 9; then
921 echo "FAIL: $count warning messages, expected 9."
922 $GREP '^W ' /tmp
/cups-
$user/log
/error_log
923 echo "<P>FAIL: $count warning messages, expected 9.</P>" >>$strfile
924 echo "<PRE>" >>$strfile
925 $GREP '^W ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
926 echo "</PRE>" >>$strfile
927 fail
=`expr $fail + 1`
929 echo "PASS: $count warning messages."
930 echo "<P>PASS: $count warning messages.</P>" >>$strfile
933 # Notice log messages
934 count
=`$GREP '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
935 if test $count != 0; then
936 echo "FAIL: $count notice messages, expected 0."
937 $GREP '^N ' /tmp
/cups-
$user/log
/error_log
938 echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile
939 echo "<PRE>" >>$strfile
940 $GREP '^N ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
941 echo "</PRE>" >>$strfile
942 fail
=`expr $fail + 1`
944 echo "PASS: $count notice messages."
945 echo "<P>PASS: $count notice messages.</P>" >>$strfile
949 count
=`$GREP '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
950 if test $count = 0; then
951 echo "FAIL: $count info messages, expected more than 0."
952 echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile
953 fail
=`expr $fail + 1`
955 echo "PASS: $count info messages."
956 echo "<P>PASS: $count info messages.</P>" >>$strfile
960 count
=`$GREP '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
961 if test $count = 0; then
962 echo "FAIL: $count debug messages, expected more than 0."
963 echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile
964 fail
=`expr $fail + 1`
966 echo "PASS: $count debug messages."
967 echo "<P>PASS: $count debug messages.</P>" >>$strfile
970 # Debug2 log messages
971 count
=`$GREP '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
972 if test $count = 0; then
973 echo "FAIL: $count debug2 messages, expected more than 0."
974 echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile
975 fail
=`expr $fail + 1`
977 echo "PASS: $count debug2 messages."
978 echo "<P>PASS: $count debug2 messages.</P>" >>$strfile
982 echo "<H2>access_log</H2>" >>$strfile
983 echo "<PRE>" >>$strfile
984 sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp
/cups-
$user/log
/access_log
>>$strfile
985 echo "</PRE>" >>$strfile
987 echo "<H2>error_log</H2>" >>$strfile
988 echo "<PRE>" >>$strfile
989 $GREP -v '^d' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
990 echo "</PRE>" >>$strfile
992 echo "<H2>page_log</H2>" >>$strfile
993 echo "<PRE>" >>$strfile
994 sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp
/cups-
$user/log
/page_log
>>$strfile
995 echo "</PRE>" >>$strfile
998 # Format the reports and tell the user where to find them...
1001 cat str-trailer.html
>>$strfile
1005 if test $fail != 0; then
1006 echo "$fail tests failed."
1007 cp /tmp
/cups-
$user/log
/error_log error_log-
$date-$user
1010 echo "All tests were successful."
1013 echo "Log files can be found in /tmp/cups-$user/log."
1014 echo "A HTML report was created in $strfile."
1017 if test $fail != 0; then
1018 echo "Copies of the error_log and `basename $strfile` files are in"