X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=test%2Frun-stp-tests.sh;h=aac9909e4cbc1e08c8aa0f4ebc71bdcb0486bbc8;hb=237b42e933b9feae703c8fa433380e019b36285b;hp=b789b074d767bf46abb67af971e6016907685262;hpb=ba55dc12de9ef3103d220a332ad7d26c54e397fa;p=thirdparty%2Fcups.git diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh index b789b074d..aac9909e4 100755 --- a/test/run-stp-tests.sh +++ b/test/run-stp-tests.sh @@ -1,33 +1,58 @@ #!/bin/sh # -# "$Id: run-stp-tests.sh 7954 2008-09-17 05:23:09Z mike $" +# "$Id$" # -# Perform the complete set of IPP compliance tests specified in the -# CUPS Software Test Plan. +# Perform the complete set of IPP compliance tests specified in the +# CUPS Software Test Plan. # -# Copyright 2007-2009 by Apple Inc. -# Copyright 1997-2007 by Easy Software Products, all rights reserved. +# Copyright 2007-2014 by Apple Inc. +# Copyright 1997-2007 by Easy Software Products, all rights reserved. # -# These coded instructions, statements, and computer programs are the -# property of Apple Inc. and are protected by Federal copyright -# law. Distribution and use rights are outlined in the file "LICENSE.txt" -# which should have been included with this file. If this file is -# file is missing or damaged, see the license at "http://www.cups.org/". +# These coded instructions, statements, and computer programs are the +# property of Apple Inc. and are protected by Federal copyright +# law. Distribution and use rights are outlined in the file "LICENSE.txt" +# which should have been included with this file. If this file is +# file is missing or damaged, see the license at "http://www.cups.org/". # argcount=$# +# +# Don't allow "make check" or "make test" to be run by root... +# + +if test "x`id -u`" = x0; then + echo Please run this as a normal user. Not supported when run as root. + exit 1 +fi + +# +# Force the permissions of the files we create... +# + +umask 022 + # # Make the IPP test program... # 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 @@ -75,6 +100,7 @@ case "$testtype" in nprinters2=0 pjobs=0 pprinters=0 + loglevel="debug2" ;; 2) echo "Running the medium tests (2)" @@ -82,6 +108,7 @@ case "$testtype" in nprinters2=20 pjobs=20 pprinters=10 + loglevel="debug" ;; 3) echo "Running the extreme tests (3)" @@ -89,6 +116,7 @@ case "$testtype" in nprinters2=1000 pjobs=100 pprinters=50 + loglevel="debug" ;; 4) echo "Running the torture tests (4)" @@ -96,6 +124,7 @@ case "$testtype" in nprinters2=20000 pjobs=200 pprinters=100 + loglevel="debug" ;; *) echo "Running the timid tests (1)" @@ -103,6 +132,7 @@ case "$testtype" in nprinters2=0 pjobs=10 pprinters=0 + loglevel="debug2" ;; esac @@ -162,6 +192,14 @@ fi port=8631 cwd=`pwd` root=`dirname $cwd` +CUPS_TESTROOT="$root"; export CUPS_TESTROOT + +if test -d /private/tmp; then + BASE=/private/tmp/cups-$user +else + BASE=/tmp/cups-$user +fi +export BASE # # Make sure that the LPDEST and PRINTER environment variables are @@ -193,12 +231,54 @@ echo "" case "$usevalgrind" in Y* | y*) - 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..." + VALGRIND="valgrind --tool=memcheck --log-file=$BASE/log/valgrind.%p --error-limit=no --leak-check=yes --trace-children=yes" + if test `uname` = Darwin; then + VALGRIND="$VALGRIND --dsymutil=yes" + fi + export VALGRIND + echo "Using Valgrind; log files can be found in $BASE/log..." + ;; + + *) + VALGRIND="" + export VALGRIND + ;; +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 (level 5); log files can be found in $BASE/log..." + CUPS_DEBUG_LOG="$BASE/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|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER + ;; + + 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9) + echo "Enabling debug printfs (level $usedebugprintfs); log files can be found in $BASE/log..." + CUPS_DEBUG_LOG="$BASE/log/debug_printfs.%d"; export CUPS_DEBUG_LOG + CUPS_DEBUG_LEVEL="$usedebugprintfs"; export CUPS_DEBUG_LEVEL + CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER ;; *) - valgrind="" ;; esac @@ -208,98 +288,180 @@ esac echo "Creating directories for test..." -rm -rf /tmp/cups-$user -mkdir /tmp/cups-$user -mkdir /tmp/cups-$user/bin -mkdir /tmp/cups-$user/bin/backend -mkdir /tmp/cups-$user/bin/driver -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 +rm -rf $BASE +mkdir $BASE +mkdir $BASE/bin +mkdir $BASE/bin/backend +mkdir $BASE/bin/driver +mkdir $BASE/bin/filter +mkdir $BASE/certs +mkdir $BASE/share +mkdir $BASE/share/banners +mkdir $BASE/share/drv +mkdir $BASE/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 + mkdir $BASE/share/locale/$loc + ln -s $root/locale/cups_$loc.po $BASE/share/locale/$loc + ln -s $root/locale/ppdc_$loc.po $BASE/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 -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/mdns /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/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/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/bannertops /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/hpgltops /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/data/classified /tmp/cups-$user/share/banners -ln -s $root/data/confidential /tmp/cups-$user/share/banners -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/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 - -# -# Mac OS X filters and configuration files... +mkdir $BASE/share/mime +mkdir $BASE/share/model +mkdir $BASE/share/ppdc +mkdir $BASE/interfaces +mkdir $BASE/log +mkdir $BASE/ppd +mkdir $BASE/spool +mkdir $BASE/spool/temp +mkdir $BASE/ssl + +ln -s $root/backend/dnssd $BASE/bin/backend +ln -s $root/backend/http $BASE/bin/backend +ln -s $root/backend/ipp $BASE/bin/backend +ln -s $root/backend/lpd $BASE/bin/backend +ln -s $root/backend/mdns $BASE/bin/backend +ln -s $root/backend/pseudo $BASE/bin/backend +ln -s $root/backend/snmp $BASE/bin/backend +ln -s $root/backend/socket $BASE/bin/backend +ln -s $root/backend/usb $BASE/bin/backend +ln -s $root/cgi-bin $BASE/bin +ln -s $root/monitor $BASE/bin +ln -s $root/notifier $BASE/bin +ln -s $root/scheduler $BASE/bin/daemon +ln -s $root/filter/commandtops $BASE/bin/filter +ln -s $root/filter/gziptoany $BASE/bin/filter +ln -s $root/filter/pstops $BASE/bin/filter +ln -s $root/filter/rastertoepson $BASE/bin/filter +ln -s $root/filter/rastertohp $BASE/bin/filter +ln -s $root/filter/rastertolabel $BASE/bin/filter +ln -s $root/filter/rastertopwg $BASE/bin/filter +cat >$BASE/share/banners/standard <$BASE/share/banners/classified <"$BASE/bin/filter/$dst" <"$BASE/bin/filter/$dst" <"$BASE/bin/filter/$dst" </tmp/cups-$user/cupsd.conf <$BASE/cupsd.conf < -Order Deny,Allow -Deny from all -Allow from 127.0.0.1 +Order Allow,Deny $encryption EOF +if test $testtype = 0; then + echo WebInterface yes >>$BASE/cupsd.conf +fi + +cat >$BASE/cups-files.conf <> $BASE/cups-files.conf +fi + # # Setup lots of test queues - half with PPD files, half without... # @@ -357,7 +532,7 @@ echo "Creating printers.conf for test..." i=1 while test $i -le $nprinters1; do - cat >>/tmp/cups-$user/printers.conf <>$BASE/printers.conf < Accepting Yes DeviceURI file:/dev/null @@ -369,13 +544,13 @@ StateMessage Printer $1 is idle. EOF - cp testps.ppd /tmp/cups-$user/ppd/test-$i.ppd + cp testps.ppd $BASE/ppd/test-$i.ppd i=`expr $i + 1` done while test $i -le $nprinters2; do - cat >>/tmp/cups-$user/printers.conf <>$BASE/printers.conf < Accepting Yes DeviceURI file:/dev/null @@ -390,10 +565,10 @@ EOF i=`expr $i + 1` done -if test -f /tmp/cups-$user/printers.conf; then - cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig +if test -f $BASE/printers.conf; then + cp $BASE/printers.conf $BASE/printers.conf.orig else - touch /tmp/cups-$user/printers.conf.orig + touch $BASE/printers.conf.orig fi # @@ -403,47 +578,47 @@ fi echo "Setting up environment variables for test..." if test "x$LD_LIBRARY_PATH" = x; then - LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc" + LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" else - LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$LD_LIBRARY_PATH" + LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$LD_LIBRARY_PATH" 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" +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" 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 - DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc" + DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" else - DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$DYLD_LIBRARY_PATH" + DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$DYLD_LIBRARY_PATH" fi export DYLD_LIBRARY_PATH if test "x$SHLIB_PATH" = x; then - SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc" + SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc" else - SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$SHLIB_PATH" + SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$SHLIB_PATH" fi export SHLIB_PATH 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 +CUPS_SERVERROOT=$BASE; export CUPS_SERVERROOT +CUPS_STATEDIR=$BASE; export CUPS_STATEDIR +CUPS_DATADIR=$BASE/share; export CUPS_DATADIR +LOCALEDIR=$BASE/share/locale; export LOCALEDIR # # Set a new home directory to avoid getting user options mixed in... # -HOME=/tmp/cups-$user +HOME=$BASE export HOME # @@ -453,19 +628,21 @@ export HOME LANG=C export LANG +LC_MESSAGES=C +export LC_MESSAGES + # # Start the server; run as foreground daemon in the background... # 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 $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &" echo "" -if test `uname` = Darwin -a "x$valgrind" = x; then - DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib \ - $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 MallocStackLogging=1 ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 & else - $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 & + $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 & fi cupsd=$! @@ -476,7 +653,7 @@ if test "x$testtype" = x0; then echo "" # Create a helper script to run programs with... - runcups="/tmp/cups-$user/runcups" + runcups="$BASE/runcups" echo "#!/bin/sh" >$runcups echo "# Helper script for running CUPS test instance." >>$runcups @@ -491,6 +668,11 @@ if test "x$testtype" = x0; then echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups + if test "x$CUPS_DEBUG_LEVEL" != x; then + echo "CUPS_DEBUG_FILTER='$CUPS_DEBUG_FILTER'; export CUPS_DEBUG_FILTER" >>$runcups + echo "CUPS_DEBUG_LEVEL=$CUPS_DEBUG_LEVEL; export CUPS_DEBUG_LEVEL" >>$runcups + echo "CUPS_DEBUG_LOG='$CUPS_DEBUG_LOG'; export CUPS_DEBUG_LOG" >>$runcups + fi echo "" >>$runcups echo "# Run command..." >>$runcups echo "exec \"\$@\"" >>$runcups @@ -529,7 +711,7 @@ done # date=`date "+%Y-%m-%d"` -strfile=/tmp/cups-$user/cups-str-1.4-$date-$user.html +strfile=$BASE/cups-str-2.1-$date-$user.html rm -f $strfile cat str-header.html >$strfile @@ -548,16 +730,25 @@ echo `date "+%Y-%m-%d"` by $user on `hostname`. >>$strfile echo "
" >>$strfile
 
 fail=0
