]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - test/run-stp-tests.sh
Merge changes from CUPS 1.4svn-r8177 (tentative CUPS 1.4b2)
[thirdparty/cups.git] / test / run-stp-tests.sh
index 364e31b80594744e66917d5036957c67876bdfa8..0123470fb7725b6d4a4d57eaf1801d0da43418c2 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# "$Id: run-stp-tests.sh 6649 2007-07-11 21:46:42Z mike $"
+# "$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.
@@ -213,6 +213,14 @@ mkdir /tmp/cups-$user/certs
 mkdir /tmp/cups-$user/share
 mkdir /tmp/cups-$user/share/banners
 mkdir /tmp/cups-$user/share/drv
+mkdir /tmp/cups-$user/share/locale
+for file in ../locale/cups_*.po; do
+       loc=`basename $file .po | cut -c 6-`
+       mkdir /tmp/cups-$user/share/locale/$loc
+       ln -s $root/locale/cups_$loc.po /tmp/cups-$user/share/locale/$loc
+       ln -s $root/locale/ppdc_$loc.po /tmp/cups-$user/share/locale/$loc
+done
+mkdir /tmp/cups-$user/share/mime
 mkdir /tmp/cups-$user/share/model
 mkdir /tmp/cups-$user/share/ppdc
 mkdir /tmp/cups-$user/interfaces
@@ -222,6 +230,7 @@ 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
@@ -232,10 +241,10 @@ ln -s $root/backend/snmp /tmp/cups-$user/bin/backend
 ln -s $root/backend/socket /tmp/cups-$user/bin/backend
 ln -s $root/backend/usb /tmp/cups-$user/bin/backend
 ln -s $root/cgi-bin /tmp/cups-$user/bin
-ln -s $root/ppdc/drv /tmp/cups-$user/bin/driver
 ln -s $root/monitor /tmp/cups-$user/bin
 ln -s $root/notifier /tmp/cups-$user/bin
 ln -s $root/scheduler /tmp/cups-$user/bin/daemon
+ln -s $root/filter/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
@@ -254,6 +263,8 @@ 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
@@ -276,7 +287,11 @@ if test `uname` = Darwin; then
        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 /private/etc/cups/apple.* /tmp/cups-$user
+       if test -f /private/etc/cups/apple.types; then
+               ln -s /private/etc/cups/apple.* /tmp/cups-$user/share/mime
+       elif test -f /usr/share/cups/mime/apple.types; then
+               ln -s /usr/share/cups/mime/apple.* /tmp/cups-$user/share/mime
+       fi
 else
        ln -s $root/filter/imagetops /tmp/cups-$user/bin/filter
        ln -s $root/filter/imagetoraster /tmp/cups-$user/bin/filter
@@ -307,9 +322,11 @@ ServerBin /tmp/cups-$user/bin
 CacheDir /tmp/cups-$user/share
 DataDir /tmp/cups-$user/share
 FontPath /tmp/cups-$user/share/fonts
+PassEnv LOCALEDIR
 DocumentRoot $root/doc
 RequestRoot /tmp/cups-$user/spool
 TempDir /tmp/cups-$user/spool/temp
+MaxSubscriptions 3
 MaxLogSize 0
 AccessLog /tmp/cups-$user/log/access_log
 ErrorLog /tmp/cups-$user/log/error_log
@@ -326,11 +343,8 @@ $encryption
 </Policy>
 EOF
 
-touch /tmp/cups-$user/classes.conf
-touch /tmp/cups-$user/printers.conf
-
 #
-# Setup lots of test queues - 500 with PPD files, 500 without...
+# Setup lots of test queues - half with PPD files, half without...
 #
 
 echo "Creating printers.conf for test..."
@@ -370,10 +384,11 @@ EOF
        i=`expr $i + 1`
 done
 
-cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig
-
-cp $root/conf/mime.types /tmp/cups-$user/mime.types
-cp $root/conf/mime.convs /tmp/cups-$user/mime.convs
+if test -f /tmp/cups-$user/printers.conf; then
+       cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig
+else
+       touch /tmp/cups-$user/printers.conf.orig
+fi
 
 #
 # Setup the paths...
@@ -408,10 +423,11 @@ fi
 
 export SHLIB_PATH
 
