3 # "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $"
5 # Perform the complete set of IPP compliance tests specified in the
6 # CUPS Software Test Plan.
8 # Copyright 2007-2011 by Apple Inc.
9 # Copyright 1997-2007 by Easy Software Products, all rights reserved.
11 # These coded instructions, statements, and computer programs are the
12 # property of Apple Inc. and are protected by Federal copyright
13 # law. Distribution and use rights are outlined in the file "LICENSE.txt"
14 # which should have been included with this file. If this file is
15 # file is missing or damaged, see the license at "http://www.cups.org/".
21 # Make the IPP test program...
27 # Solaris has a non-POSIX grep in /bin...
30 if test -x /usr
/xpg
4/bin
/grep; then
31 GREP
=/usr
/xpg
4/bin
/grep
37 # Figure out the proper echo options...
40 if (echo "testing\c"; echo 1,2,3) |
$GREP c
>/dev
/null
; then
52 echo "Welcome to the CUPS Automated Test Script."
54 echo "Before we begin, it is important that you understand that the larger"
55 echo "tests require significant amounts of RAM and disk space. If you"
56 echo "attempt to run one of the big tests on a system that lacks sufficient"
57 echo "disk and virtual memory, the UNIX kernel might decide to kill one or"
58 echo "more system processes that you've grown attached to, like the X"
59 echo "server. The question you may want to ask yourself before running a"
60 echo "large test is: Do you feel lucky?"
62 echo "OK, now that we have the Dirty Harry quote out of the way, please"
63 echo "choose the type of test you wish to perform:"
65 echo "0 - No testing, keep the scheduler running for me (all systems)"
66 echo "1 - Basic conformance test, no load testing (all systems)"
67 echo "2 - Basic conformance test, some load testing (minimum 256MB VM, 50MB disk)"
68 echo "3 - Basic conformance test, extreme load testing (minimum 1GB VM, 500MB disk)"
69 echo "4 - Basic conformance test, torture load testing (minimum 2GB VM, 1GB disk)"
71 echo $ac_n "Enter the number of the test you wish to perform: [1] $ac_c"
73 if test $# -gt 0; then
83 echo "Running in test mode (0)"
90 echo "Running the medium tests (2)"
97 echo "Running the extreme tests (3)"
104 echo "Running the torture tests (4)"
111 echo "Running the timid tests (1)"
120 # See if we want to do SSL testing...
124 echo "Now you can choose whether to create a SSL/TLS encryption key and"
125 echo "certificate for testing; these tests currently require the OpenSSL"
128 echo "0 - Do not do SSL/TLS encryption tests"
129 echo "1 - Test but do not require encryption"
130 echo "2 - Test and require encryption"
132 echo $ac_n "Enter the number of the SSL/TLS tests to perform: [0] $ac_c"
134 if test $# -gt 0; then
144 echo "Will test but not require encryption (1)"
147 echo "Will test and require encryption (2)"
150 echo "Not using SSL/TLS (0)"
156 # Information for the server/tests...
160 if test -z "$user"; then
161 if test -x /usr
/ucb
/whoami
; then
162 user
=`/usr/ucb/whoami`
167 if test -z "$user"; then
177 # Make sure that the LPDEST and PRINTER environment variables are
178 # not included in the environment that is passed to the tests. These
179 # will usually cause tests to fail erroneously...
186 # See if we want to use valgrind...
190 echo "This test script can use the Valgrind software from:"
192 echo " http://developer.kde.org/~sewardj/"
194 echo $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c"
196 if test $# -gt 0; then
204 case "$usevalgrind" in
206 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"
207 if test `uname` = Darwin
; then
208 VALGRIND
="$VALGRIND --dsymutil=yes"
211 echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..."
221 # See if we want to do debug logging of the libraries...
225 echo "If CUPS was built with the --enable-debug-printfs configure option, you"
226 echo "can enable debug logging of the libraries."
228 echo $ac_n "Enter Y or a number from 0 to 9 to enable debug logging or N to not: [N] $ac_c"
230 if test $# -gt 0; then
238 case "$usedebugprintfs" in
240 echo "Enabling debug printfs; log files can be found in /tmp/cups-$user/log..."
241 CUPS_DEBUG_LOG
="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
242 CUPS_DEBUG_LEVEL
=5; export CUPS_DEBUG_LEVEL
243 CUPS_DEBUG_FILTER
='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
246 0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9)
247 echo "Enabling debug printfs; log files can be found in /tmp/cups-$user/log..."
248 CUPS_DEBUG_LOG
="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
249 CUPS_DEBUG_LEVEL
=$usedebugprintf; export CUPS_DEBUG_LEVEL
250 CUPS_DEBUG_FILTER
='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
258 # Start by creating temporary directories for the tests...
261 echo "Creating directories for test..."
263 rm -rf /tmp
/cups-
$user
264 mkdir
/tmp
/cups-
$user
265 mkdir
/tmp
/cups-
$user/bin
266 mkdir
/tmp
/cups-
$user/bin
/backend
267 mkdir
/tmp
/cups-
$user/bin
/driver
268 mkdir
/tmp
/cups-
$user/bin
/filter
269 mkdir
/tmp
/cups-
$user/certs
270 mkdir
/tmp
/cups-
$user/share
271 mkdir
/tmp
/cups-
$user/share
/banners
272 mkdir
/tmp
/cups-
$user/share
/drv
273 mkdir
/tmp
/cups-
$user/share
/locale
274 for file in ..
/locale
/cups_
*.po
; do
275 loc
=`basename $file .po | cut -c 6-`
276 mkdir
/tmp
/cups-
$user/share
/locale
/$loc
277 ln -s $root/locale
/cups_
$loc.po
/tmp
/cups-
$user/share
/locale
/$loc
278 ln -s $root/locale
/ppdc_
$loc.po
/tmp
/cups-
$user/share
/locale
/$loc
280 mkdir
/tmp
/cups-
$user/share
/mime
281 mkdir
/tmp
/cups-
$user/share
/model
282 mkdir
/tmp
/cups-
$user/share
/ppdc
283 mkdir
/tmp
/cups-
$user/interfaces
284 mkdir
/tmp
/cups-
$user/log
285 mkdir
/tmp
/cups-
$user/ppd
286 mkdir
/tmp
/cups-
$user/spool
287 mkdir
/tmp
/cups-
$user/spool
/temp
288 mkdir
/tmp
/cups-
$user/ssl
290 ln -s $root/backend
/dnssd
/tmp
/cups-
$user/bin
/backend
291 ln -s $root/backend
/http
/tmp
/cups-
$user/bin
/backend
292 ln -s $root/backend
/ipp
/tmp
/cups-
$user/bin
/backend
293 ln -s $root/backend
/lpd
/tmp
/cups-
$user/bin
/backend
294 ln -s $root/backend
/mdns
/tmp
/cups-
$user/bin
/backend
295 ln -s $root/backend
/pseudo
/tmp
/cups-
$user/bin
/backend
296 ln -s $root/backend
/snmp
/tmp
/cups-
$user/bin
/backend
297 ln -s $root/backend
/socket
/tmp
/cups-
$user/bin
/backend
298 ln -s $root/backend
/usb
/tmp
/cups-
$user/bin
/backend
299 ln -s $root/cgi-bin
/tmp
/cups-
$user/bin
300 ln -s $root/monitor
/tmp
/cups-
$user/bin
301 ln -s $root/notifier
/tmp
/cups-
$user/bin
302 ln -s $root/scheduler
/tmp
/cups-
$user/bin
/daemon
303 ln -s $root/filter
/commandtops
/tmp
/cups-
$user/bin
/filter
304 ln -s $root/filter
/gziptoany
/tmp
/cups-
$user/bin
/filter
305 ln -s $root/filter
/pstops
/tmp
/cups-
$user/bin
/filter
306 ln -s $root/filter
/rastertoepson
/tmp
/cups-
$user/bin
/filter
307 ln -s $root/filter
/rastertohp
/tmp
/cups-
$user/bin
/filter
308 ln -s $root/filter
/rastertolabel
/tmp
/cups-
$user/bin
/filter
309 ln -s $root/filter
/rastertopwg
/tmp
/cups-
$user/bin
/filter
311 ln -s $root/data
/classified
/tmp
/cups-
$user/share
/banners
312 ln -s $root/data
/confidential
/tmp
/cups-
$user/share
/banners
313 ln -s $root/data
/secret
/tmp
/cups-
$user/share
/banners
314 ln -s $root/data
/standard
/tmp
/cups-
$user/share
/banners
315 ln -s $root/data
/topsecret
/tmp
/cups-
$user/share
/banners
316 ln -s $root/data
/unclassified
/tmp
/cups-
$user/share
/banners
317 ln -s $root/data
/tmp
/cups-
$user/share
318 ln -s $root/ppdc
/sample.drv
/tmp
/cups-
$user/share
/drv
319 ln -s $root/conf
/mime.types
/tmp
/cups-
$user/share
/mime
320 ln -s $root/conf
/mime.convs
/tmp
/cups-
$user/share
/mime
321 ln -s $root/data
/*.h
/tmp
/cups-
$user/share
/ppdc
322 ln -s $root/data
/*.defs
/tmp
/cups-
$user/share
/ppdc
323 ln -s $root/templates
/tmp
/cups-
$user/share
326 # Mac OS X filters and configuration files...
329 if test `uname` = Darwin
; then
330 ln -s /usr
/libexec
/cups
/filter
/cgpdfto
* /tmp
/cups-
$user/bin
/filter
331 ln -s /usr
/libexec
/cups
/filter
/cgbannertopdf
/tmp
/cups-
$user/bin
/filter
332 ln -s /usr
/libexec
/cups
/filter
/cgimagetopdf
/tmp
/cups-
$user/bin
/filter
333 ln -s /usr
/libexec
/cups
/filter
/cgtexttopdf
/tmp
/cups-
$user/bin
/filter
334 ln -s /usr
/libexec
/cups
/filter
/nsimagetopdf
/tmp
/cups-
$user/bin
/filter
335 ln -s /usr
/libexec
/cups
/filter
/nstexttopdf
/tmp
/cups-
$user/bin
/filter
336 ln -s /usr
/libexec
/cups
/filter
/pictwpstops
/tmp
/cups-
$user/bin
/filter
337 ln -s /usr
/libexec
/cups
/filter
/pstoappleps
/tmp
/cups-
$user/bin
/filter
338 ln -s /usr
/libexec
/cups
/filter
/pstocupsraster
/tmp
/cups-
$user/bin
/filter
339 ln -s /usr
/libexec
/cups
/filter
/pstopdffilter
/tmp
/cups-
$user/bin
/filter
340 ln -s /usr
/libexec
/cups
/filter
/rastertourf
/tmp
/cups-
$user/bin
/filter
341 ln -s /usr
/libexec
/cups
/filter
/xhtmltopdf
/tmp
/cups-
$user/bin
/filter
343 if test -f /private
/etc
/cups
/apple.types
; then
344 ln -s /private
/etc
/cups
/apple.
* /tmp
/cups-
$user/share
/mime
345 elif test -f /usr
/share
/cups
/mime
/apple.types
; then
346 ln -s /usr
/share
/cups
/mime
/apple.
* /tmp
/cups-
$user/share
/mime
349 ln -s /usr
/lib
/cups
/filter
/bannertops
/tmp
/cups-
$user/bin
/filter
350 ln -s /usr
/lib
/cups
/filter
/imagetops
/tmp
/cups-
$user/bin
/filter
351 ln -s /usr
/lib
/cups
/filter
/imagetoraster
/tmp
/cups-
$user/bin
/filter
352 ln -s /usr
/lib
/cups
/filter
/pdftops
/tmp
/cups-
$user/bin
/filter
353 ln -s /usr
/lib
/cups
/filter
/texttops
/tmp
/cups-
$user/bin
/filter
355 ln -s /usr
/share
/cups
/mime
/legacy.convs
/tmp
/cups-
$user/share
/mime
359 # Then create the necessary config files...
362 echo "Creating cupsd.conf for test..."
364 if test $ssltype = 2; then
365 encryption
="Encryption Required"
370 cat >/tmp
/cups-
$user/cupsd.conf
<<EOF
374 Listen 127.0.0.1:$port
376 ServerRoot /tmp/cups-$user
377 StateDir /tmp/cups-$user
378 ServerBin /tmp/cups-$user/bin
379 CacheDir /tmp/cups-$user/share
380 DataDir /tmp/cups-$user/share
381 FontPath /tmp/cups-$user/share/fonts
383 PassEnv DYLD_INSERT_LIBRARIES
384 DocumentRoot $root/doc
385 RequestRoot /tmp/cups-$user/spool
386 TempDir /tmp/cups-$user/spool/temp
389 AccessLog /tmp/cups-$user/log/access_log
390 ErrorLog /tmp/cups-$user/log/error_log
391 PageLog /tmp/cups-$user/log/page_log
392 AccessLogLevel actions
395 PreserveJobHistory Yes
407 # Setup lots of test queues - half with PPD files, half without...
410 echo "Creating printers.conf for test..."
413 while test $i -le $nprinters1; do
414 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
417 DeviceURI file:/dev/null
418 Info Test PS printer $i
420 Location CUPS test suite
422 StateMessage Printer $1 is idle.
426 cp testps.ppd
/tmp
/cups-
$user/ppd
/test-
$i.ppd
431 while test $i -le $nprinters2; do
432 cat >>/tmp
/cups-
$user/printers.conf
<<EOF
435 DeviceURI file:/dev/null
436 Info Test raw printer $i
438 Location CUPS test suite
440 StateMessage Printer $1 is idle.
447 if test -f /tmp
/cups-
$user/printers.conf
; then
448 cp /tmp
/cups-
$user/printers.conf
/tmp
/cups-
$user/printers.conf.orig
450 touch /tmp
/cups-
$user/printers.conf.orig
457 echo "Setting up environment variables for test..."
459 if test "x$LD_LIBRARY_PATH" = x
; then
460 LD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc"
462 LD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$LD_LIBRARY_PATH"
465 export LD_LIBRARY_PATH
467 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"
468 if test `uname` = SunOS
-a -r /usr
/lib
/libCrun.so
.1; then
469 LD_PRELOAD
="/usr/lib/libCrun.so.1:$LD_PRELOAD"
473 if test "x$DYLD_LIBRARY_PATH" = x
; then
474 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc"
476 DYLD_LIBRARY_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$DYLD_LIBRARY_PATH"
479 export DYLD_LIBRARY_PATH
481 if test "x$SHLIB_PATH" = x
; then
482 SHLIB_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc"
484 SHLIB_PATH
="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/driver:$root/ppdc:$SHLIB_PATH"
489 CUPS_DISABLE_APPLE_DEFAULT
=yes; export CUPS_DISABLE_APPLE_DEFAULT
490 CUPS_SERVER
=localhost
:8631; export CUPS_SERVER
491 CUPS_SERVERROOT
=/tmp
/cups-
$user; export CUPS_SERVERROOT
492 CUPS_STATEDIR
=/tmp
/cups-
$user; export CUPS_STATEDIR
493 CUPS_DATADIR
=/tmp
/cups-
$user/share
; export CUPS_DATADIR
494 LOCALEDIR
=/tmp
/cups-
$user/share
/locale
; export LOCALEDIR
497 # Set a new home directory to avoid getting user options mixed in...
504 # Force POSIX locale for tests...
514 # Start the server; run as foreground daemon in the background...
517 echo "Starting scheduler:"
518 echo " $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &"
521 if test `uname` = Darwin
-a "x$VALGRIND" = x
; then
522 DYLD_INSERT_LIBRARIES
=/usr
/lib
/libgmalloc.dylib
523 ..
/scheduler
/cupsd
-c /tmp
/cups-
$user/cupsd.conf
-f >/tmp
/cups-
$user/log
/debug_log
2>&1 &
525 $VALGRIND ..
/scheduler
/cupsd
-c /tmp
/cups-
$user/cupsd.conf
-f >/tmp
/cups-
$user/log
/debug_log
2>&1 &
530 if test "x$testtype" = x0
; then
531 # Not running tests...
532 echo "Scheduler is PID $cupsd and is listening on port 8631."
535 # Create a helper script to run programs with...
536 runcups
="/tmp/cups-$user/runcups"
538 echo "#!/bin/sh" >$runcups
539 echo "# Helper script for running CUPS test instance." >>$runcups
541 echo "# Set required environment variables..." >>$runcups
542 echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups
543 echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups
544 echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups
545 echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups
546 echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups
547 echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups
548 echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups
549 echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups
550 echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups
552 echo "# Run command..." >>$runcups
553 echo "exec \"\$@\"" >>$runcups
557 echo "The $runcups helper script can be used to test programs"
558 echo "with the server."
562 if test $argcount -eq 0; then
563 echo "Scheduler is PID $cupsd; run debugger now if you need to."
565 echo $ac_n "Press ENTER to continue... $ac_c"
568 echo "Scheduler is PID $cupsd."
572 IPP_PORT
=$port; export IPP_PORT
575 running
=`../systemv/lpstat -r 2>/dev/null`
576 if test "x$running" = "xscheduler is running"; then
580 echo "Waiting for scheduler to become ready..."
585 # Create the test report source file...
588 date=`date "+%Y-%m-%d"`
589 strfile
=/tmp
/cups-
$user/cups-str-1.6
-$date-$user.html
592 cat str-header.html
>$strfile
595 # Run the IPP tests...
599 echo "Running IPP compliance tests..."
601 echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile
602 echo "<P>This section provides the results to the IPP compliance tests" >>$strfile
603 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
604 echo `date "+%Y-%m-%d"` by
$user on
`hostname`.
>>$strfile
605 echo "<PRE>" >>$strfile
608 for file in 4*.
test; do
609 echo $ac_n "Performing $file: $ac_c"
612 $VALGRIND .
/ipptool
-tI ipp
://localhost
:$port/printers
$file >> $strfile
615 if test $status != 0; then
617 fail
=`expr $fail + 1`
623 echo "</PRE>" >>$strfile
626 # Run the command tests...
630 echo "Running command tests..."
632 echo "<H1>2 - Command Tests</H1>" >>$strfile
633 echo "<P>This section provides the results to the command tests" >>$strfile
634 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
635 echo $date by
$user on
`hostname`.
>>$strfile
636 echo "<PRE>" >>$strfile
638 for file in 5*.sh
; do
639 echo $ac_n "Performing $file: $ac_c"
641 echo "\"$file\":" >>$strfile
643 sh
$file $pjobs $pprinters >> $strfile
646 if test $status != 0; then
648 fail
=`expr $fail + 1`
654 echo "</PRE>" >>$strfile
663 # Append the log files for post-mortim...
666 echo "<H1>3 - Log Files</H1>" >>$strfile
674 echo "<H2>Summary</H2>" >>$strfile
677 count
=`ls -1 /tmp/cups-$user/spool | wc -l`
678 count
=`expr $count - 1`
679 if test $count != 0; then
680 echo "FAIL: $count job control files were not purged."
681 echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile
682 fail
=`expr $fail + 1`
684 echo "PASS: All job control files purged."
685 echo "<P>PASS: All job control files purged.</P>" >>$strfile
688 # Pages printed on Test1 (within 1 page for timing-dependent cancel issues)
689 count
=`$GREP '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
690 expected
=`expr $pjobs \* 2 + 34`
691 expected2
=`expr $expected + 2`
692 if test $count -lt $expected -a $count -gt $expected2; then
693 echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected."
694 echo "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile
695 fail
=`expr $fail + 1`
697 echo "PASS: Printer 'Test1' correctly produced $count page(s)."
698 echo "<P>PASS: Printer 'Test1' correctly produced $count page(s).</P>" >>$strfile
701 # Paged printed on Test2
702 count
=`$GREP '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
703 expected
=`expr $pjobs \* 2 + 3`
704 if test $count != $expected; then
705 echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected."
706 echo "<P>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</P>" >>$strfile
707 fail
=`expr $fail + 1`
709 echo "PASS: Printer 'Test2' correctly produced $count page(s)."
710 echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile
714 count
=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
715 expected
=`expr 37 + 18 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
716 if test $count != $expected; then
717 echo "FAIL: $count requests logged, expected $expected."
718 echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile
719 fail
=`expr $fail + 1`
721 echo "PASS: $count requests logged."
722 echo "<P>PASS: $count requests logged.</P>" >>$strfile
725 # Did CUPS-Get-Default get logged?
726 if $GREP -q CUPS-Get-Default
/tmp
/cups-
$user/log
/access_log
; then
727 echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'"
728 echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile
729 echo "<PRE>" >>$strfile
730 $GREP CUPS-Get-Default
/tmp
/cups-
$user/log
/access_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
731 echo "</PRE>" >>$strfile
732 fail
=`expr $fail + 1`
734 echo "PASS: CUPS-Get-Default not logged."
735 echo "<P>PASS: CUPS-Get-Default not logged.</P>" >>$strfile
738 # Emergency log messages
739 count
=`$GREP '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
740 if test $count != 0; then
741 echo "FAIL: $count emergency messages, expected 0."
742 $GREP '^X ' /tmp
/cups-
$user/log
/error_log
743 echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile
744 echo "<PRE>" >>$strfile
745 $GREP '^X ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
746 echo "</PRE>" >>$strfile
747 fail
=`expr $fail + 1`
749 echo "PASS: $count emergency messages."
750 echo "<P>PASS: $count emergency messages.</P>" >>$strfile
754 count
=`$GREP '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
755 if test $count != 0; then
756 echo "FAIL: $count alert messages, expected 0."
757 $GREP '^A ' /tmp
/cups-
$user/log
/error_log
758 echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile
759 echo "<PRE>" >>$strfile
760 $GREP '^A ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
761 echo "</PRE>" >>$strfile
762 fail
=`expr $fail + 1`
764 echo "PASS: $count alert messages."
765 echo "<P>PASS: $count alert messages.</P>" >>$strfile
768 # Critical log messages
769 count
=`$GREP '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
770 if test $count != 0; then
771 echo "FAIL: $count critical messages, expected 0."
772 $GREP '^C ' /tmp
/cups-
$user/log
/error_log
773 echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile
774 echo "<PRE>" >>$strfile
775 $GREP '^C ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
776 echo "</PRE>" >>$strfile
777 fail
=`expr $fail + 1`
779 echo "PASS: $count critical messages."
780 echo "<P>PASS: $count critical messages.</P>" >>$strfile
784 count
=`$GREP '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
785 if test $count != 18; then
786 echo "FAIL: $count error messages, expected 18."
787 $GREP '^E ' /tmp
/cups-
$user/log
/error_log
788 echo "<P>FAIL: $count error messages, expected 18.</P>" >>$strfile
789 echo "<PRE>" >>$strfile
790 $GREP '^E ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
791 echo "</PRE>" >>$strfile
792 fail
=`expr $fail + 1`
794 echo "PASS: $count error messages."
795 echo "<P>PASS: $count error messages.</P>" >>$strfile
798 # Warning log messages
799 count
=`$GREP '^W ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
800 if test $count != 9; then
801 echo "FAIL: $count warning messages, expected 9."
802 $GREP '^W ' /tmp
/cups-
$user/log
/error_log
803 echo "<P>FAIL: $count warning messages, expected 9.</P>" >>$strfile
804 echo "<PRE>" >>$strfile
805 $GREP '^W ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
806 echo "</PRE>" >>$strfile
807 fail
=`expr $fail + 1`
809 echo "PASS: $count warning messages."
810 echo "<P>PASS: $count warning messages.</P>" >>$strfile
813 # Notice log messages
814 count
=`$GREP '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
815 if test $count != 0; then
816 echo "FAIL: $count notice messages, expected 0."
817 $GREP '^N ' /tmp
/cups-
$user/log
/error_log
818 echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile
819 echo "<PRE>" >>$strfile
820 $GREP '^N ' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
821 echo "</PRE>" >>$strfile
822 fail
=`expr $fail + 1`
824 echo "PASS: $count notice messages."
825 echo "<P>PASS: $count notice messages.</P>" >>$strfile
829 count
=`$GREP '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
830 if test $count = 0; then
831 echo "FAIL: $count info messages, expected more than 0."
832 echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile
833 fail
=`expr $fail + 1`
835 echo "PASS: $count info messages."
836 echo "<P>PASS: $count info messages.</P>" >>$strfile
840 count
=`$GREP '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
841 if test $count = 0; then
842 echo "FAIL: $count debug messages, expected more than 0."
843 echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile
844 fail
=`expr $fail + 1`
846 echo "PASS: $count debug messages."
847 echo "<P>PASS: $count debug messages.</P>" >>$strfile
850 # Debug2 log messages
851 count
=`$GREP '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
852 if test $count = 0; then
853 echo "FAIL: $count debug2 messages, expected more than 0."
854 echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile
855 fail
=`expr $fail + 1`
857 echo "PASS: $count debug2 messages."
858 echo "<P>PASS: $count debug2 messages.</P>" >>$strfile
862 echo "<H2>access_log</H2>" >>$strfile
863 echo "<PRE>" >>$strfile
864 sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp
/cups-
$user/log
/access_log
>>$strfile
865 echo "</PRE>" >>$strfile
867 echo "<H2>error_log</H2>" >>$strfile
868 echo "<PRE>" >>$strfile
869 $GREP -v '^d' /tmp
/cups-
$user/log
/error_log |
sed -e '1,$s/&/&/g' -e '1,$s/</</g' >>$strfile
870 echo "</PRE>" >>$strfile
872 echo "<H2>page_log</H2>" >>$strfile
873 echo "<PRE>" >>$strfile
874 sed -e '1,$s/&/&/g' -e '1,$s/</</g' /tmp
/cups-
$user/log
/page_log
>>$strfile
875 echo "</PRE>" >>$strfile
878 # Format the reports and tell the user where to find them...
881 cat str-trailer.html
>>$strfile
885 if test $fail != 0; then
886 echo "$fail tests failed."
887 cp /tmp
/cups-
$user/log
/error_log error_log-
$date-$user
890 echo "All tests were successful."
893 echo "Log files can be found in /tmp/cups-$user/log."
894 echo "A HTML report was created in $strfile."
897 if test $fail != 0; then
898 echo "Copies of the error_log and `basename $strfile` files are in"
906 # End of "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $"