]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - test/run-stp-tests.sh
Merge changes from CUPS 1.6svn-r9968.
[thirdparty/cups.git] / test / run-stp-tests.sh
index 9676778602ac3e5943acbc3a6528d09a3c6cadce..85aa9ce32823b3246000a3576381be1686594041 100755 (executable)
@@ -1,11 +1,11 @@
 #!/bin/sh
 #
-# "$Id: run-stp-tests.sh 6649 2007-07-11 21:46:42Z mike $"
+# "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $"
 #
 #   Perform the complete set of IPP compliance tests specified in the
 #   CUPS Software Test Plan.
 #
-#   Copyright 2007-2008 by Apple Inc.
+#   Copyright 2007-2011 by Apple Inc.
 #   Copyright 1997-2007 by Easy Software Products, all rights reserved.
 #
 #   These coded instructions, statements, and computer programs are the
@@ -23,11 +23,21 @@ argcount=$#
 
 make
 
+#
+# Solaris has a non-POSIX grep in /bin...
+#
+
+if test -x /usr/xpg4/bin/grep; then
+       GREP=/usr/xpg4/bin/grep
+else
+       GREP=grep
+fi
+
 #
 # Figure out the proper echo options...
 #
 
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+if (echo "testing\c"; echo 1,2,3) | $GREP c >/dev/null; then
         ac_n=-n
         ac_c=
 else
@@ -74,30 +84,35 @@ case "$testtype" in
                nprinters1=0
                nprinters2=0
                pjobs=0
+               pprinters=0
                ;;
        2)
                echo "Running the medium tests (2)"
                nprinters1=10
                nprinters2=20
                pjobs=20
+               pprinters=10
                ;;
        3)
                echo "Running the extreme tests (3)"
                nprinters1=500
                nprinters2=1000
                pjobs=100
+               pprinters=50
                ;;
        4)
                echo "Running the torture tests (4)"
                nprinters1=10000
                nprinters2=20000
                pjobs=200
+               pprinters=100
                ;;
        *)
                echo "Running the timid tests (1)"
                nprinters1=0
                nprinters2=0
                pjobs=10
+               pprinters=0
                ;;
 esac
 
@@ -188,7 +203,7 @@ echo ""
 
 case "$usevalgrind" in
        Y* | y*)
-               valgrind="valgrind --tool=memcheck --log-file=/tmp/cups-$user/log/valgrind --error-limit=no --leak-check=yes --trace-children=yes"
+               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"
                echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..."
                ;;
 
@@ -197,6 +212,43 @@ case "$usevalgrind" in
                ;;
 esac
 
+#
+# See if we want to do debug logging of the libraries...
+#
+
+echo ""
+echo "If CUPS was built with the --enable-debug-printfs configure option, you"
+echo "can enable debug logging of the libraries."
+echo ""
+echo $ac_n "Enter Y or a number from 0 to 9 to enable debug logging or N to not: [N] $ac_c"
+
+if test $# -gt 0; then
+       usedebugprintfs=$1
+       shift
+else
+       read usedebugprintfs
+fi
+echo ""
+
+case "$usedebugprintfs" in
+       Y* | y*)
+               echo "Enabling debug printfs; log files can be found in /tmp/cups-$user/log..."
+               CUPS_DEBUG_LOG="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
+               CUPS_DEBUG_LEVEL=5; export CUPS_DEBUG_LEVEL
+               CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetRespond|cupsSend).*$'; export CUPS_DEBUG_FILTER
+               ;;
+
+       0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)
+               echo "Enabling debug printfs; log files can be found in /tmp/cups-$user/log..."
+               CUPS_DEBUG_LOG="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
+               CUPS_DEBUG_LEVEL=$usedebugprintf; export CUPS_DEBUG_LEVEL
+               CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetRespond|cupsSend).*$'; export CUPS_DEBUG_FILTER
+               ;;
+
+       *)
+               ;;
+esac
+
 #
 # Start by creating temporary directories for the tests...
 #
@@ -212,7 +264,17 @@ mkdir /tmp/cups-$user/bin/filter
 mkdir /tmp/cups-$user/certs
 mkdir /tmp/cups-$user/share
 mkdir /tmp/cups-$user/share/banners