-CUPS_SERVER=localhost; export CUPS_SERVER
+CUPS_SERVER=localhost:8631; export CUPS_SERVER
 CUPS_SERVERROOT=/tmp/cups-$user; export CUPS_SERVERROOT
 CUPS_STATEDIR=/tmp/cups-$user; export CUPS_STATEDIR
 CUPS_DATADIR=/tmp/cups-$user/share; export CUPS_DATADIR
+LOCALEDIR=/tmp/cups-$user/share/locale; export LOCALEDIR
 
 #
 # Set a new home directory to avoid getting user options mixed in...
@@ -439,10 +455,34 @@ $valgrind ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/l
 cupsd=$!
 
 if test "x$testtype" = x0; then
+       # Not running tests...
        echo "Scheduler is PID $cupsd and is listening on port 8631."
        echo ""
-       echo "Set the IPP_PORT environment variable to 8631 to test the software"
-       echo "interactively from the command-line."
+
+       # Create a helper script to run programs with...
+       runcups="/tmp/cups-$user/runcups"
+
+       echo "#!/bin/sh" >$runcups
+       echo "# Helper script for running CUPS test instance." >>$runcups
+       echo "" >>$runcups
+       echo "# Set required environment variables..." >>$runcups
+       echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups
+       echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups
+       echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups
+       echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups
+       echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups
+       echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups
+       echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups
+       echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups
+       echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups
+       echo "" >>$runcups
+       echo "# Run command..." >>$runcups
+       echo "exec \"\$@\"" >>$runcups
+
+       chmod +x $runcups
+
+       echo "The $runcups helper script can be used to test programs"
+       echo "with the server."
        exit 0
 fi
 
@@ -472,7 +512,8 @@ done
 # Create the test report source file...
 #
 
-strfile=/tmp/cups-$user/cups-str-1.4-`date +%Y-%m-%d`-$user.html
+date=`date "+%Y-%m-%d"`
+strfile=/tmp/cups-$user/cups-str-1.4-$date-$user.html
 
 rm -f $strfile
 cat str-header.html >$strfile
@@ -516,7 +557,7 @@ echo "Running command tests..."
 echo "<H1>2 - Command Tests</H1>" >>$strfile
 echo "<P>This section provides the results to the command tests" >>$strfile
 echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
-echo `date "+%Y-%m-%d"` by $user on `hostname`. >>$strfile
+echo $date by $user on `hostname`. >>$strfile
 echo "<PRE>" >>$strfile
 
 for file in 5*.sh; do
@@ -632,10 +673,10 @@ fi
 
 # Error log messages
 count=`grep '^E ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
-if test $count != 9; then
-       echo "FAIL: $count error messages, expected 9."
+if test $count != 17; then
+       echo "FAIL: $count error messages, expected 17."
        grep '^E ' /tmp/cups-$user/log/error_log
-       echo "<P>FAIL: $count error messages, expected 9.</P>" >>$strfile
+       echo "<P>FAIL: $count error messages, expected 17.</P>" >>$strfile
        echo "<PRE>" >>$strfile
        grep '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
        echo "</PRE>" >>$strfile
@@ -708,6 +749,16 @@ else
        echo "<P>PASS: $count debug2 messages.</P>" >>$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 "<P>PASS: page_log formatted correctly.</P>" >>$strfile
+else
+       echo "FAIL: page_log formatted incorrectly."
+       echo "<P>FAIL: page_log formatted incorrectly.</P>" >>$strfile
+       fail=`expr $fail + 1`
+fi
+
 # Log files...
 echo "<H2>access_log</H2>" >>$strfile
 echo "<PRE>" >>$strfile
@@ -734,6 +785,8 @@ echo ""
 
 if test $fail != 0; then
        echo "$fail tests failed."
+       cp /tmp/cups-$user/log/error_log error_log-$date-$user
+       cp $strfile .
 else
        echo "All tests were successful."
 fi
@@ -743,9 +796,13 @@ echo "A HTML report was created in $strfile."
 echo ""
 
 if test $fail != 0; then
+       echo "Copies of the error_log and `basename $strfile` files are in"
+       echo "`pwd`."
+       echo ""
+
        exit 1
 fi
 
 #
-# End of "$Id: run-stp-tests.sh 6649 2007-07-11 21:46:42Z mike $"
+# End of "$Id: run-stp-tests.sh 7954 2008-09-17 05:23:09Z mike $"
 #