-for file in 4*.test; do
-	echo "Performing $file..."
+for file in 4*.test ipp-2.1.test; do
+	echo $ac_n "Performing $file: $ac_c"
 	echo "" >>$strfile
 
-	./ipptest ipp://localhost:$port/printers $file | tee -a $strfile
+	if test $file = ipp-2.1.test; then
+		uri="ipp://localhost:$port/printers/Test1"
+		options="-V 2.1 -d NOPRINT=1 -f testfile.ps"
+	else
+		uri="ipp://localhost:$port/printers"
+		options=""
+	fi
+	$VALGRIND ./ipptool -tI $options $uri $file >> $strfile
 	status=$?
 
 	if test $status != 0; then
-		echo Test failed.
+		echo FAIL
 		fail=`expr $fail + 1`
+	else
+		echo PASS
 	fi
 done
 
@@ -577,19 +768,57 @@ echo $date by $user on `hostname`. >>$strfile
 echo "
" >>$strfile
 
 for file in 5*.sh; do
-	echo "Performing $file..."
+	echo $ac_n "Performing $file: $ac_c"
 	echo "" >>$strfile
 	echo "\"$file\":" >>$strfile
 
-	sh $file $pjobs $pprinters | tee -a $strfile
+	sh $file $pjobs $pprinters >> $strfile
 	status=$?
 
 	if test $status != 0; then
