X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=test%2Frun-stp-tests.sh;h=9cf7bd08a74165f0656e8f4527b8258c94cfb7e9;hb=ba9d68cc7467a7a47ef219071902b9e9eb6dbc44;hp=ce876297f7fa4617de1c35e7df841f12fafe6c77;hpb=52f6f666c3ffd368f98d5be963e2e7a92f3dc82b;p=thirdparty%2Fcups.git diff --git a/test/run-stp-tests.sh b/test/run-stp-tests.sh index ce876297f..9cf7bd08a 100755 --- a/test/run-stp-tests.sh +++ b/test/run-stp-tests.sh @@ -1,33 +1,56 @@ #!/bin/sh # -# "$Id: run-stp-tests.sh 7954 2008-09-17 05:23:09Z mike $" +# 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-2019 by Apple Inc. +# Copyright © 1997-2007 by Easy Software Products, all rights reserved. # -# Copyright 2007-2008 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 @@ -71,33 +94,39 @@ echo "" case "$testtype" in 0) echo "Running in test mode (0)" - nprinters1=0 - nprinters2=0 + nprinters=0 pjobs=0 + pprinters=0 + loglevel="debug2" ;; 2) echo "Running the medium tests (2)" - nprinters1=10 - nprinters2=20 + nprinters=20 pjobs=20 + pprinters=10 + loglevel="debug" ;; 3) echo "Running the extreme tests (3)" - nprinters1=500 - nprinters2=1000 + nprinters=1000 pjobs=100 + pprinters=50 + loglevel="debug" ;; 4) echo "Running the torture tests (4)" - nprinters1=10000 - nprinters2=20000 + nprinters=20000 pjobs=200 + pprinters=100 + loglevel="debug" ;; *) echo "Running the timid tests (1)" - nprinters1=0 - nprinters2=0 + nprinters=0 pjobs=10 + pprinters=0 + loglevel="debug2" + testtype="1" ;; esac @@ -107,8 +136,7 @@ esac echo "" echo "Now you can choose whether to create a SSL/TLS encryption key and" -echo "certificate for testing; these tests currently require the OpenSSL" -echo "tools:" +echo "certificate for testing:" echo "" echo "0 - Do not do SSL/TLS encryption tests" echo "1 - Test but do not require encryption" @@ -154,9 +182,20 @@ if test -z "$user"; then fi fi -port=8631 +port="${CUPS_TESTPORT:=8631}" cwd=`pwd` root=`dirname $cwd` +CUPS_TESTROOT="$root"; export CUPS_TESTROOT + +BASE="${CUPS_TESTBASE:=}" +if test -z "$BASE"; then + if test -d /private/tmp; then + BASE=/private/tmp/cups-$user + else + BASE=/tmp/cups-$user + fi +fi +export BASE # # Make sure that the LPDEST and PRINTER environment variables are @@ -188,12 +227,54 @@ 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" - 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|mime).*$'; export CUPS_DEBUG_FILTER ;; *) - valgrind="" ;; esac @@ -203,99 +284,190 @@ 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 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/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 - -if test $ssltype != 0; then - mkdir $root/ssl - cp server.* $root/ssl -fi - -# -# Mac OS X filters and configuration files... +mkdir $BASE/share/locale/en +ln -s $root/locale/cups.pot $BASE/share/locale/en/cups_en.po +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 ipp $BASE/bin/backend/ipps +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" </dev/null +case "\$5" in + *media=a4* | *media=iso_a4* | *PageSize=A4*) + gziptoany "$1" "$2" "$3" "$4" "$5" "$root/test/onepage-a4.pdf" + ;; + *) + gziptoany "$1" "$2" "$3" "$4" "$5" "$root/test/onepage-letter.pdf" + ;; +esac +EOF + chmod +x "$BASE/bin/filter/$dst" + ;; + ps) + cat >"$BASE/bin/filter/$dst" </dev/null +case "\$5" in + *media=a4* | *media=iso_a4* | *PageSize=A4*) + gziptoany "$1" "$2" "$3" "$4" "$5" "$root/test/onepage-a4.ps" + ;; + *) + gziptoany "$1" "$2" "$3" "$4" "$5" "$root/test/onepage-letter.ps" + ;; +esac +EOF + chmod +x "$BASE/bin/filter/$dst" + ;; + raster) + cat >"$BASE/bin/filter/$dst" </dev/null +case "\$5" in + *media=a4* | *media=iso_a4* | *PageSize=A4*) + gziptoany "$1" "$2" "$3" "$4" "$5" "$root/test/onepage-a4-300-black-1.pwg.gz" + ;; + *) + gziptoany "$1" "$2" "$3" "$4" "$5" "$root/test/onepage-letter-300-black-1.pwg.gz" + ;; +esac +EOF + chmod +x "$BASE/bin/filter/$dst" + ;; + esac +} + +ln -s $root/test/test.convs $BASE/share/mime +ln -s $root/test/test.types $BASE/share/mime + if test `uname` = Darwin; then - ln -s /usr/libexec/cups/filter/cgpdfto* /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 - - 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 + instfilter cgimagetopdf imagetopdf pdf + instfilter cgpdftopdf pdftopdf passthru + instfilter cgpdftops pdftops ps + instfilter cgpdftoraster pdftoraster raster + instfilter cgpdftoraster pdftourf raster + instfilter cgtexttopdf texttopdf pdf + instfilter pstocupsraster pstoraster raster 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 + instfilter imagetopdf imagetopdf pdf + instfilter pdftopdf pdftopdf passthru + instfilter pdftops pdftops ps + instfilter pdftoraster pdftoraster raster + instfilter pdftoraster pdftourf raster + instfilter pstoraster pstoraster raster + instfilter texttopdf texttopdf pdf + + if test -d /usr/share/cups/charsets; then + ln -s /usr/share/cups/charsets $BASE/share + fi fi # @@ -310,48 +482,76 @@ else encryption="" fi -cat >/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... +# Setup lots of test queues with PPD files... # 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 @@ -363,73 +563,91 @@ StateMessage Printer $1 is idle. EOF - cp testps.ppd /tmp/cups-$user/ppd/test-$i.ppd - - i=`expr $i + 1` -done - -while test $i -le $nprinters2; do - cat >>/tmp/cups-$user/printers.conf < -Accepting Yes -DeviceURI file:/dev/null -Info Test raw printer $i -JobSheets none none -Location CUPS test suite -State Idle -StateMessage Printer $1 is idle. - -EOF + cp testps.ppd $BASE/ppd/test-$i.ppd i=`expr $i + 1` done -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 $BASE/printers.conf.orig +fi # -# Setup the paths... +# Create a helper script to run programs with... # 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" 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:$LD_LIBRARY_PATH" fi -export LD_LIBRARY_PATH +LD_PRELOAD="$root/cups/libcups.so.2:$root/filter/libcupsimage.so.2" +if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then + LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD" +fi -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" -export LD_PRELOAD +if test -f $root/cups/libcups.2.dylib; then + if test "x$DYLD_INSERT_LIBRARIES" = x; then + DYLD_INSERT_LIBRARIES="$root/cups/libcups.2.dylib:$root/filter/libcupsimage.2.dylib" + else + DYLD_INSERT_LIBRARIES="$root/cups/libcups.2.dylib:$root/filter/libcupsimage.2.dylib:$DYLD_INSERT_LIBRARIES" + fi +fi 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" 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:$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" -else - SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$SHLIB_PATH" +# These get exported because they don't have side-effects... +CUPS_DISABLE_APPLE_DEFAULT=yes; export CUPS_DISABLE_APPLE_DEFAULT +CUPS_SERVER=localhost:$port; export CUPS_SERVER +CUPS_SERVERROOT=$BASE; export CUPS_SERVERROOT +CUPS_STATEDIR=$BASE; export CUPS_STATEDIR +CUPS_DATADIR=$BASE/share; export CUPS_DATADIR +IPP_PORT=$port; export IPP_PORT +LOCALEDIR=$BASE/share/locale; export LOCALEDIR + +echo "Creating wrapper script..." + +runcups="$BASE/runcups"; export 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_INSERT_LIBRARIES=\"$DYLD_INSERT_LIBRARIES\"; export DYLD_INSERT_LIBRARIES" >>$runcups +echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups +# IPP_PORT=$port; export IPP_PORT +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 +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 -export SHLIB_PATH - -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 +chmod +x $runcups # # Set a new home directory to avoid getting user options mixed in... # -HOME=/tmp/cups-$user +HOME=$BASE export HOME # @@ -439,44 +657,36 @@ 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 " $runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/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 + if test "x$DYLD_INSERT_LIBRARIES" = x; then + insert="/usr/lib/libgmalloc.dylib" + else + insert="/usr/lib/libgmalloc.dylib:$DYLD_INSERT_LIBRARIES" + fi + + DYLD_INSERT_LIBRARIES="$insert" MallocStackLogging=1 $runcups ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 & +else + $runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/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 "Scheduler is PID $cupsd and is listening on port $port." echo "" - # 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 @@ -492,10 +702,8 @@ else sleep 2 fi -IPP_PORT=$port; export IPP_PORT - while true; do - running=`../systemv/lpstat -r 2>/dev/null` + running=`$runcups ../systemv/lpstat -r 2>/dev/null` if test "x$running" = "xscheduler is running"; then break fi @@ -509,7 +717,8 @@ done # date=`date "+%Y-%m-%d"` -strfile=/tmp/cups-$user/cups-str-1.4-$date-$user.html + +strfile=$BASE/cups-str-$date-$user.html rm -f $strfile cat str-header.html >$strfile @@ -521,27 +730,37 @@ cat str-header.html >$strfile echo "" echo "Running IPP compliance tests..." -echo "