+mkdir /tmp/cups-$user/share/drv
+mkdir /tmp/cups-$user/share/locale
+for file in ../locale/cups_*.po; do
+       loc=`basename $file .po | cut -c 6-`
+       mkdir /tmp/cups-$user/share/locale/$loc
+       ln -s $root/locale/cups_$loc.po /tmp/cups-$user/share/locale/$loc
+       ln -s $root/locale/ppdc_$loc.po /tmp/cups-$user/share/locale/$loc
+done
+mkdir /tmp/cups-$user/share/mime
 mkdir /tmp/cups-$user/share/model
+mkdir /tmp/cups-$user/share/ppdc
 mkdir /tmp/cups-$user/interfaces
 mkdir /tmp/cups-$user/log
 mkdir /tmp/cups-$user/ppd
@@ -220,24 +282,26 @@ mkdir /tmp/cups-$user/spool
 mkdir /tmp/cups-$user/spool/temp
 mkdir /tmp/cups-$user/ssl
 
+ln -s $root/backend/dnssd /tmp/cups-$user/bin/backend
 ln -s $root/backend/http /tmp/cups-$user/bin/backend
 ln -s $root/backend/ipp /tmp/cups-$user/bin/backend
 ln -s $root/backend/lpd /tmp/cups-$user/bin/backend
-ln -s $root/backend/parallel /tmp/cups-$user/bin/backend
-ln -s $root/backend/serial /tmp/cups-$user/bin/backend
+ln -s $root/backend/mdns /tmp/cups-$user/bin/backend
+ln -s $root/backend/pseudo /tmp/cups-$user/bin/backend
 ln -s $root/backend/snmp /tmp/cups-$user/bin/backend
 ln -s $root/backend/socket /tmp/cups-$user/bin/backend
 ln -s $root/backend/usb /tmp/cups-$user/bin/backend
 ln -s $root/cgi-bin /tmp/cups-$user/bin
-ln -s $root/ppdc/drv /tmp/cups-$user/bin/driver
 ln -s $root/monitor /tmp/cups-$user/bin
 ln -s $root/notifier /tmp/cups-$user/bin
 ln -s $root/scheduler /tmp/cups-$user/bin/daemon
-ln -s $root/filter/hpgltops /tmp/cups-$user/bin/filter
+ln -s $root/filter/commandtops /tmp/cups-$user/bin/filter
+ln -s $root/filter/gziptoany /tmp/cups-$user/bin/filter
 ln -s $root/filter/pstops /tmp/cups-$user/bin/filter
 ln -s $root/filter/rastertoepson /tmp/cups-$user/bin/filter
 ln -s $root/filter/rastertohp /tmp/cups-$user/bin/filter
-ln -s $root/filter/texttops /tmp/cups-$user/bin/filter
+ln -s $root/filter/rastertolabel /tmp/cups-$user/bin/filter
+ln -s $root/filter/rastertopwg /tmp/cups-$user/bin/filter
 
 ln -s $root/data/classified /tmp/cups-$user/share/banners
 ln -s $root/data/confidential /tmp/cups-$user/share/banners
@@ -245,36 +309,45 @@ ln -s $root/data/secret /tmp/cups-$user/share/banners
 ln -s $root/data/standard /tmp/cups-$user/share/banners
 ln -s $root/data/topsecret /tmp/cups-$user/share/banners
 ln -s $root/data/unclassified /tmp/cups-$user/share/banners
-ln -s $root/data /tmp/cups-$user/share/charmaps
-ln -s $root/data /tmp/cups-$user/share/charsets
 ln -s $root/data /tmp/cups-$user/share