-		echo Test failed.
+		echo FAIL
 		fail=`expr $fail + 1`
+	else
+		echo PASS
+	fi
+done
+
+#
+# Log all allocations made by the scheduler...
+#
+if test `uname` = Darwin -a "x$VALGRIND" = x; then
+	malloc_history $cupsd -callTree -showContent >$BASE/log/malloc_log 2>&1
+fi
+
+#
+# Restart the server...
+#
+
+echo $ac_n "Performing restart test: $ac_c"
+echo "" >>$strfile
+echo "\"5.10-restart\":" >>$strfile
+
+kill -HUP $cupsd
+
+while true; do
+	sleep 10
+
+	running=`../systemv/lpstat -r 2>/dev/null`
+	if test "x$running" = "xscheduler is running"; then
+		break
 	fi
 done
 
+description="`lpstat -l -p Test1 | grep Description | sed -e '1,$s/^[^:]*: //g'`"
+if test "x$description" != "xTest Printer 1"; then
+	echo "Failed, printer-info for Test1 is '$description', expected 'Test Printer 1'." >>$strfile
+	echo "FAIL (got '$description', expected 'Test Printer 1')"
+	fail=`expr $fail + 1`
+else
+	echo "Passed." >>$strfile
+	echo PASS
+fi
+
 echo "
" >>$strfile # @@ -613,7 +842,7 @@ echo "" echo "

Summary

" >>$strfile # Job control files -count=`ls -1 /tmp/cups-$user/spool | wc -l` +count=`ls -1 $BASE/spool | wc -l` count=`expr $count - 1` if test $count != 0; then echo "FAIL: $count job control files were not purged." @@ -625,7 +854,7 @@ else 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}'` +count=`$GREP '^Test1 ' $BASE/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 @@ -638,7 +867,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 ' $BASE/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." @@ -649,9 +878,21 @@ else echo "

PASS: Printer 'Test2' correctly produced $count page(s).

" >>$strfile fi +# Paged printed on Test3 +count=`$GREP '^Test3 ' $BASE/log/page_log | grep -v total | awk 'BEGIN{count=0}{count=count+$7}END{print count}'` +expected=2 +if test $count != $expected; then + echo "FAIL: Printer 'Test3' produced $count page(s), expected $expected." + echo "

FAIL: Printer 'Test3' produced $count page(s), expected $expected.

" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: Printer 'Test3' correctly produced $count page(s)." + echo "

PASS: Printer 'Test3' correctly produced $count page(s).

" >>$strfile +fi + # Requests logged -count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'` -expected=`expr 39 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4` +count=`wc -l $BASE/log/access_log | awk '{print $1}'` +expected=`expr 37 + 18 + 29 + $pjobs \* 8 + $pprinters \* $pjobs \* 4` if test $count != $expected; then echo "FAIL: $count requests logged, expected $expected." echo "

FAIL: $count requests logged, expected $expected.

" >>$strfile @@ -662,11 +903,11 @@ else fi # Did CUPS-Get-Default get logged? -if grep -q CUPS-Get-Default /tmp/cups-$user/log/access_log; then +if $GREP -q CUPS-Get-Default $BASE/log/access_log; then echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'" echo "

FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'

" >>$strfile echo "
" >>$strfile
-	grep CUPS-Get-Default /tmp/cups-$user/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	$GREP CUPS-Get-Default $BASE/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 	echo "
" >>$strfile fail=`expr $fail + 1` else @@ -675,13 +916,13 @@ else fi # Emergency log messages -count=`grep '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +count=`$GREP '^X ' $BASE/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 ' $BASE/log/error_log echo "

FAIL: $count emergency messages, expected 0.

" >>$strfile echo "
" >>$strfile
-	grep '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	$GREP '^X ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 	echo "
" >>$strfile fail=`expr $fail + 1` else @@ -690,13 +931,13 @@ else fi # Alert log messages -count=`grep '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +count=`$GREP '^A ' $BASE/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 ' $BASE/log/error_log echo "

FAIL: $count alert messages, expected 0.

" >>$strfile echo "
" >>$strfile
-	grep '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	$GREP '^A ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 	echo "
" >>$strfile fail=`expr $fail + 1` else @@ -705,13 +946,13 @@ else fi # Critical log messages -count=`grep '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +count=`$GREP '^C ' $BASE/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 ' $BASE/log/error_log echo "

FAIL: $count critical messages, expected 0.

" >>$strfile echo "
" >>$strfile
-	grep '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	$GREP '^C ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 	echo "
" >>$strfile fail=`expr $fail + 1` else @@ -720,13 +961,13 @@ else fi # Error log messages -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 "

FAIL: $count error messages, expected 18.

" >>$strfile +count=`$GREP '^E ' $BASE/log/error_log | wc -l | awk '{print $1}'` +if test $count != 33; then + echo "FAIL: $count error messages, expected 33." + $GREP '^E ' $BASE/log/error_log + echo "

FAIL: $count error messages, expected 33.

" >>$strfile echo "
" >>$strfile
-	grep '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	$GREP '^E ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 	echo "
" >>$strfile fail=`expr $fail + 1` else @@ -735,13 +976,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 "

FAIL: $count warning messages, expected 0.

" >>$strfile +count=`$GREP '^W ' $BASE/log/error_log | $GREP -v CreateProfile | wc -l | awk '{print $1}'` +if test $count != 18; then + echo "FAIL: $count warning messages, expected 18." + $GREP '^W ' $BASE/log/error_log + echo "

FAIL: $count warning messages, expected 18.

" >>$strfile echo "
" >>$strfile
-	grep '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	$GREP '^W ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 	echo "
" >>$strfile fail=`expr $fail + 1` else @@ -750,13 +991,13 @@ else fi # Notice log messages -count=`grep '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +count=`$GREP '^N ' $BASE/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 ' $BASE/log/error_log echo "

FAIL: $count notice messages, expected 0.

" >>$strfile echo "
" >>$strfile
-	grep '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	$GREP '^N ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 	echo "
" >>$strfile fail=`expr $fail + 1` else @@ -765,7 +1006,7 @@ else fi # Info log messages -count=`grep '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +count=`$GREP '^I ' $BASE/log/error_log | wc -l | awk '{print $1}'` if test $count = 0; then echo "FAIL: $count info messages, expected more than 0." echo "

FAIL: $count info messages, expected more than 0.

" >>$strfile @@ -776,7 +1017,7 @@ else fi # Debug log messages -count=`grep '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +count=`$GREP '^D ' $BASE/log/error_log | wc -l | awk '{print $1}'` if test $count = 0; then echo "FAIL: $count debug messages, expected more than 0." echo "

FAIL: $count debug messages, expected more than 0.

" >>$strfile @@ -787,7 +1028,7 @@ else fi # Debug2 log messages -count=`grep '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` +count=`$GREP '^d ' $BASE/log/error_log | wc -l | awk '{print $1}'` if test $count = 0; then echo "FAIL: $count debug2 messages, expected more than 0." echo "

FAIL: $count debug2 messages, expected more than 0.

" >>$strfile @@ -797,30 +1038,20 @@ else echo "

PASS: $count debug2 messages.

" >>$strfile fi -# Page log file... -if grep -iq 'testfile.pdf na_letter_8.5x11in' /tmp/cups-$user/log/page_log; then - echo "PASS: page_log formatted correctly." - echo "

PASS: page_log formatted correctly.

" >>$strfile -else - echo "FAIL: page_log formatted incorrectly." - echo "

FAIL: page_log formatted incorrectly.

" >>$strfile - fail=`expr $fail + 1` -fi - # Log files... echo "

access_log

" >>$strfile echo "
" >>$strfile
-sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 echo "
" >>$strfile echo "

error_log

" >>$strfile echo "
" >>$strfile
-grep -v '^[dD]' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+$GREP -v '^d' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 echo "
" >>$strfile echo "

page_log

" >>$strfile echo "
" >>$strfile
-sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
 echo "
" >>$strfile # @@ -833,13 +1064,13 @@ echo "" if test $fail != 0; then echo "$fail tests failed." - cp /tmp/cups-$user/log/error_log error_log-$date-$user + cp $BASE/log/error_log error_log-$date-$user cp $strfile . else echo "All tests were successful." fi -echo "Log files can be found in /tmp/cups-$user/log." +echo "Log files can be found in $BASE/log." echo "A HTML report was created in $strfile." echo "" @@ -852,5 +1083,5 @@ if test $fail != 0; then fi # -# End of "$Id: run-stp-tests.sh 7954 2008-09-17 05:23:09Z mike $" +# End of "$Id$" #