1 - IPP Compliance Tests

" >>$strfile -echo "

This section provides the results to the IPP compliance 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 "

" >>$strfile
+echo "    

1 - IPP Compliance Tests

" >>$strfile +echo "

This section provides the results to the IPP compliance tests" >>$strfile +echo " outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile +echo " $date 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
+        echo $ac_n "`date '+[%d/%b/%Y:%H:%M:%S %z]'` $ac_c" >>$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
+	$runcups $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
 
-echo "
" >>$strfile +echo "
" >>$strfile # # Run the command tests... @@ -550,39 +769,132 @@ echo "" >>$strfile echo "" echo "Running command tests..." -echo "

2 - Command Tests

" >>$strfile -echo "

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 by $user on `hostname`. >>$strfile -echo "

" >>$strfile
+echo "    

2 - Command Tests

" >>$strfile +echo "

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 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
+        echo "`date '+[%d/%b/%Y:%H:%M:%S %z]'` \"$file\":" >>$strfile
 
-	sh $file $pjobs | 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
 
-echo "
" >>$strfile +# +# 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 # -# Stop the server... +# Restart the server... # -kill $cupsd +echo $ac_n "Performing restart test: $ac_c" +echo "" >>$strfile +echo "`date '+[%d/%b/%Y:%H:%M:%S %z]'` \"5.10-restart\":" >>$strfile + +kill -HUP $cupsd + +while true; do + sleep 10 + + running=`$runcups ../systemv/lpstat -r 2>/dev/null` + if test "x$running" = "xscheduler is running"; then + break + fi +done + +description="`$runcups ../systemv/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 + + +# +# Perform job history test... +# + +echo $ac_n "Starting history test: $ac_c" +echo "" >>$strfile +echo "`date '+[%d/%b/%Y:%H:%M:%S %z]'` \"5.11-history\":" >>$strfile + +echo " lp -d Test1 testfile.jpg" >>$strfile + +$runcups ../systemv/lp -d Test1 testfile.jpg 2>&1 >>$strfile +if test $? != 0; then + echo "FAIL (unable to queue test job)" + echo " FAILED" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS" + echo " PASSED" >>$strfile + + ./waitjobs.sh >>$strfile + + echo $ac_n "Verifying that history still exists: $ac_c" + + echo " ls -l $BASE/spool" >>$strfile + count=`ls -1 $BASE/spool | wc -l` + if test $count = 1; then + echo "FAIL" + echo " FAILED (job control files not present)" >>$strfile + ls -l $BASE/spool >>$strfile + fail=`expr $fail + 1` + else + echo "PASS" + echo " PASSED" >>$strfile + + echo $ac_n "Waiting for job history to expire: $ac_c" + echo "" >>$strfile + echo " sleep 35" >>$strfile + sleep 35 + + echo " lpstat" >>$strfile + $runcups ../systemv/lpstat 2>&1 >>$strfile + + echo " ls -l $BASE/spool" >>$strfile + count=`ls -1 $BASE/spool | wc -l` + if test $count != 1; then + echo "FAIL" + echo " FAILED (job control files still present)" >>$strfile + ls -l $BASE/spool >>$strfile + fail=`expr $fail + 1` + else + echo "PASS" + echo " PASSED" >>$strfile + fi + fi +fi + # -# Append the log files for post-mortim... +# Stop the server... # -echo "

