#!/bin/sh
#
-# "$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.
#
-# Perform the complete set of IPP compliance tests specified in the
-# CUPS Software Test Plan.
+# Copyright © 2007-2018 by Apple Inc.
+# Copyright © 1997-2007 by Easy Software Products, all rights reserved.
#
-# 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
-# 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/".
+# Licensed under Apache License v2.0. See the file "LICENSE" for more
+# information.
#
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...
#
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
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"
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
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=""
+ VALGRIND=""
+ export VALGRIND
;;
esac
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
+ 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|cupsGetRespond|cupsSend).*$'; export CUPS_DEBUG_FILTER
+ 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; 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
+ 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
;;
*)
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/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/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/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/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
-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
-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/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 <<EOF
+ ==== Cover Page ====
+
+
+ Job: {?printer-name}-{?job-id}
+ Owner: {?job-originating-user-name}
+ Name: {?job-name}
+ Pages: {?job-impressions}
+
+
+ ==== Cover Page ====
+EOF
+cat >$BASE/share/banners/classified <<EOF
+ ==== Classified - Do Not Disclose ====
+
+
+ Job: {?printer-name}-{?job-id}
+ Owner: {?job-originating-user-name}
+ Name: {?job-name}
+ Pages: {?job-impressions}
+
+
+ ==== Classified - Do Not Disclose ====
+EOF
+ln -s $root/data $BASE/share
+ln -s $root/ppdc/sample.drv $BASE/share/drv
+ln -s $root/conf/mime.types $BASE/share/mime
+ln -s $root/conf/mime.convs $BASE/share/mime
+ln -s $root/data/*.h $BASE/share/ppdc
+ln -s $root/data/*.defs $BASE/share/ppdc
+ln -s $root/templates $BASE/share
+
+#
+# Local filters and configuration files...
#
+instfilter() {
+ # instfilter src dst format
+ #
+ # See if the filter exists in a standard location; if so, make a
+ # symlink, otherwise create a dummy script for the specified format.
+ #
+ src="$1"
+ dst="$2"
+ format="$3"
+
+ for dir in /usr/local/libexec/cups/filter /usr/libexec/cups/filter /usr/lib/cups/filter; do
+ if test -x "$dir/$src"; then
+ ln -s "$dir/$src" "$BASE/bin/filter/$dst"
+ return
+ fi
+ done
+
+ # Source filter not present, create a dummy filter
+ case $format in
+ passthru)
+ ln -s gziptoany "$BASE/bin/filter/$dst"
+ ;;
+ pdf)
+ cat >"$BASE/bin/filter/$dst" <<EOF
+#!/bin/sh
+trap "" TERM
+trap "" PIPE
+gziptoany "$1" "$2" "$3" "$4" "$5" \$6 >/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" <<EOF
+#!/bin/sh
+trap "" TERM
+trap "" PIPE
+gziptoany "$1" "$2" "$3" "$4" "$5" \$6 >/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" <<EOF
+#!/bin/sh
+trap "" TERM
+trap "" PIPE
+gziptoany "$1" "$2" "$3" "$4" "$5" \$6 >/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/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
-
- 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 /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
+ 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
#
encryption=""
fi
-cat >/tmp/cups-$user/cupsd.conf <<EOF
+cat >$BASE/cupsd.conf <<EOF
+StrictConformance Yes
Browsing Off
-FileDevice yes
-Printcap
-Listen 127.0.0.1:$port
-User $user
-ServerRoot /tmp/cups-$user
-StateDir /tmp/cups-$user
-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
+Listen localhost:$port
+Listen $BASE/sock
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
AccessLogLevel actions
-LogLevel debug2
+LogLevel $loglevel
LogTimeFormat usecs
PreserveJobHistory Yes
+PreserveJobFiles 5m
<Policy default>
<Limit All>
-Order Deny,Allow
-Deny from all
-Allow from 127.0.0.1
+Order Allow,Deny
$encryption
</Limit>
</Policy>
EOF
+if test $testtype = 0; then
+ echo WebInterface yes >>$BASE/cupsd.conf
+fi
+
+cat >$BASE/cups-files.conf <<EOF
+FileDevice yes
+Printcap
+User $user
+ServerRoot $BASE
+StateDir $BASE
+ServerBin $BASE/bin
+CacheDir $BASE/share
+DataDir $BASE/share
+FontPath $BASE/share/fonts
+DocumentRoot $root/doc
+RequestRoot $BASE/spool
+TempDir $BASE/spool/temp
+AccessLog $BASE/log/access_log
+ErrorLog $BASE/log/error_log
+PageLog $BASE/log/page_log
+
+PassEnv DYLD_INSERT_LIBRARIES
+PassEnv DYLD_LIBRARY_PATH
+PassEnv LD_LIBRARY_PATH
+PassEnv LD_PRELOAD
+PassEnv LOCALEDIR
+PassEnv SHLIB_PATH
+EOF
+
+if test $ssltype != 0 -a `uname` = Darwin; then
+ echo "ServerKeychain $HOME/Library/Keychains/login.keychain" >> $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 <<EOF
+while test $i -le $nprinters; do
+ cat >>$BASE/printers.conf <<EOF
<Printer test-$i>
Accepting Yes
DeviceURI file:/dev/null
</Printer>
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 <<EOF
-<Printer test-$i>
-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.
-</Printer>
-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
#
-# 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"
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:$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/ppdc/libcupsppdc.so.1"
+LD_PRELOAD="$root/cups/libcups.so.2:$root/cups/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
-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"
-else
- DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$DYLD_LIBRARY_PATH"
+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/cups/libcupsimage.2.dylib"
+ else
+ DYLD_INSERT_LIBRARIES="$root/cups/libcups.2.dylib:$root/cups/libcupsimage.2.dylib:$DYLD_INSERT_LIBRARIES"
+ fi
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"
+if test "x$DYLD_LIBRARY_PATH" = x; then
+ DYLD_LIBRARY_PATH="$root/cups"
else
- SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$SHLIB_PATH"
+ DYLD_LIBRARY_PATH="$root/cups:$DYLD_LIBRARY_PATH"
fi
-export 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: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_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
+
+chmod +x $runcups
#
# Set a new home directory to avoid getting user options mixed in...
#
-HOME=/tmp/cups-$user
+HOME=$BASE
export HOME
#
#
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 ""
-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 &
+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
- $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
+ $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
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
#
date=`date "+%Y-%m-%d"`
-strfile=/tmp/cups-$user/cups-str-1.6-$date-$user.html
+
+strfile=$BASE/cups-str-$date-$user.html
rm -f $strfile
cat str-header.html >$strfile
echo ""
echo "Running IPP compliance tests..."
-echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile
-echo "<P>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 "<PRE>" >>$strfile
+echo " <h1><a name='IPP'>1 - IPP Compliance Tests</a></h1>" >>$strfile
+echo " <p>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 " <pre>" >>$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
- ./ipptool -t 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 "</PRE>" >>$strfile
+echo " </pre>" >>$strfile
#
# Run the command tests...
echo ""
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 by $user on `hostname`. >>$strfile
-echo "<PRE>" >>$strfile
+echo " <h1><a name='COMMAND'>2 - Command Tests</a></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 by $user on `hostname`." >>$strfile
+echo " <pre>" >>$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 $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
-echo "</PRE>" >>$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
+
+echo " </pre>" >>$strfile
#
-# Append the log files for post-mortim...
+# Stop the server...
#
-echo "<H1>3 - Log Files</H1>" >>$strfile
+kill $cupsd
+wait $cupsd
+cupsdstatus=$?
#
# Verify counts...
echo "Test Summary"
echo ""
-echo "<H2>Summary</H2>" >>$strfile
+echo " <h1><a name='SUMMARY'>3 - Test Summary</a></h1>" >>$strfile
+
+if test $cupsdstatus != 0; then
+ echo "FAIL: cupsd failed with exit status $cupsdstatus."
+ echo " <p>FAIL: cupsd failed with exit status $cupsdstatus.</p>" >>$strfile
+ fail=`expr $fail + 1`
+else
+ echo "PASS: cupsd exited with no errors."
+ echo " <p>PASS: cupsd exited with no errors.</p>" >>$strfile
+fi
# 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."
- echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile
+ 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
+ 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}'`
+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 "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile
+ echo " <p>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</p>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: Printer 'Test1' correctly produced $count page(s)."
- echo "<P>PASS: Printer 'Test1' correctly produced $count page(s).</P>" >>$strfile
+ echo " <p>PASS: Printer 'Test1' correctly produced $count page(s).</p>" >>$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 "<P>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</P>" >>$strfile
+ echo " <p>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</p>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: Printer 'Test2' correctly produced $count page(s)."
- echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile
+ echo " <p>PASS: Printer 'Test2' correctly produced $count page(s).</p>" >>$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 " <p>FAIL: Printer 'Test3' produced $count page(s), expected $expected.</p>" >>$strfile
+ fail=`expr $fail + 1`
+else
+ echo "PASS: Printer 'Test3' correctly produced $count page(s)."
+ echo " <p>PASS: Printer 'Test3' correctly produced $count page(s).</p>" >>$strfile
fi
# Requests logged
-count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
-expected=`expr 37 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
+count=`wc -l $BASE/log/access_log | awk '{print $1}'`
+expected=`expr 35 + 18 + 30 + $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
+ 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
+ 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
+if $GREP -q CUPS-Get-Default $BASE/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/&/&/g' -e '1,$s/</</g' >>$strfile
- echo "</PRE>" >>$strfile
+ echo " <p>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</p>" >>$strfile
+ echo " <pre>" >>$strfile
+ $GREP CUPS-Get-Default $BASE/log/access_log | sed -e '1,$s/&/&/g' -e '1,$s/</</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
+ 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 ' $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 "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile
- echo "<PRE>" >>$strfile
- $GREP '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
- echo "</PRE>" >>$strfile
+ $GREP '^X ' $BASE/log/error_log
+ echo " <p>FAIL: $count emergency messages, expected 0.</p>" >>$strfile
+ echo " <pre>" >>$strfile
+ $GREP '^X ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
+ echo " </pre>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: $count emergency messages."
- echo "<P>PASS: $count emergency messages.</P>" >>$strfile
+ echo " <p>PASS: $count emergency messages.</p>" >>$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 "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile
- echo "<PRE>" >>$strfile
- $GREP '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
- echo "</PRE>" >>$strfile
+ $GREP '^A ' $BASE/log/error_log
+ echo " <p>FAIL: $count alert messages, expected 0.</p>" >>$strfile
+ echo " <pre>" >>$strfile
+ $GREP '^A ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
+ echo " </pre>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: $count alert messages."
- echo "<P>PASS: $count alert messages.</P>" >>$strfile
+ echo " <p>PASS: $count alert messages.</p>" >>$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 "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile
- echo "<PRE>" >>$strfile
- $GREP '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
- echo "</PRE>" >>$strfile
+ $GREP '^C ' $BASE/log/error_log
+ echo " <p>FAIL: $count critical messages, expected 0.</p>" >>$strfile
+ echo " <pre>" >>$strfile
+ $GREP '^C ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
+ echo " </pre>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: $count critical messages."
- echo "<P>PASS: $count critical messages.</P>" >>$strfile
+ echo " <p>PASS: $count critical messages.</p>" >>$strfile
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 "<P>FAIL: $count error messages, expected 18.</P>" >>$strfile
- echo "<PRE>" >>$strfile
- $GREP '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
- echo "</PRE>" >>$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 " <p>FAIL: $count error messages, expected 33.</p>" >>$strfile
+ echo " <pre>" >>$strfile
+ $GREP '^E ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
+ echo " </pre>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: $count error messages."
- echo "<P>PASS: $count error messages.</P>" >>$strfile
+ echo " <p>PASS: $count error messages.</p>" >>$strfile
fi
# Warning log messages
-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/&/&/g' -e '1,$s/</</g' >>$strfile
- echo "</PRE>" >>$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 " <p>FAIL: $count warning messages, expected 8.</p>" >>$strfile
+ echo " <pre>" >>$strfile
+ $GREP '^W ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
+ echo " </pre>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: $count warning messages."
- echo "<P>PASS: $count warning messages.</P>" >>$strfile
+ echo " <p>PASS: $count warning messages.</p>" >>$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 "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile
- echo "<PRE>" >>$strfile
- $GREP '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
- echo "</PRE>" >>$strfile
+ $GREP '^N ' $BASE/log/error_log
+ echo " <p>FAIL: $count notice messages, expected 0.</p>" >>$strfile
+ echo " <pre>" >>$strfile
+ $GREP '^N ' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
+ echo " </pre>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: $count notice messages."
- echo "<P>PASS: $count notice messages.</P>" >>$strfile
+ echo " <p>PASS: $count notice messages.</p>" >>$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 "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile
+ echo " <p>FAIL: $count info messages, expected more than 0.</p>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: $count info messages."
- echo "<P>PASS: $count info messages.</P>" >>$strfile
+ echo " <p>PASS: $count info messages.</p>" >>$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 "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile
+ echo " <p>FAIL: $count debug messages, expected more than 0.</p>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: $count debug messages."
- echo "<P>PASS: $count debug messages.</P>" >>$strfile
+ echo " <p>PASS: $count debug messages.</p>" >>$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 "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile
+ echo " <p>FAIL: $count debug2 messages, expected more than 0.</p>" >>$strfile
fail=`expr $fail + 1`
else
echo "PASS: $count debug2 messages."
- echo "<P>PASS: $count debug2 messages.</P>" >>$strfile
+ echo " <p>PASS: $count debug2 messages.</p>" >>$strfile
fi
+#
# Log files...
-echo "<H2>access_log</H2>" >>$strfile
-echo "<PRE>" >>$strfile
-sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/access_log >>$strfile
-echo "</PRE>" >>$strfile
-
-echo "<H2>error_log</H2>" >>$strfile
-echo "<PRE>" >>$strfile
-$GREP -v '^d' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
-echo "</PRE>" >>$strfile
+#
-echo "<H2>page_log</H2>" >>$strfile
-echo "<PRE>" >>$strfile
-sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp/cups-$user/log/page_log >>$strfile
-echo "</PRE>" >>$strfile
+echo " <h1><a name='LOGS'>4 - Log Files</a></h1>" >>$strfile
+
+for file in $BASE/log/*_log; do
+ baselog=`basename $file`
+
+ echo " <h2><a name=\"$baselog\">$baselog</a></h2>" >>$strfile
+ case $baselog in
+ error_log)
+ echo " <blockquote>Note: debug2 messages have been filtered out of the HTML report.</blockquote>" >>$strfile
+ echo " <pre>" >>$strfile
+ $GREP -v '^d' $BASE/log/error_log | sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
+ echo " </pre>" >>$strfile
+ ;;
+
+ *)
+ echo " <pre>" >>$strfile
+ sed -e '1,$s/&/&/g' -e '1,$s/</</g' $file >>$strfile
+ echo " </pre>" >>$strfile
+ ;;
+ esac
+done
#
# Format the reports and tell the user where to find them...
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 9034 2010-03-09 07:03:06Z mike $"
-#