-ln -s $root/fonts /tmp/cups-$user/share
-ln -s $root/ppd/*.ppd /tmp/cups-$user/share/model
+ln -s $root/ppdc/sample.drv /tmp/cups-$user/share/drv
+ln -s $root/conf/mime.types /tmp/cups-$user/share/mime
+ln -s $root/conf/mime.convs /tmp/cups-$user/share/mime
+ln -s $root/data/*.h /tmp/cups-$user/share/ppdc
+ln -s $root/data/*.defs /tmp/cups-$user/share/ppdc
 ln -s $root/templates /tmp/cups-$user/share
 
-if test $ssltype != 0; then
-       mkdir $root/ssl
-       cp server.* $root/ssl
-fi
-
 #
 # Mac OS X filters and configuration files...
 #
 
 if test `uname` = Darwin; then
        ln -s /usr/libexec/cups/filter/cgpdfto* /tmp/cups-$user/bin/filter
+       ln -s /usr/libexec/cups/filter/cgbannertopdf /tmp/cups-$user/bin/filter
+       ln -s /usr/libexec/cups/filter/cgimagetopdf /tmp/cups-$user/bin/filter
+       ln -s /usr/libexec/cups/filter/cgtexttopdf /tmp/cups-$user/bin/filter
        ln -s /usr/libexec/cups/filter/nsimagetopdf /tmp/cups-$user/bin/filter
        ln -s /usr/libexec/cups/filter/nstexttopdf /tmp/cups-$user/bin/filter
        ln -s /usr/libexec/cups/filter/pictwpstops /tmp/cups-$user/bin/filter
        ln -s /usr/libexec/cups/filter/pstoappleps /tmp/cups-$user/bin/filter
        ln -s /usr/libexec/cups/filter/pstocupsraster /tmp/cups-$user/bin/filter
        ln -s /usr/libexec/cups/filter/pstopdffilter /tmp/cups-$user/bin/filter
+       ln -s /usr/libexec/cups/filter/rastertourf /tmp/cups-$user/bin/filter
+       ln -s /usr/libexec/cups/filter/xhtmltopdf /tmp/cups-$user/bin/filter
 
-       ln -s /private/etc/cups/apple.* /tmp/cups-$user
+       if test -f /private/etc/cups/apple.types; then
+               ln -s /private/etc/cups/apple.* /tmp/cups-$user/share/mime
+       elif test -f /usr/share/cups/mime/apple.types; then
+               ln -s /usr/share/cups/mime/apple.* /tmp/cups-$user/share/mime
+       fi
 else
-       ln -s $root/filter/imagetops /tmp/cups-$user/bin/filter
-       ln -s $root/filter/imagetoraster /tmp/cups-$user/bin/filter
-       ln -s $root/filter/pdftops /tmp/cups-$user/bin/filter
+       ln -s /usr/lib/cups/filter/bannertops /tmp/cups-$user/bin/filter
+       ln -s /usr/lib/cups/filter/imagetops /tmp/cups-$user/bin/filter
+       ln -s /usr/lib/cups/filter/imagetoraster /tmp/cups-$user/bin/filter
+       ln -s /usr/lib/cups/filter/pdftops /tmp/cups-$user/bin/filter
+       ln -s /usr/lib/cups/filter/texttops /tmp/cups-$user/bin/filter
+
+       ln -s /usr/share/cups/mime/legacy.convs /tmp/cups-$user/share/mime
 fi
 
 #
@@ -301,14 +374,19 @@ ServerBin /tmp/cups-$user/bin
 CacheDir /tmp/cups-$user/share
 DataDir /tmp/cups-$user/share
 FontPath /tmp/cups-$user/share/fonts
+PassEnv LOCALEDIR
+PassEnv DYLD_INSERT_LIBRARIES
 DocumentRoot $root/doc
 RequestRoot /tmp/cups-$user/spool
 TempDir /tmp/cups-$user/spool/temp
+MaxSubscriptions 3
 MaxLogSize 0
 AccessLog /tmp/cups-$user/log/access_log
 ErrorLog /tmp/cups-$user/log/error_log
 PageLog /tmp/cups-$user/log/page_log
-LogLevel debug
+AccessLogLevel actions
+LogLevel debug2
+LogTimeFormat usecs
 PreserveJobHistory Yes
 <Policy default>
 <Limit All>
@@ -320,11 +398,8 @@ $encryption
 </Policy>
 EOF
 
-touch /tmp/cups-$user/classes.conf
-touch /tmp/cups-$user/printers.conf
-
 #
-# Setup lots of test queues - 500 with PPD files, 500 without...
+# Setup lots of test queues - half with PPD files, half without...
 #
 
 echo "Creating printers.conf for test..."
@@ -364,10 +439,11 @@ EOF
        i=`expr $i + 1`
 done
 
-cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig
-
-cp $root/conf/mime.types /tmp/cups-$user/mime.types
-cp $root/conf/mime.convs /tmp/cups-$user/mime.convs
+if test -f /tmp/cups-$user/printers.conf; then
+       cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig
+else
+       touch /tmp/cups-$user/printers.conf.orig
+fi
 
 #
 # Setup the paths...
@@ -384,6 +460,9 @@ fi
 export LD_LIBRARY_PATH
 
 LD_PRELOAD="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2:$root/cgi-bin/libcupscgi.so.1:$root/scheduler/libcupsmime.so.1:$root/driver/libcupsdriver.so.1:$root/ppdc/libcupsppdc.so.1"
+if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then
+       LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD"
+fi
 export LD_PRELOAD
 
 if test "x$DYLD_LIBRARY_PATH" = x; then
@@ -402,10 +481,12 @@ fi
 
 export SHLIB_PATH
 
-CUPS_SERVER=localhost; export CUPS_SERVER
+CUPS_DISABLE_APPLE_DEFAULT=yes; export CUPS_DISABLE_APPLE_DEFAULT
+CUPS_SERVER=localhost:8631; export CUPS_SERVER
 CUPS_SERVERROOT=/tmp/cups-$user; export CUPS_SERVERROOT
 CUPS_STATEDIR=/tmp/cups-$user; export CUPS_STATEDIR
 CUPS_DATADIR=/tmp/cups-$user/share; export CUPS_DATADIR
+LOCALEDIR=/tmp/cups-$user/share/locale; export LOCALEDIR
 
 #
 # Set a new home directory to avoid getting user options mixed in...
@@ -421,6 +502,9 @@ export HOME
 LANG=C
 export LANG
 
+LC_MESSAGES=C
+export LC_MESSAGES
+
 #
 # Start the server; run as foreground daemon in the background...
 #
@@ -429,14 +513,44 @@ echo "Starting scheduler:"
 echo "    $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &"
 echo ""
 
-$valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
+if test `uname` = Darwin -a "x$valgrind" = x; then
+       DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib
+       ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
+else
+       $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
+fi
+
 cupsd=$!
 
 if test "x$testtype" = x0; then
+       # Not running tests...
        echo "Scheduler is PID $cupsd and is listening on port 8631."
        echo ""
-       echo "Set the IPP_PORT environment variable to 8631 to test the software"
-       echo "interactively from the command-line."
+
+       # Create a helper script to run programs with...
+       runcups="/tmp/cups-$user/runcups"
+
+       echo "#!/bin/sh" >$runcups
+       echo "# Helper script for running CUPS test instance." >>$runcups
+       echo "" >>$runcups
+       echo "# Set required environment variables..." >>$runcups
+       echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups
+       echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups
+       echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups
+       echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups
+       echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups
+       echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups
+       echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups
+       echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups
+       echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups
+       echo "" >>$runcups
+       echo "# Run command..." >>$runcups
+       echo "exec \"\$@\"" >>$runcups
+
+       chmod +x $runcups
+
+       echo "The $runcups helper script can be used to test programs"
+       echo "with the server."
        exit 0
 fi
 
@@ -466,7 +580,8 @@ done
 # Create the test report source file...
 #
 
-strfile=/tmp/cups-$user/cups-str-1.4-`date +%Y-%m-%d`-$user.html
+date=`date "+%Y-%m-%d"`
+strfile=/tmp/cups-$user/cups-str-1.6-$date-$user.html
 
 rm -f $strfile
 cat str-header.html >$strfile
@@ -489,7 +604,7 @@ for file in 4*.test; do
        echo "Performing $file..."
        echo "" >>$strfile
 
-       ./ipptest ipp://localhost:$port/printers $file | tee -a $strfile
+       ./ipptool -t ipp://localhost:$port/printers $file | tee -a $strfile
        status=$?
 
        if test $status != 0; then
@@ -510,7 +625,7 @@ echo "Running command tests..."
 echo "<H1>2 - Command Tests</H1>" >>$strfile
 echo "<P>This section provides the results to the command tests" >>$strfile
 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
-echo `date "+%Y-%m-%d"` by $user on `hostname`. >>$strfile
+echo $date by $user on `hostname`. >>$strfile
 echo "<PRE>" >>$strfile
 
 for file in 5*.sh; do
@@ -518,7 +633,7 @@ for file in 5*.sh; do
        echo "" >>$strfile
        echo "\"$file\":" >>$strfile
 
-       sh $file $pjobs | tee -a $strfile
+       sh $file $pjobs $pprinters | tee -a $strfile
        status=$?
 
        if test $status != 0; then
@@ -549,10 +664,23 @@ echo "Test Summary"
 echo ""
 echo "<H2>Summary</H2>" >>$strfile
 
-# Pages printed on Test1
-count=`grep '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
-expected=`expr $pjobs \* 2 + 35`
-if test $count != $expected; then
+# Job control files
+count=`ls -1 /tmp/cups-$user/spool | wc -l`
+count=`expr $count - 1`
+if test $count != 0; then
+       echo "FAIL: $count job control files were not purged."
+       echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile
+       fail=`expr $fail + 1`
+else
+       echo "PASS: All job control files purged."
+       echo "<P>PASS: All job control files purged.</P>" >>$strfile
+fi
+
+# Pages printed on Test1 (within 1 page for timing-dependent cancel issues)
+count=`$GREP '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
+expected=`expr $pjobs \* 2 + 34`
+expected2=`expr $expected + 2`
+if test $count -lt $expected -a $count -gt $expected2; then
        echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected."
        echo "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile
        fail=`expr $fail + 1`
@@ -562,7 +690,7 @@ else
 fi
 
 # Paged printed on Test2
-count=`grep '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
+count=`$GREP '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
 expected=`expr $pjobs \* 2 + 3`
 if test $count != $expected; then
        echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected."
@@ -573,19 +701,39 @@ else
        echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile
 fi
 
-# Requested processed
+# Requests logged
 count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
-echo "PASS: $count requests processed."
-echo "<P>PASS: $count requests processed.</P>" >>$strfile
+expected=`expr 37 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
+if test $count != $expected; then
+       echo "FAIL: $count requests logged, expected $expected."
+       echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile
+       fail=`expr $fail + 1`
+else
+       echo "PASS: $count requests logged."
+       echo "<P>PASS: $count requests logged.</P>" >>$strfile
+fi
+
+# Did CUPS-Get-Default get logged?
+if $GREP -q CUPS-Get-Default /tmp/cups-$user/log/access_log; then
+       echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'"
+       echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile
+       echo "<PRE>" >>$strfile
+       $GREP CUPS-Get-Default /tmp/cups-$user/log/access_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
+       echo "</PRE>" >>$strfile
+       fail=`expr $fail + 1`
+else
+       echo "PASS: CUPS-Get-Default not logged."
+       echo "<P>PASS: CUPS-Get-Default not logged.</P>" >>$strfile
+fi
 
 # Emergency log messages
-count=`grep '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
+count=`$GREP '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 if test $count != 0; then
        echo "FAIL: $count emergency messages, expected 0."
-       grep '^X ' /tmp/cups-$user/log/error_log
+       $GREP '^X ' /tmp/cups-$user/log/error_log
        echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile
        echo "<PRE>" >>$strfile
-       grep '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
+       $GREP '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
        echo "</PRE>" >>$strfile
        fail=`expr $fail + 1`
 else
@@ -594,13 +742,13 @@ else
 fi
 
 # Alert log messages
-count=`grep '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
+count=`$GREP '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 if test $count != 0; then
        echo "FAIL: $count alert messages, expected 0."
-       grep '^A ' /tmp/cups-$user/log/error_log
+       $GREP '^A ' /tmp/cups-$user/log/error_log
        echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile
        echo "<PRE>" >>$strfile
-       grep '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
+       $GREP '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
        echo "</PRE>" >>$strfile
        fail=`expr $fail + 1`
 else
@@ -609,13 +757,13 @@ else
 fi
 
 # Critical log messages
-count=`grep '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
+count=`$GREP '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 if test $count != 0; then
        echo "FAIL: $count critical messages, expected 0."
-       grep '^C ' /tmp/cups-$user/log/error_log
+       $GREP '^C ' /tmp/cups-$user/log/error_log
        echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile
        echo "<PRE>" >>$strfile
-       grep '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
+       $GREP '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
        echo "</PRE>" >>$strfile
        fail=`expr $fail + 1`
 else
@@ -624,13 +772,13 @@ else
 fi
 
 # Error log messages
-count=`grep '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
-if test $count != 9; then
-       echo "FAIL: $count error messages, expected 9."
-       grep '^E ' /tmp/cups-$user/log/error_log
-       echo "<P>FAIL: $count error messages, expected 9.</P>" >>$strfile
+count=`$GREP '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
+if test $count != 18; then
+       echo "FAIL: $count error messages, expected 18."
+       $GREP '^E ' /tmp/cups-$user/log/error_log
+       echo "<P>FAIL: $count error messages, expected 18.</P>" >>$strfile
        echo "<PRE>" >>$strfile
-       grep '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
+       $GREP '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
        echo "</PRE>" >>$strfile
        fail=`expr $fail + 1`
 else
@@ -639,13 +787,13 @@ else
 fi
 
 # Warning log messages
-count=`grep '^W ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
-if test $count != 0; then
-       echo "FAIL: $count warning messages, expected 0."
-       grep '^W ' /tmp/cups-$user/log/error_log
-       echo "<P>FAIL: $count warning messages, expected 0.</P>" >>$strfile
+count=`$GREP '^W ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
+if test $count != 9; then
+       echo "FAIL: $count warning messages, expected 9."
+       $GREP '^W ' /tmp/cups-$user/log/error_log
+       echo "<P>FAIL: $count warning messages, expected 9.</P>" >>$strfile
        echo "<PRE>" >>$strfile
-       grep '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
+       $GREP '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
        echo "</PRE>" >>$strfile
        fail=`expr $fail + 1`
 else
@@ -654,13 +802,13 @@ else
 fi
 
 # Notice log messages
-count=`grep '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
+count=`$GREP '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 if test $count != 0; then
        echo "FAIL: $count notice messages, expected 0."
-       grep '^N ' /tmp/cups-$user/log/error_log
+       $GREP '^N ' /tmp/cups-$user/log/error_log
        echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile
        echo "<PRE>" >>$strfile
-       grep '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
+       $GREP '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
        echo "</PRE>" >>$strfile
        fail=`expr $fail + 1`
 else
@@ -669,7 +817,7 @@ else
 fi
 
 # Info log messages
-count=`grep '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
+count=`$GREP '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 if test $count = 0; then
        echo "FAIL: $count info messages, expected more than 0."
        echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile
@@ -680,7 +828,7 @@ else
 fi
 
 # Debug log messages
-count=`grep '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
+count=`$GREP '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 if test $count = 0; then
        echo "FAIL: $count debug messages, expected more than 0."
        echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile
@@ -691,10 +839,10 @@ else
 fi
 
 # Debug2 log messages
-count=`grep '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
-if test $count != 0; then
-       echo "FAIL: $count debug2 messages, expected 0."
-       echo "<P>FAIL: $count debug2 messages, expected 0.</P>" >>$strfile
+count=`$GREP '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
+if test $count = 0; then
+       echo "FAIL: $count debug2 messages, expected more than 0."
+       echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile
        fail=`expr $fail + 1`
 else
        echo "PASS: $count debug2 messages."
@@ -709,7 +857,7 @@ echo "</PRE>" >>$strfile
 
 echo "<H2>error_log</H2>" >>$strfile
 echo "<PRE>" >>$strfile
-sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' /tmp/cups-$user/log/error_log >>$strfile
+$GREP -v '^d' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
 echo "</PRE>" >>$strfile
 
 echo "<H2>page_log</H2>" >>$strfile
@@ -727,6 +875,8 @@ echo ""
 
 if test $fail != 0; then
        echo "$fail tests failed."
+       cp /tmp/cups-$user/log/error_log error_log-$date-$user
+       cp $strfile .
 else
        echo "All tests were successful."
 fi
@@ -736,9 +886,13 @@ echo "A HTML report was created in $strfile."
 echo ""
 
 if test $fail != 0; then
+       echo "Copies of the error_log and `basename $strfile` files are in"
+       echo "`pwd`."
+       echo ""
+
        exit 1
 fi
 
 #
-# End of "$Id: run-stp-tests.sh 6649 2007-07-11 21:46:42Z mike $"
+# End of "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $"
 #