3 - Log Files

" >>$strfile +echo "
" >>$strfile + +kill $cupsd +wait $cupsd +cupsdstatus=$? # # Verify counts... @@ -590,186 +902,239 @@ echo "

3 - Log Files

" >>$strfile echo "Test Summary" echo "" -echo "

Summary

" >>$strfile +echo "

3 - Test Summary

" >>$strfile + +if test $cupsdstatus != 0; then + echo "FAIL: cupsd failed with exit status $cupsdstatus." + echo "

FAIL: cupsd failed with exit status $cupsdstatus.

" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: cupsd exited with no errors." + echo "

PASS: cupsd exited with no errors.

" >>$strfile +fi + +# Job control files +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." + echo "

FAIL: $count job control files were not purged.

" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: All job control files purged." + echo "

PASS: All job control files purged.

" >>$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}'` +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 echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected." - echo "

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

" >>$strfile + echo "

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

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

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

" >>$strfile + echo "

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

" >>$strfile 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." - echo "

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

" >>$strfile + echo "

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

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

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

" >>$strfile + echo "

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

" >>$strfile +fi + +# Paged printed on Test3 +count=`$GREP '^Test3 ' $BASE/log/page_log | 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 $BASE/log/access_log | awk '{print $1}'` +expected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2` +if test $count != $expected; then + echo "FAIL: $count requests logged, expected $expected." + echo "

FAIL: $count requests logged, expected $expected.

" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: $count requests logged." + echo "

PASS: $count requests logged.

" >>$strfile fi -# Requested processed -count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'` -echo "PASS: $count requests processed." -echo "

PASS: $count requests processed.

" >>$strfile +# Did CUPS-Get-Default get logged? +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 $BASE/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	echo "    
" >>$strfile + fail=`expr $fail + 1` +else + echo "PASS: CUPS-Get-Default not logged." + echo "

PASS: CUPS-Get-Default not logged.

" >>$strfile +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 - 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
-	echo "
" >>$strfile + $GREP '^X ' $BASE/log/error_log + echo "

FAIL: $count emergency messages, expected 0.

" >>$strfile + echo "
" >>$strfile
+	$GREP '^X ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	echo "    
" >>$strfile fail=`expr $fail + 1` else echo "PASS: $count emergency messages." - echo "

PASS: $count emergency messages.

" >>$strfile + echo "

PASS: $count emergency messages.

" >>$strfile 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 - 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
-	echo "
" >>$strfile + $GREP '^A ' $BASE/log/error_log + echo "

FAIL: $count alert messages, expected 0.

" >>$strfile + echo "
" >>$strfile
+	$GREP '^A ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	echo "    
" >>$strfile fail=`expr $fail + 1` else echo "PASS: $count alert messages." - echo "

PASS: $count alert messages.

" >>$strfile + echo "

PASS: $count alert messages.

" >>$strfile 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 - 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
-	echo "
" >>$strfile + $GREP '^C ' $BASE/log/error_log + echo "

FAIL: $count critical messages, expected 0.

" >>$strfile + echo "
" >>$strfile
+	$GREP '^C ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	echo "    
" >>$strfile fail=`expr $fail + 1` else echo "PASS: $count critical messages." - echo "

PASS: $count critical messages.

" >>$strfile + echo "

PASS: $count critical messages.

" >>$strfile fi # Error log messages -count=`grep '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'` -if test $count != 17; then - echo "FAIL: $count error messages, expected 17." - grep '^E ' /tmp/cups-$user/log/error_log - echo "

FAIL: $count error messages, expected 17.

" >>$strfile - echo "
" >>$strfile
-	grep '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
-	echo "
" >>$strfile +count=`$GREP '^E ' $BASE/log/error_log | $GREP -v 'Unknown default SystemGroup' | 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 ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	echo "    
" >>$strfile fail=`expr $fail + 1` else echo "PASS: $count error messages." - echo "

PASS: $count error messages.

" >>$strfile + echo "

PASS: $count error messages.

" >>$strfile 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 - echo "
" >>$strfile
-	grep '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
-	echo "
" >>$strfile +count=`$GREP '^W ' $BASE/log/error_log | $GREP -v CreateProfile | wc -l | awk '{print $1}'` +if test $count != 8; then + echo "FAIL: $count warning messages, expected 8." + $GREP '^W ' $BASE/log/error_log + echo "

FAIL: $count warning messages, expected 8.

" >>$strfile + echo "
" >>$strfile
+	$GREP '^W ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	echo "    
" >>$strfile fail=`expr $fail + 1` else echo "PASS: $count warning messages." - echo "

PASS: $count warning messages.

" >>$strfile + echo "

PASS: $count warning messages.

" >>$strfile 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 - 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
-	echo "
" >>$strfile + $GREP '^N ' $BASE/log/error_log + echo "

FAIL: $count notice messages, expected 0.

" >>$strfile + echo "
" >>$strfile
+	$GREP '^N ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+	echo "    
" >>$strfile fail=`expr $fail + 1` else echo "PASS: $count notice messages." - echo "

PASS: $count notice messages.

" >>$strfile + echo "

PASS: $count notice messages.

" >>$strfile 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 + echo "

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

" >>$strfile fail=`expr $fail + 1` else echo "PASS: $count info messages." - echo "

PASS: $count info messages.

" >>$strfile + echo "

PASS: $count info messages.

" >>$strfile 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 + echo "

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

" >>$strfile fail=`expr $fail + 1` else echo "PASS: $count debug messages." - echo "

PASS: $count debug messages.

" >>$strfile + echo "

PASS: $count debug messages.

" >>$strfile 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 + echo "

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

" >>$strfile fail=`expr $fail + 1` else echo "PASS: $count debug2 messages." - echo "

PASS: $count debug2 messages.

" >>$strfile -fi - -# Page log file... -if grep -q 'testfile.pdf Letter' /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` + echo "

PASS: $count debug2 messages.

" >>$strfile fi +# # Log files... -echo "

access_log

" >>$strfile -echo "
" >>$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
-echo "
" >>$strfile +# -echo "

page_log

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

4 - Log Files

" >>$strfile + +for file in $BASE/log/*_log; do + baselog=`basename $file` + + echo "

$baselog

" >>$strfile + case $baselog in + error_log) + echo "
Note: debug2 messages have been filtered out of the HTML report.
" >>$strfile + echo "
" >>$strfile
+                        $GREP -v '^d' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+                        echo "    
" >>$strfile + ;; + + *) + echo "
" >>$strfile
+                        sed -e '1,$s/&/&/g' -e '1,$s/>$strfile
+                        echo "    
" >>$strfile + ;; + esac +done # # Format the reports and tell the user where to find them... @@ -778,27 +1143,23 @@ echo "" >>$strfile cat str-trailer.html >>$strfile echo "" +for file in $BASE/log/*_log; do + baselog=`basename $file` + cp $file $baselog-$date-$user + echo "Copied log file \"$baselog-$date-$user\" to test directory." +done +cp $strfile . +echo "Copied report file \"cups-str-$date-$user.html\" to test directory." -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 +# Clean out old failure log files after 1 week... +find . -name \*_log-\*-$user -a -mtime +7 -print -exec rm -f '{}' \; | awk '{print "Removed old log file \"" substr($1,3) "\" from test directory."}' +find . -name cups-str-\*-$user.html -a -mtime +7 -print -exec rm -f '{}' \; | awk '{print "Removed old report file \"" $1 "\" from test directory."}' -echo "Log files can be found in /tmp/cups-$user/log." -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 "" - + echo "$fail tests failed." exit 1 +else + echo "All tests were successful." fi - -# -# End of "$Id: run-stp-tests.sh 7954 2008-09-17 05:23:09Z mike $" -#