xref: /aosp_15_r20/external/libcups/test/run-stp-tests.sh (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1*5e7646d2SAndroid Build Coastguard Worker#!/bin/sh
2*5e7646d2SAndroid Build Coastguard Worker#
3*5e7646d2SAndroid Build Coastguard Worker# Perform the complete set of IPP compliance tests specified in the
4*5e7646d2SAndroid Build Coastguard Worker# CUPS Software Test Plan.
5*5e7646d2SAndroid Build Coastguard Worker#
6*5e7646d2SAndroid Build Coastguard Worker# Copyright © 2007-2021 by Apple Inc.
7*5e7646d2SAndroid Build Coastguard Worker# Copyright © 1997-2007 by Easy Software Products, all rights reserved.
8*5e7646d2SAndroid Build Coastguard Worker#
9*5e7646d2SAndroid Build Coastguard Worker# Licensed under Apache License v2.0.  See the file "LICENSE" for more
10*5e7646d2SAndroid Build Coastguard Worker# information.
11*5e7646d2SAndroid Build Coastguard Worker#
12*5e7646d2SAndroid Build Coastguard Worker
13*5e7646d2SAndroid Build Coastguard Workerargcount=$#
14*5e7646d2SAndroid Build Coastguard Worker
15*5e7646d2SAndroid Build Coastguard Worker#
16*5e7646d2SAndroid Build Coastguard Worker# Don't allow "make check" or "make test" to be run by root...
17*5e7646d2SAndroid Build Coastguard Worker#
18*5e7646d2SAndroid Build Coastguard Worker
19*5e7646d2SAndroid Build Coastguard Workerif test "x`id -u`" = x0; then
20*5e7646d2SAndroid Build Coastguard Worker	echo Please run this as a normal user. Not supported when run as root.
21*5e7646d2SAndroid Build Coastguard Worker	exit 1
22*5e7646d2SAndroid Build Coastguard Workerfi
23*5e7646d2SAndroid Build Coastguard Worker
24*5e7646d2SAndroid Build Coastguard Worker#
25*5e7646d2SAndroid Build Coastguard Worker# Force the permissions of the files we create...
26*5e7646d2SAndroid Build Coastguard Worker#
27*5e7646d2SAndroid Build Coastguard Worker
28*5e7646d2SAndroid Build Coastguard Workerumask 022
29*5e7646d2SAndroid Build Coastguard Worker
30*5e7646d2SAndroid Build Coastguard Worker#
31*5e7646d2SAndroid Build Coastguard Worker# Make the IPP test program...
32*5e7646d2SAndroid Build Coastguard Worker#
33*5e7646d2SAndroid Build Coastguard Worker
34*5e7646d2SAndroid Build Coastguard Workermake
35*5e7646d2SAndroid Build Coastguard Worker
36*5e7646d2SAndroid Build Coastguard Worker#
37*5e7646d2SAndroid Build Coastguard Worker# Solaris has a non-POSIX grep in /bin...
38*5e7646d2SAndroid Build Coastguard Worker#
39*5e7646d2SAndroid Build Coastguard Worker
40*5e7646d2SAndroid Build Coastguard Workerif test -x /usr/xpg4/bin/grep; then
41*5e7646d2SAndroid Build Coastguard Worker	GREP=/usr/xpg4/bin/grep
42*5e7646d2SAndroid Build Coastguard Workerelse
43*5e7646d2SAndroid Build Coastguard Worker	GREP=grep
44*5e7646d2SAndroid Build Coastguard Workerfi
45*5e7646d2SAndroid Build Coastguard Worker
46*5e7646d2SAndroid Build Coastguard Worker#
47*5e7646d2SAndroid Build Coastguard Worker# Figure out the proper echo options...
48*5e7646d2SAndroid Build Coastguard Worker#
49*5e7646d2SAndroid Build Coastguard Worker
50*5e7646d2SAndroid Build Coastguard Workerif (echo "testing\c"; echo 1,2,3) | $GREP c >/dev/null; then
51*5e7646d2SAndroid Build Coastguard Worker        ac_n=-n
52*5e7646d2SAndroid Build Coastguard Worker        ac_c=
53*5e7646d2SAndroid Build Coastguard Workerelse
54*5e7646d2SAndroid Build Coastguard Worker        ac_n=
55*5e7646d2SAndroid Build Coastguard Worker        ac_c='\c'
56*5e7646d2SAndroid Build Coastguard Workerfi
57*5e7646d2SAndroid Build Coastguard Worker
58*5e7646d2SAndroid Build Coastguard Worker#
59*5e7646d2SAndroid Build Coastguard Worker# Greet the tester...
60*5e7646d2SAndroid Build Coastguard Worker#
61*5e7646d2SAndroid Build Coastguard Worker
62*5e7646d2SAndroid Build Coastguard Workerecho "Welcome to the CUPS Automated Test Script."
63*5e7646d2SAndroid Build Coastguard Workerecho ""
64*5e7646d2SAndroid Build Coastguard Workerecho "Before we begin, it is important that you understand that the larger"
65*5e7646d2SAndroid Build Coastguard Workerecho "tests require significant amounts of RAM and disk space.  If you"
66*5e7646d2SAndroid Build Coastguard Workerecho "attempt to run one of the big tests on a system that lacks sufficient"
67*5e7646d2SAndroid Build Coastguard Workerecho "disk and virtual memory, the UNIX kernel might decide to kill one or"
68*5e7646d2SAndroid Build Coastguard Workerecho "more system processes that you've grown attached to, like the X"
69*5e7646d2SAndroid Build Coastguard Workerecho "server.  The question you may want to ask yourself before running a"
70*5e7646d2SAndroid Build Coastguard Workerecho "large test is: Do you feel lucky?"
71*5e7646d2SAndroid Build Coastguard Workerecho ""
72*5e7646d2SAndroid Build Coastguard Workerecho "OK, now that we have the Dirty Harry quote out of the way, please"
73*5e7646d2SAndroid Build Coastguard Workerecho "choose the type of test you wish to perform:"
74*5e7646d2SAndroid Build Coastguard Workerecho ""
75*5e7646d2SAndroid Build Coastguard Workerecho "0 - No testing, keep the scheduler running for me (all systems)"
76*5e7646d2SAndroid Build Coastguard Workerecho "1 - Basic conformance test, no load testing (all systems)"
77*5e7646d2SAndroid Build Coastguard Workerecho "2 - Basic conformance test, some load testing (minimum 256MB VM, 50MB disk)"
78*5e7646d2SAndroid Build Coastguard Workerecho "3 - Basic conformance test, extreme load testing (minimum 1GB VM, 500MB disk)"
79*5e7646d2SAndroid Build Coastguard Workerecho "4 - Basic conformance test, torture load testing (minimum 2GB VM, 1GB disk)"
80*5e7646d2SAndroid Build Coastguard Workerecho ""
81*5e7646d2SAndroid Build Coastguard Workerecho $ac_n "Enter the number of the test you wish to perform: [1] $ac_c"
82*5e7646d2SAndroid Build Coastguard Worker
83*5e7646d2SAndroid Build Coastguard Workerif test $# -gt 0; then
84*5e7646d2SAndroid Build Coastguard Worker	testtype=$1
85*5e7646d2SAndroid Build Coastguard Worker	shift
86*5e7646d2SAndroid Build Coastguard Workerelse
87*5e7646d2SAndroid Build Coastguard Worker	read testtype
88*5e7646d2SAndroid Build Coastguard Workerfi
89*5e7646d2SAndroid Build Coastguard Workerecho ""
90*5e7646d2SAndroid Build Coastguard Worker
91*5e7646d2SAndroid Build Coastguard Workercase "$testtype" in
92*5e7646d2SAndroid Build Coastguard Worker	0)
93*5e7646d2SAndroid Build Coastguard Worker		echo "Running in test mode (0)"
94*5e7646d2SAndroid Build Coastguard Worker		nprinters=0
95*5e7646d2SAndroid Build Coastguard Worker		pjobs=0
96*5e7646d2SAndroid Build Coastguard Worker		pprinters=0
97*5e7646d2SAndroid Build Coastguard Worker		loglevel="debug2"
98*5e7646d2SAndroid Build Coastguard Worker		;;
99*5e7646d2SAndroid Build Coastguard Worker	2)
100*5e7646d2SAndroid Build Coastguard Worker		echo "Running the medium tests (2)"
101*5e7646d2SAndroid Build Coastguard Worker		nprinters=20
102*5e7646d2SAndroid Build Coastguard Worker		pjobs=20
103*5e7646d2SAndroid Build Coastguard Worker		pprinters=10
104*5e7646d2SAndroid Build Coastguard Worker		loglevel="debug"
105*5e7646d2SAndroid Build Coastguard Worker		;;
106*5e7646d2SAndroid Build Coastguard Worker	3)
107*5e7646d2SAndroid Build Coastguard Worker		echo "Running the extreme tests (3)"
108*5e7646d2SAndroid Build Coastguard Worker		nprinters=1000
109*5e7646d2SAndroid Build Coastguard Worker		pjobs=100
110*5e7646d2SAndroid Build Coastguard Worker		pprinters=50
111*5e7646d2SAndroid Build Coastguard Worker		loglevel="debug"
112*5e7646d2SAndroid Build Coastguard Worker		;;
113*5e7646d2SAndroid Build Coastguard Worker	4)
114*5e7646d2SAndroid Build Coastguard Worker		echo "Running the torture tests (4)"
115*5e7646d2SAndroid Build Coastguard Worker		nprinters=20000
116*5e7646d2SAndroid Build Coastguard Worker		pjobs=200
117*5e7646d2SAndroid Build Coastguard Worker		pprinters=100
118*5e7646d2SAndroid Build Coastguard Worker		loglevel="debug"
119*5e7646d2SAndroid Build Coastguard Worker		;;
120*5e7646d2SAndroid Build Coastguard Worker	*)
121*5e7646d2SAndroid Build Coastguard Worker		echo "Running the timid tests (1)"
122*5e7646d2SAndroid Build Coastguard Worker		nprinters=0
123*5e7646d2SAndroid Build Coastguard Worker		pjobs=10
124*5e7646d2SAndroid Build Coastguard Worker		pprinters=0
125*5e7646d2SAndroid Build Coastguard Worker		loglevel="debug2"
126*5e7646d2SAndroid Build Coastguard Worker		testtype="1"
127*5e7646d2SAndroid Build Coastguard Worker		;;
128*5e7646d2SAndroid Build Coastguard Workeresac
129*5e7646d2SAndroid Build Coastguard Worker
130*5e7646d2SAndroid Build Coastguard Worker#
131*5e7646d2SAndroid Build Coastguard Worker# See if we want to do SSL testing...
132*5e7646d2SAndroid Build Coastguard Worker#
133*5e7646d2SAndroid Build Coastguard Worker
134*5e7646d2SAndroid Build Coastguard Workerecho ""
135*5e7646d2SAndroid Build Coastguard Workerecho "Now you can choose whether to create a SSL/TLS encryption key and"
136*5e7646d2SAndroid Build Coastguard Workerecho "certificate for testing:"
137*5e7646d2SAndroid Build Coastguard Workerecho ""
138*5e7646d2SAndroid Build Coastguard Workerecho "0 - Do not do SSL/TLS encryption tests"
139*5e7646d2SAndroid Build Coastguard Workerecho "1 - Test but do not require encryption"
140*5e7646d2SAndroid Build Coastguard Workerecho "2 - Test and require encryption"
141*5e7646d2SAndroid Build Coastguard Workerecho ""
142*5e7646d2SAndroid Build Coastguard Workerecho $ac_n "Enter the number of the SSL/TLS tests to perform: [0] $ac_c"
143*5e7646d2SAndroid Build Coastguard Worker
144*5e7646d2SAndroid Build Coastguard Workerif test $# -gt 0; then
145*5e7646d2SAndroid Build Coastguard Worker	ssltype=$1
146*5e7646d2SAndroid Build Coastguard Worker	shift
147*5e7646d2SAndroid Build Coastguard Workerelse
148*5e7646d2SAndroid Build Coastguard Worker	read ssltype
149*5e7646d2SAndroid Build Coastguard Workerfi
150*5e7646d2SAndroid Build Coastguard Workerecho ""
151*5e7646d2SAndroid Build Coastguard Worker
152*5e7646d2SAndroid Build Coastguard Workercase "$ssltype" in
153*5e7646d2SAndroid Build Coastguard Worker	1)
154*5e7646d2SAndroid Build Coastguard Worker		echo "Will test but not require encryption (1)"
155*5e7646d2SAndroid Build Coastguard Worker		;;
156*5e7646d2SAndroid Build Coastguard Worker	2)
157*5e7646d2SAndroid Build Coastguard Worker		echo "Will test and require encryption (2)"
158*5e7646d2SAndroid Build Coastguard Worker		;;
159*5e7646d2SAndroid Build Coastguard Worker	*)
160*5e7646d2SAndroid Build Coastguard Worker		echo "Not using SSL/TLS (0)"
161*5e7646d2SAndroid Build Coastguard Worker		ssltype=0
162*5e7646d2SAndroid Build Coastguard Worker		;;
163*5e7646d2SAndroid Build Coastguard Workeresac
164*5e7646d2SAndroid Build Coastguard Worker
165*5e7646d2SAndroid Build Coastguard Worker#
166*5e7646d2SAndroid Build Coastguard Worker# Information for the server/tests...
167*5e7646d2SAndroid Build Coastguard Worker#
168*5e7646d2SAndroid Build Coastguard Worker
169*5e7646d2SAndroid Build Coastguard Workeruser="$USER"
170*5e7646d2SAndroid Build Coastguard Workerif test -z "$user"; then
171*5e7646d2SAndroid Build Coastguard Worker	if test -x /usr/ucb/whoami; then
172*5e7646d2SAndroid Build Coastguard Worker		user=`/usr/ucb/whoami`
173*5e7646d2SAndroid Build Coastguard Worker	else
174*5e7646d2SAndroid Build Coastguard Worker		user=`whoami`
175*5e7646d2SAndroid Build Coastguard Worker	fi
176*5e7646d2SAndroid Build Coastguard Worker
177*5e7646d2SAndroid Build Coastguard Worker	if test -z "$user"; then
178*5e7646d2SAndroid Build Coastguard Worker		user="unknown"
179*5e7646d2SAndroid Build Coastguard Worker	fi
180*5e7646d2SAndroid Build Coastguard Workerfi
181*5e7646d2SAndroid Build Coastguard Worker
182*5e7646d2SAndroid Build Coastguard Workerport="${CUPS_TESTPORT:=8631}"
183*5e7646d2SAndroid Build Coastguard Workercwd=`pwd`
184*5e7646d2SAndroid Build Coastguard Workerroot=`dirname $cwd`
185*5e7646d2SAndroid Build Coastguard WorkerCUPS_TESTROOT="$root"; export CUPS_TESTROOT
186*5e7646d2SAndroid Build Coastguard Worker
187*5e7646d2SAndroid Build Coastguard WorkerBASE="${CUPS_TESTBASE:=}"
188*5e7646d2SAndroid Build Coastguard Workerif test -z "$BASE"; then
189*5e7646d2SAndroid Build Coastguard Worker	if test -d /private/tmp; then
190*5e7646d2SAndroid Build Coastguard Worker		BASE=/private/tmp/cups-$user
191*5e7646d2SAndroid Build Coastguard Worker	else
192*5e7646d2SAndroid Build Coastguard Worker		BASE=/tmp/cups-$user
193*5e7646d2SAndroid Build Coastguard Worker	fi
194*5e7646d2SAndroid Build Coastguard Workerfi
195*5e7646d2SAndroid Build Coastguard Workerexport BASE
196*5e7646d2SAndroid Build Coastguard Worker
197*5e7646d2SAndroid Build Coastguard Worker#
198*5e7646d2SAndroid Build Coastguard Worker# Make sure that the LPDEST and PRINTER environment variables are
199*5e7646d2SAndroid Build Coastguard Worker# not included in the environment that is passed to the tests.  These
200*5e7646d2SAndroid Build Coastguard Worker# will usually cause tests to fail erroneously...
201*5e7646d2SAndroid Build Coastguard Worker#
202*5e7646d2SAndroid Build Coastguard Worker
203*5e7646d2SAndroid Build Coastguard Workerunset LPDEST
204*5e7646d2SAndroid Build Coastguard Workerunset PRINTER
205*5e7646d2SAndroid Build Coastguard Worker
206*5e7646d2SAndroid Build Coastguard Worker#
207*5e7646d2SAndroid Build Coastguard Worker# See if we want to use valgrind...
208*5e7646d2SAndroid Build Coastguard Worker#
209*5e7646d2SAndroid Build Coastguard Worker
210*5e7646d2SAndroid Build Coastguard Workerecho ""
211*5e7646d2SAndroid Build Coastguard Workerecho "This test script can use the Valgrind software from:"
212*5e7646d2SAndroid Build Coastguard Workerecho ""
213*5e7646d2SAndroid Build Coastguard Workerecho "    http://developer.kde.org/~sewardj/"
214*5e7646d2SAndroid Build Coastguard Workerecho ""
215*5e7646d2SAndroid Build Coastguard Workerecho $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c"
216*5e7646d2SAndroid Build Coastguard Worker
217*5e7646d2SAndroid Build Coastguard Workerif test $# -gt 0; then
218*5e7646d2SAndroid Build Coastguard Worker	usevalgrind=$1
219*5e7646d2SAndroid Build Coastguard Worker	shift
220*5e7646d2SAndroid Build Coastguard Workerelse
221*5e7646d2SAndroid Build Coastguard Worker	read usevalgrind
222*5e7646d2SAndroid Build Coastguard Workerfi
223*5e7646d2SAndroid Build Coastguard Workerecho ""
224*5e7646d2SAndroid Build Coastguard Worker
225*5e7646d2SAndroid Build Coastguard Workercase "$usevalgrind" in
226*5e7646d2SAndroid Build Coastguard Worker	Y* | y*)
227*5e7646d2SAndroid Build Coastguard Worker		VALGRIND="valgrind --tool=memcheck --log-file=$BASE/log/valgrind.%p --error-limit=no --leak-check=yes --trace-children=yes"
228*5e7646d2SAndroid Build Coastguard Worker		if test `uname` = Darwin; then
229*5e7646d2SAndroid Build Coastguard Worker			VALGRIND="$VALGRIND --dsymutil=yes"
230*5e7646d2SAndroid Build Coastguard Worker		fi
231*5e7646d2SAndroid Build Coastguard Worker		export VALGRIND
232*5e7646d2SAndroid Build Coastguard Worker		echo "Using Valgrind; log files can be found in $BASE/log..."
233*5e7646d2SAndroid Build Coastguard Worker		;;
234*5e7646d2SAndroid Build Coastguard Worker
235*5e7646d2SAndroid Build Coastguard Worker	*)
236*5e7646d2SAndroid Build Coastguard Worker		VALGRIND=""
237*5e7646d2SAndroid Build Coastguard Worker		export VALGRIND
238*5e7646d2SAndroid Build Coastguard Worker		;;
239*5e7646d2SAndroid Build Coastguard Workeresac
240*5e7646d2SAndroid Build Coastguard Worker
241*5e7646d2SAndroid Build Coastguard Worker#
242*5e7646d2SAndroid Build Coastguard Worker# See if we want to do debug logging of the libraries...
243*5e7646d2SAndroid Build Coastguard Worker#
244*5e7646d2SAndroid Build Coastguard Worker
245*5e7646d2SAndroid Build Coastguard Workerecho ""
246*5e7646d2SAndroid Build Coastguard Workerecho "If CUPS was built with the --enable-debug-printfs configure option, you"
247*5e7646d2SAndroid Build Coastguard Workerecho "can enable debug logging of the libraries."
248*5e7646d2SAndroid Build Coastguard Workerecho ""
249*5e7646d2SAndroid Build Coastguard Workerecho $ac_n "Enter Y or a number from 0 to 9 to enable debug logging or N to not: [N] $ac_c"
250*5e7646d2SAndroid Build Coastguard Worker
251*5e7646d2SAndroid Build Coastguard Workerif test $# -gt 0; then
252*5e7646d2SAndroid Build Coastguard Worker	usedebugprintfs=$1
253*5e7646d2SAndroid Build Coastguard Worker	shift
254*5e7646d2SAndroid Build Coastguard Workerelse
255*5e7646d2SAndroid Build Coastguard Worker	read usedebugprintfs
256*5e7646d2SAndroid Build Coastguard Workerfi
257*5e7646d2SAndroid Build Coastguard Workerecho ""
258*5e7646d2SAndroid Build Coastguard Worker
259*5e7646d2SAndroid Build Coastguard Workercase "$usedebugprintfs" in
260*5e7646d2SAndroid Build Coastguard Worker	Y* | y*)
261*5e7646d2SAndroid Build Coastguard Worker		echo "Enabling debug printfs (level 5); log files can be found in $BASE/log..."
262*5e7646d2SAndroid Build Coastguard Worker		CUPS_DEBUG_LOG="$BASE/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
263*5e7646d2SAndroid Build Coastguard Worker		CUPS_DEBUG_LEVEL=5; export CUPS_DEBUG_LEVEL
264*5e7646d2SAndroid Build Coastguard Worker		CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
265*5e7646d2SAndroid Build Coastguard Worker		;;
266*5e7646d2SAndroid Build Coastguard Worker
267*5e7646d2SAndroid Build Coastguard Worker	0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)
268*5e7646d2SAndroid Build Coastguard Worker		echo "Enabling debug printfs (level $usedebugprintfs); log files can be found in $BASE/log..."
269*5e7646d2SAndroid Build Coastguard Worker		CUPS_DEBUG_LOG="$BASE/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
270*5e7646d2SAndroid Build Coastguard Worker		CUPS_DEBUG_LEVEL="$usedebugprintfs"; export CUPS_DEBUG_LEVEL
271*5e7646d2SAndroid Build Coastguard Worker		CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend|mime).*$'; export CUPS_DEBUG_FILTER
272*5e7646d2SAndroid Build Coastguard Worker		;;
273*5e7646d2SAndroid Build Coastguard Worker
274*5e7646d2SAndroid Build Coastguard Worker	*)
275*5e7646d2SAndroid Build Coastguard Worker		;;
276*5e7646d2SAndroid Build Coastguard Workeresac
277*5e7646d2SAndroid Build Coastguard Worker
278*5e7646d2SAndroid Build Coastguard Worker#
279*5e7646d2SAndroid Build Coastguard Worker# Start by creating temporary directories for the tests...
280*5e7646d2SAndroid Build Coastguard Worker#
281*5e7646d2SAndroid Build Coastguard Worker
282*5e7646d2SAndroid Build Coastguard Workerecho "Creating directories for test..."
283*5e7646d2SAndroid Build Coastguard Worker
284*5e7646d2SAndroid Build Coastguard Workerrm -rf $BASE
285*5e7646d2SAndroid Build Coastguard Workermkdir $BASE
286*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/bin
287*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/bin/backend
288*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/bin/driver
289*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/bin/filter
290*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/certs
291*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/share
292*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/share/banners
293*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/share/drv
294*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/share/locale
295*5e7646d2SAndroid Build Coastguard Workerfor file in ../locale/cups_*.po; do
296*5e7646d2SAndroid Build Coastguard Worker	loc=`basename $file .po | cut -c 6-`
297*5e7646d2SAndroid Build Coastguard Worker	mkdir $BASE/share/locale/$loc
298*5e7646d2SAndroid Build Coastguard Worker	ln -s $root/locale/cups_$loc.po $BASE/share/locale/$loc
299*5e7646d2SAndroid Build Coastguard Workerdone
300*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/share/locale/en
301*5e7646d2SAndroid Build Coastguard Workerln -s $root/locale/cups.pot $BASE/share/locale/en/cups_en.po
302*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/share/mime
303*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/share/model
304*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/share/ppdc
305*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/interfaces
306*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/log
307*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/ppd
308*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/spool
309*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/spool/temp
310*5e7646d2SAndroid Build Coastguard Workermkdir $BASE/ssl
311*5e7646d2SAndroid Build Coastguard Worker
312*5e7646d2SAndroid Build Coastguard Workerln -s $root/backend/dnssd $BASE/bin/backend
313*5e7646d2SAndroid Build Coastguard Workerln -s $root/backend/http $BASE/bin/backend
314*5e7646d2SAndroid Build Coastguard Workerln -s $root/backend/ipp $BASE/bin/backend
315*5e7646d2SAndroid Build Coastguard Workerln -s ipp $BASE/bin/backend/ipps
316*5e7646d2SAndroid Build Coastguard Workerln -s $root/backend/lpd $BASE/bin/backend
317*5e7646d2SAndroid Build Coastguard Workerln -s $root/backend/mdns $BASE/bin/backend
318*5e7646d2SAndroid Build Coastguard Workerln -s $root/backend/pseudo $BASE/bin/backend
319*5e7646d2SAndroid Build Coastguard Workerln -s $root/backend/snmp $BASE/bin/backend
320*5e7646d2SAndroid Build Coastguard Workerln -s $root/backend/socket $BASE/bin/backend
321*5e7646d2SAndroid Build Coastguard Workerln -s $root/backend/usb $BASE/bin/backend
322*5e7646d2SAndroid Build Coastguard Workerln -s $root/cgi-bin $BASE/bin
323*5e7646d2SAndroid Build Coastguard Workerln -s $root/monitor $BASE/bin
324*5e7646d2SAndroid Build Coastguard Workerln -s $root/notifier $BASE/bin
325*5e7646d2SAndroid Build Coastguard Workerln -s $root/scheduler $BASE/bin/daemon
326*5e7646d2SAndroid Build Coastguard Workerln -s $root/filter/commandtops $BASE/bin/filter
327*5e7646d2SAndroid Build Coastguard Workerln -s $root/filter/gziptoany $BASE/bin/filter
328*5e7646d2SAndroid Build Coastguard Workerln -s $root/filter/pstops $BASE/bin/filter
329*5e7646d2SAndroid Build Coastguard Workerln -s $root/filter/rastertoepson $BASE/bin/filter
330*5e7646d2SAndroid Build Coastguard Workerln -s $root/filter/rastertohp $BASE/bin/filter
331*5e7646d2SAndroid Build Coastguard Workerln -s $root/filter/rastertolabel $BASE/bin/filter
332*5e7646d2SAndroid Build Coastguard Workerln -s $root/filter/rastertopwg $BASE/bin/filter
333*5e7646d2SAndroid Build Coastguard Workercat >$BASE/share/banners/standard <<EOF
334*5e7646d2SAndroid Build Coastguard Worker           ==== Cover Page ====
335*5e7646d2SAndroid Build Coastguard Worker
336*5e7646d2SAndroid Build Coastguard Worker
337*5e7646d2SAndroid Build Coastguard Worker      Job: {?printer-name}-{?job-id}
338*5e7646d2SAndroid Build Coastguard Worker    Owner: {?job-originating-user-name}
339*5e7646d2SAndroid Build Coastguard Worker     Name: {?job-name}
340*5e7646d2SAndroid Build Coastguard Worker    Pages: {?job-impressions}
341*5e7646d2SAndroid Build Coastguard Worker
342*5e7646d2SAndroid Build Coastguard Worker
343*5e7646d2SAndroid Build Coastguard Worker           ==== Cover Page ====
344*5e7646d2SAndroid Build Coastguard WorkerEOF
345*5e7646d2SAndroid Build Coastguard Workercat >$BASE/share/banners/classified <<EOF
346*5e7646d2SAndroid Build Coastguard Worker           ==== Classified - Do Not Disclose ====
347*5e7646d2SAndroid Build Coastguard Worker
348*5e7646d2SAndroid Build Coastguard Worker
349*5e7646d2SAndroid Build Coastguard Worker      Job: {?printer-name}-{?job-id}
350*5e7646d2SAndroid Build Coastguard Worker    Owner: {?job-originating-user-name}
351*5e7646d2SAndroid Build Coastguard Worker     Name: {?job-name}
352*5e7646d2SAndroid Build Coastguard Worker    Pages: {?job-impressions}
353*5e7646d2SAndroid Build Coastguard Worker
354*5e7646d2SAndroid Build Coastguard Worker
355*5e7646d2SAndroid Build Coastguard Worker           ==== Classified - Do Not Disclose ====
356*5e7646d2SAndroid Build Coastguard WorkerEOF
357*5e7646d2SAndroid Build Coastguard Workerln -s $root/data $BASE/share
358*5e7646d2SAndroid Build Coastguard Workerln -s $root/ppdc/sample.drv $BASE/share/drv
359*5e7646d2SAndroid Build Coastguard Workerln -s $root/conf/cgi.types $BASE/share/mime
360*5e7646d2SAndroid Build Coastguard Workerln -s $root/conf/mime.types $BASE/share/mime
361*5e7646d2SAndroid Build Coastguard Workerln -s $root/conf/mime.convs $BASE/share/mime
362*5e7646d2SAndroid Build Coastguard Workerln -s $root/data/*.h $BASE/share/ppdc
363*5e7646d2SAndroid Build Coastguard Workerln -s $root/data/*.defs $BASE/share/ppdc
364*5e7646d2SAndroid Build Coastguard Workerln -s $root/templates $BASE/share
365*5e7646d2SAndroid Build Coastguard Worker
366*5e7646d2SAndroid Build Coastguard Worker#
367*5e7646d2SAndroid Build Coastguard Worker# Local filters and configuration files...
368*5e7646d2SAndroid Build Coastguard Worker#
369*5e7646d2SAndroid Build Coastguard Worker
370*5e7646d2SAndroid Build Coastguard Workerinstfilter() {
371*5e7646d2SAndroid Build Coastguard Worker	# instfilter src dst format
372*5e7646d2SAndroid Build Coastguard Worker	#
373*5e7646d2SAndroid Build Coastguard Worker	# See if the filter exists in a standard location; if so, make a
374*5e7646d2SAndroid Build Coastguard Worker	# symlink, otherwise create a dummy script for the specified format.
375*5e7646d2SAndroid Build Coastguard Worker	#
376*5e7646d2SAndroid Build Coastguard Worker	src="$1"
377*5e7646d2SAndroid Build Coastguard Worker	dst="$2"
378*5e7646d2SAndroid Build Coastguard Worker	format="$3"
379*5e7646d2SAndroid Build Coastguard Worker
380*5e7646d2SAndroid Build Coastguard Worker	for dir in /usr/local/libexec/cups/filter /usr/libexec/cups/filter /usr/lib/cups/filter; do
381*5e7646d2SAndroid Build Coastguard Worker		if test -x "$dir/$src"; then
382*5e7646d2SAndroid Build Coastguard Worker			ln -s "$dir/$src" "$BASE/bin/filter/$dst"
383*5e7646d2SAndroid Build Coastguard Worker			return
384*5e7646d2SAndroid Build Coastguard Worker		fi
385*5e7646d2SAndroid Build Coastguard Worker	done
386*5e7646d2SAndroid Build Coastguard Worker
387*5e7646d2SAndroid Build Coastguard Worker	# Source filter not present, create a dummy filter
388*5e7646d2SAndroid Build Coastguard Worker	case $format in
389*5e7646d2SAndroid Build Coastguard Worker		passthru)
390*5e7646d2SAndroid Build Coastguard Worker			ln -s gziptoany "$BASE/bin/filter/$dst"
391*5e7646d2SAndroid Build Coastguard Worker			;;
392*5e7646d2SAndroid Build Coastguard Worker		pdf)
393*5e7646d2SAndroid Build Coastguard Worker			cat >"$BASE/bin/filter/$dst" <<EOF
394*5e7646d2SAndroid Build Coastguard Worker#!/bin/sh
395*5e7646d2SAndroid Build Coastguard Workertrap "" TERM
396*5e7646d2SAndroid Build Coastguard Workertrap "" PIPE
397*5e7646d2SAndroid Build Coastguard Workergziptoany "$1" "$2" "$3" "$4" "$5" \$6 >/dev/null
398*5e7646d2SAndroid Build Coastguard Workercase "\$5" in
399*5e7646d2SAndroid Build Coastguard Worker	*media=a4* | *media=iso_a4* | *PageSize=A4*)
400*5e7646d2SAndroid Build Coastguard Worker		gziptoany "$1" "$2" "$3" "$4" "$5" "$root/examples/onepage-a4.pdf"
401*5e7646d2SAndroid Build Coastguard Worker		;;
402*5e7646d2SAndroid Build Coastguard Worker	*)
403*5e7646d2SAndroid Build Coastguard Worker		gziptoany "$1" "$2" "$3" "$4" "$5" "$root/examples/onepage-letter.pdf"
404*5e7646d2SAndroid Build Coastguard Worker		;;
405*5e7646d2SAndroid Build Coastguard Workeresac
406*5e7646d2SAndroid Build Coastguard WorkerEOF
407*5e7646d2SAndroid Build Coastguard Worker			chmod +x "$BASE/bin/filter/$dst"
408*5e7646d2SAndroid Build Coastguard Worker			;;
409*5e7646d2SAndroid Build Coastguard Worker		ps)
410*5e7646d2SAndroid Build Coastguard Worker			cat >"$BASE/bin/filter/$dst" <<EOF
411*5e7646d2SAndroid Build Coastguard Worker#!/bin/sh
412*5e7646d2SAndroid Build Coastguard Workertrap "" TERM
413*5e7646d2SAndroid Build Coastguard Workertrap "" PIPE
414*5e7646d2SAndroid Build Coastguard Workergziptoany "$1" "$2" "$3" "$4" "$5" \$6 >/dev/null
415*5e7646d2SAndroid Build Coastguard Workercase "\$5" in
416*5e7646d2SAndroid Build Coastguard Worker	*media=a4* | *media=iso_a4* | *PageSize=A4*)
417*5e7646d2SAndroid Build Coastguard Worker		gziptoany "$1" "$2" "$3" "$4" "$5" "$root/examples/onepage-a4.ps"
418*5e7646d2SAndroid Build Coastguard Worker		;;
419*5e7646d2SAndroid Build Coastguard Worker	*)
420*5e7646d2SAndroid Build Coastguard Worker		gziptoany "$1" "$2" "$3" "$4" "$5" "$root/examples/onepage-letter.ps"
421*5e7646d2SAndroid Build Coastguard Worker		;;
422*5e7646d2SAndroid Build Coastguard Workeresac
423*5e7646d2SAndroid Build Coastguard WorkerEOF
424*5e7646d2SAndroid Build Coastguard Worker			chmod +x "$BASE/bin/filter/$dst"
425*5e7646d2SAndroid Build Coastguard Worker			;;
426*5e7646d2SAndroid Build Coastguard Worker		raster)
427*5e7646d2SAndroid Build Coastguard Worker			cat >"$BASE/bin/filter/$dst" <<EOF
428*5e7646d2SAndroid Build Coastguard Worker#!/bin/sh
429*5e7646d2SAndroid Build Coastguard Workertrap "" TERM
430*5e7646d2SAndroid Build Coastguard Workertrap "" PIPE
431*5e7646d2SAndroid Build Coastguard Workergziptoany "$1" "$2" "$3" "$4" "$5" \$6 >/dev/null
432*5e7646d2SAndroid Build Coastguard Workercase "\$5" in
433*5e7646d2SAndroid Build Coastguard Worker	*media=a4* | *media=iso_a4* | *PageSize=A4*)
434*5e7646d2SAndroid Build Coastguard Worker		gziptoany "$1" "$2" "$3" "$4" "$5" "$root/examples/onepage-a4-300-black-1.pwg"
435*5e7646d2SAndroid Build Coastguard Worker		;;
436*5e7646d2SAndroid Build Coastguard Worker	*)
437*5e7646d2SAndroid Build Coastguard Worker		gziptoany "$1" "$2" "$3" "$4" "$5" "$root/examples/onepage-letter-300-black-1.pwg"
438*5e7646d2SAndroid Build Coastguard Worker		;;
439*5e7646d2SAndroid Build Coastguard Workeresac
440*5e7646d2SAndroid Build Coastguard WorkerEOF
441*5e7646d2SAndroid Build Coastguard Worker			chmod +x "$BASE/bin/filter/$dst"
442*5e7646d2SAndroid Build Coastguard Worker			;;
443*5e7646d2SAndroid Build Coastguard Worker	esac
444*5e7646d2SAndroid Build Coastguard Worker}
445*5e7646d2SAndroid Build Coastguard Worker
446*5e7646d2SAndroid Build Coastguard Workerln -s $root/test/test.convs $BASE/share/mime
447*5e7646d2SAndroid Build Coastguard Workerln -s $root/test/test.types $BASE/share/mime
448*5e7646d2SAndroid Build Coastguard Worker
449*5e7646d2SAndroid Build Coastguard Workerif test `uname` = Darwin; then
450*5e7646d2SAndroid Build Coastguard Worker	instfilter cgimagetopdf imagetopdf pdf
451*5e7646d2SAndroid Build Coastguard Worker	instfilter cgpdftopdf pdftopdf passthru
452*5e7646d2SAndroid Build Coastguard Worker	instfilter cgpdftops pdftops ps
453*5e7646d2SAndroid Build Coastguard Worker	instfilter cgpdftoraster pdftoraster raster
454*5e7646d2SAndroid Build Coastguard Worker	instfilter cgpdftoraster pdftourf raster
455*5e7646d2SAndroid Build Coastguard Worker	instfilter cgtexttopdf texttopdf pdf
456*5e7646d2SAndroid Build Coastguard Worker	instfilter pstocupsraster pstoraster raster
457*5e7646d2SAndroid Build Coastguard Workerelse
458*5e7646d2SAndroid Build Coastguard Worker	instfilter imagetopdf imagetopdf pdf
459*5e7646d2SAndroid Build Coastguard Worker	instfilter pdftopdf pdftopdf passthru
460*5e7646d2SAndroid Build Coastguard Worker	instfilter pdftops pdftops ps
461*5e7646d2SAndroid Build Coastguard Worker	instfilter pdftoraster pdftoraster raster
462*5e7646d2SAndroid Build Coastguard Worker	instfilter pdftoraster pdftourf raster
463*5e7646d2SAndroid Build Coastguard Worker	instfilter pstoraster pstoraster raster
464*5e7646d2SAndroid Build Coastguard Worker	instfilter texttopdf texttopdf pdf
465*5e7646d2SAndroid Build Coastguard Worker
466*5e7646d2SAndroid Build Coastguard Worker	if test -d /usr/share/cups/charsets; then
467*5e7646d2SAndroid Build Coastguard Worker		ln -s /usr/share/cups/charsets $BASE/share
468*5e7646d2SAndroid Build Coastguard Worker	fi
469*5e7646d2SAndroid Build Coastguard Workerfi
470*5e7646d2SAndroid Build Coastguard Worker
471*5e7646d2SAndroid Build Coastguard Worker#
472*5e7646d2SAndroid Build Coastguard Worker# Then create the necessary config files...
473*5e7646d2SAndroid Build Coastguard Worker#
474*5e7646d2SAndroid Build Coastguard Worker
475*5e7646d2SAndroid Build Coastguard Workerecho "Creating cupsd.conf for test..."
476*5e7646d2SAndroid Build Coastguard Worker
477*5e7646d2SAndroid Build Coastguard Workerif test $ssltype = 2; then
478*5e7646d2SAndroid Build Coastguard Worker	encryption="Encryption Required"
479*5e7646d2SAndroid Build Coastguard Workerelse
480*5e7646d2SAndroid Build Coastguard Worker	encryption=""
481*5e7646d2SAndroid Build Coastguard Workerfi
482*5e7646d2SAndroid Build Coastguard Worker
483*5e7646d2SAndroid Build Coastguard Workerif test $testtype = 0; then
484*5e7646d2SAndroid Build Coastguard Worker	jobhistory="30m"
485*5e7646d2SAndroid Build Coastguard Worker	jobfiles="5m"
486*5e7646d2SAndroid Build Coastguard Workerelse
487*5e7646d2SAndroid Build Coastguard Worker	jobhistory="30"
488*5e7646d2SAndroid Build Coastguard Worker	jobfiles="Off"
489*5e7646d2SAndroid Build Coastguard Workerfi
490*5e7646d2SAndroid Build Coastguard Worker
491*5e7646d2SAndroid Build Coastguard Workercat >$BASE/cupsd.conf <<EOF
492*5e7646d2SAndroid Build Coastguard WorkerStrictConformance Yes
493*5e7646d2SAndroid Build Coastguard WorkerBrowsing Off
494*5e7646d2SAndroid Build Coastguard WorkerListen localhost:$port
495*5e7646d2SAndroid Build Coastguard WorkerListen $BASE/sock
496*5e7646d2SAndroid Build Coastguard WorkerMaxSubscriptions 3
497*5e7646d2SAndroid Build Coastguard WorkerMaxLogSize 0
498*5e7646d2SAndroid Build Coastguard WorkerAccessLogLevel actions
499*5e7646d2SAndroid Build Coastguard WorkerLogLevel $loglevel
500*5e7646d2SAndroid Build Coastguard WorkerLogTimeFormat usecs
501*5e7646d2SAndroid Build Coastguard WorkerPreserveJobHistory $jobhistory
502*5e7646d2SAndroid Build Coastguard WorkerPreserveJobFiles $jobfiles
503*5e7646d2SAndroid Build Coastguard Worker<Policy default>
504*5e7646d2SAndroid Build Coastguard Worker<Limit All>
505*5e7646d2SAndroid Build Coastguard WorkerOrder Allow,Deny
506*5e7646d2SAndroid Build Coastguard Worker$encryption
507*5e7646d2SAndroid Build Coastguard Worker</Limit>
508*5e7646d2SAndroid Build Coastguard Worker</Policy>
509*5e7646d2SAndroid Build Coastguard WorkerEOF
510*5e7646d2SAndroid Build Coastguard Worker
511*5e7646d2SAndroid Build Coastguard Workerif test $testtype = 0; then
512*5e7646d2SAndroid Build Coastguard Worker	echo WebInterface yes >>$BASE/cupsd.conf
513*5e7646d2SAndroid Build Coastguard Workerfi
514*5e7646d2SAndroid Build Coastguard Worker
515*5e7646d2SAndroid Build Coastguard Workercat >$BASE/cups-files.conf <<EOF
516*5e7646d2SAndroid Build Coastguard WorkerFileDevice yes
517*5e7646d2SAndroid Build Coastguard WorkerPrintcap
518*5e7646d2SAndroid Build Coastguard WorkerUser $user
519*5e7646d2SAndroid Build Coastguard WorkerServerRoot $BASE
520*5e7646d2SAndroid Build Coastguard WorkerStateDir $BASE
521*5e7646d2SAndroid Build Coastguard WorkerServerBin $BASE/bin
522*5e7646d2SAndroid Build Coastguard WorkerCacheDir $BASE/share
523*5e7646d2SAndroid Build Coastguard WorkerDataDir $BASE/share
524*5e7646d2SAndroid Build Coastguard WorkerFontPath $BASE/share/fonts
525*5e7646d2SAndroid Build Coastguard WorkerDocumentRoot $root/doc
526*5e7646d2SAndroid Build Coastguard WorkerRequestRoot $BASE/spool
527*5e7646d2SAndroid Build Coastguard WorkerTempDir $BASE/spool/temp
528*5e7646d2SAndroid Build Coastguard WorkerAccessLog $BASE/log/access_log
529*5e7646d2SAndroid Build Coastguard WorkerErrorLog $BASE/log/error_log
530*5e7646d2SAndroid Build Coastguard WorkerPageLog $BASE/log/page_log
531*5e7646d2SAndroid Build Coastguard Worker
532*5e7646d2SAndroid Build Coastguard WorkerPassEnv DYLD_INSERT_LIBRARIES
533*5e7646d2SAndroid Build Coastguard WorkerPassEnv DYLD_LIBRARY_PATH
534*5e7646d2SAndroid Build Coastguard WorkerPassEnv LD_LIBRARY_PATH
535*5e7646d2SAndroid Build Coastguard WorkerPassEnv LD_PRELOAD
536*5e7646d2SAndroid Build Coastguard WorkerPassEnv LOCALEDIR
537*5e7646d2SAndroid Build Coastguard WorkerPassEnv ASAN_OPTIONS
538*5e7646d2SAndroid Build Coastguard Worker
539*5e7646d2SAndroid Build Coastguard WorkerSandboxing Off
540*5e7646d2SAndroid Build Coastguard WorkerEOF
541*5e7646d2SAndroid Build Coastguard Worker
542*5e7646d2SAndroid Build Coastguard Workerif test $ssltype != 0 -a `uname` = Darwin; then
543*5e7646d2SAndroid Build Coastguard Worker	echo "ServerKeychain $HOME/Library/Keychains/login.keychain" >> $BASE/cups-files.conf
544*5e7646d2SAndroid Build Coastguard Workerfi
545*5e7646d2SAndroid Build Coastguard Worker
546*5e7646d2SAndroid Build Coastguard Worker#
547*5e7646d2SAndroid Build Coastguard Worker# Setup lots of test queues with PPD files...
548*5e7646d2SAndroid Build Coastguard Worker#
549*5e7646d2SAndroid Build Coastguard Worker
550*5e7646d2SAndroid Build Coastguard Workerecho "Creating printers.conf for test..."
551*5e7646d2SAndroid Build Coastguard Worker
552*5e7646d2SAndroid Build Coastguard Workeri=1
553*5e7646d2SAndroid Build Coastguard Workerwhile test $i -le $nprinters; do
554*5e7646d2SAndroid Build Coastguard Worker	cat >>$BASE/printers.conf <<EOF
555*5e7646d2SAndroid Build Coastguard Worker<Printer test-$i>
556*5e7646d2SAndroid Build Coastguard WorkerAccepting Yes
557*5e7646d2SAndroid Build Coastguard WorkerDeviceURI file:/dev/null
558*5e7646d2SAndroid Build Coastguard WorkerInfo Test PS printer $i
559*5e7646d2SAndroid Build Coastguard WorkerJobSheets none none
560*5e7646d2SAndroid Build Coastguard WorkerLocation CUPS test suite
561*5e7646d2SAndroid Build Coastguard WorkerState Idle
562*5e7646d2SAndroid Build Coastguard WorkerStateMessage Printer $1 is idle.
563*5e7646d2SAndroid Build Coastguard Worker</Printer>
564*5e7646d2SAndroid Build Coastguard WorkerEOF
565*5e7646d2SAndroid Build Coastguard Worker
566*5e7646d2SAndroid Build Coastguard Worker	cp testps.ppd $BASE/ppd/test-$i.ppd
567*5e7646d2SAndroid Build Coastguard Worker
568*5e7646d2SAndroid Build Coastguard Worker	i=`expr $i + 1`
569*5e7646d2SAndroid Build Coastguard Workerdone
570*5e7646d2SAndroid Build Coastguard Worker
571*5e7646d2SAndroid Build Coastguard Workerif test -f $BASE/printers.conf; then
572*5e7646d2SAndroid Build Coastguard Worker	cp $BASE/printers.conf $BASE/printers.conf.orig
573*5e7646d2SAndroid Build Coastguard Workerelse
574*5e7646d2SAndroid Build Coastguard Worker	touch $BASE/printers.conf.orig
575*5e7646d2SAndroid Build Coastguard Workerfi
576*5e7646d2SAndroid Build Coastguard Worker
577*5e7646d2SAndroid Build Coastguard Worker#
578*5e7646d2SAndroid Build Coastguard Worker# Create a helper script to run programs with...
579*5e7646d2SAndroid Build Coastguard Worker#
580*5e7646d2SAndroid Build Coastguard Worker
581*5e7646d2SAndroid Build Coastguard Workerecho "Setting up environment variables for test..."
582*5e7646d2SAndroid Build Coastguard Worker
583*5e7646d2SAndroid Build Coastguard Workerif test "x$ASAN_OPTIONS" = x; then
584*5e7646d2SAndroid Build Coastguard Worker	# AddressSanitizer on Linux reports memory leaks from the main function
585*5e7646d2SAndroid Build Coastguard Worker	# which is basically useless - in general, programs do not need to free
586*5e7646d2SAndroid Build Coastguard Worker	# every object before exit since the OS will recover the process's
587*5e7646d2SAndroid Build Coastguard Worker	# memory.
588*5e7646d2SAndroid Build Coastguard Worker	ASAN_OPTIONS="detect_leaks=false"
589*5e7646d2SAndroid Build Coastguard Worker	export ASAN_OPTIONS
590*5e7646d2SAndroid Build Coastguard Workerfi
591*5e7646d2SAndroid Build Coastguard Worker
592*5e7646d2SAndroid Build Coastguard Workerif test -f "$root/cups/libcups.so.2"; then
593*5e7646d2SAndroid Build Coastguard Worker	if test "x$LD_LIBRARY_PATH" = x; then
594*5e7646d2SAndroid Build Coastguard Worker		LD_LIBRARY_PATH="$root/cups"
595*5e7646d2SAndroid Build Coastguard Worker	else
596*5e7646d2SAndroid Build Coastguard Worker		LD_LIBRARY_PATH="$root/cups:$LD_LIBRARY_PATH"
597*5e7646d2SAndroid Build Coastguard Worker	fi
598*5e7646d2SAndroid Build Coastguard Worker
599*5e7646d2SAndroid Build Coastguard Worker	LD_PRELOAD="$root/cups/libcups.so.2:$root/cups/libcupsimage.so.2"
600*5e7646d2SAndroid Build Coastguard Worker	if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then
601*5e7646d2SAndroid Build Coastguard Worker		LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD"
602*5e7646d2SAndroid Build Coastguard Worker	fi
603*5e7646d2SAndroid Build Coastguard Workerfi
604*5e7646d2SAndroid Build Coastguard Worker
605*5e7646d2SAndroid Build Coastguard Workerif test -f "$root/cups/libcups.2.dylib"; then
606*5e7646d2SAndroid Build Coastguard Worker	if test "x$DYLD_INSERT_LIBRARIES" = x; then
607*5e7646d2SAndroid Build Coastguard Worker		DYLD_INSERT_LIBRARIES="$root/cups/libcups.2.dylib:$root/cups/libcupsimage.2.dylib"
608*5e7646d2SAndroid Build Coastguard Worker	else
609*5e7646d2SAndroid Build Coastguard Worker		DYLD_INSERT_LIBRARIES="$root/cups/libcups.2.dylib:$root/cups/libcupsimage.2.dylib:$DYLD_INSERT_LIBRARIES"
610*5e7646d2SAndroid Build Coastguard Worker	fi
611*5e7646d2SAndroid Build Coastguard Worker
612*5e7646d2SAndroid Build Coastguard Worker	if test "x$DYLD_LIBRARY_PATH" = x; then
613*5e7646d2SAndroid Build Coastguard Worker		DYLD_LIBRARY_PATH="$root/cups"
614*5e7646d2SAndroid Build Coastguard Worker	else
615*5e7646d2SAndroid Build Coastguard Worker		DYLD_LIBRARY_PATH="$root/cups:$DYLD_LIBRARY_PATH"
616*5e7646d2SAndroid Build Coastguard Worker	fi
617*5e7646d2SAndroid Build Coastguard Workerfi
618*5e7646d2SAndroid Build Coastguard Worker
619*5e7646d2SAndroid Build Coastguard Worker# These get exported because they don't have side-effects...
620*5e7646d2SAndroid Build Coastguard WorkerCUPS_DISABLE_APPLE_DEFAULT=yes; export CUPS_DISABLE_APPLE_DEFAULT
621*5e7646d2SAndroid Build Coastguard WorkerCUPS_SERVER=localhost:$port; export CUPS_SERVER
622*5e7646d2SAndroid Build Coastguard WorkerCUPS_SERVERROOT=$BASE; export CUPS_SERVERROOT
623*5e7646d2SAndroid Build Coastguard WorkerCUPS_STATEDIR=$BASE; export CUPS_STATEDIR
624*5e7646d2SAndroid Build Coastguard WorkerCUPS_DATADIR=$BASE/share; export CUPS_DATADIR
625*5e7646d2SAndroid Build Coastguard WorkerIPP_PORT=$port; export IPP_PORT
626*5e7646d2SAndroid Build Coastguard WorkerLOCALEDIR=$BASE/share/locale; export LOCALEDIR
627*5e7646d2SAndroid Build Coastguard Worker
628*5e7646d2SAndroid Build Coastguard Workerecho "Creating wrapper script..."
629*5e7646d2SAndroid Build Coastguard Worker
630*5e7646d2SAndroid Build Coastguard Workerruncups="$BASE/runcups"; export runcups
631*5e7646d2SAndroid Build Coastguard Worker
632*5e7646d2SAndroid Build Coastguard Workerecho "#!/bin/sh" >$runcups
633*5e7646d2SAndroid Build Coastguard Workerecho "# Helper script for running CUPS test instance." >>$runcups
634*5e7646d2SAndroid Build Coastguard Workerecho "" >>$runcups
635*5e7646d2SAndroid Build Coastguard Workerecho "# Set required environment variables..." >>$runcups
636*5e7646d2SAndroid Build Coastguard Workerecho "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups
637*5e7646d2SAndroid Build Coastguard Workerecho "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups
638*5e7646d2SAndroid Build Coastguard Workerecho "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups
639*5e7646d2SAndroid Build Coastguard Workerecho "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups
640*5e7646d2SAndroid Build Coastguard Workerecho "DYLD_INSERT_LIBRARIES=\"$DYLD_INSERT_LIBRARIES\"; export DYLD_INSERT_LIBRARIES" >>$runcups
641*5e7646d2SAndroid Build Coastguard Workerecho "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups
642*5e7646d2SAndroid Build Coastguard Worker# IPP_PORT=$port; export IPP_PORT
643*5e7646d2SAndroid Build Coastguard Workerecho "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups
644*5e7646d2SAndroid Build Coastguard Workerecho "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups
645*5e7646d2SAndroid Build Coastguard Workerecho "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups
646*5e7646d2SAndroid Build Coastguard Workerif test "x$CUPS_DEBUG_LEVEL" != x; then
647*5e7646d2SAndroid Build Coastguard Worker	echo "CUPS_DEBUG_FILTER='$CUPS_DEBUG_FILTER'; export CUPS_DEBUG_FILTER" >>$runcups
648*5e7646d2SAndroid Build Coastguard Worker	echo "CUPS_DEBUG_LEVEL=$CUPS_DEBUG_LEVEL; export CUPS_DEBUG_LEVEL" >>$runcups
649*5e7646d2SAndroid Build Coastguard Worker	echo "CUPS_DEBUG_LOG='$CUPS_DEBUG_LOG'; export CUPS_DEBUG_LOG" >>$runcups
650*5e7646d2SAndroid Build Coastguard Workerfi
651*5e7646d2SAndroid Build Coastguard Workerecho "" >>$runcups
652*5e7646d2SAndroid Build Coastguard Workerecho "# Run command..." >>$runcups
653*5e7646d2SAndroid Build Coastguard Workerecho "exec \"\$@\"" >>$runcups
654*5e7646d2SAndroid Build Coastguard Worker
655*5e7646d2SAndroid Build Coastguard Workerchmod +x $runcups
656*5e7646d2SAndroid Build Coastguard Worker
657*5e7646d2SAndroid Build Coastguard Worker#
658*5e7646d2SAndroid Build Coastguard Worker# Set a new home directory to avoid getting user options mixed in...
659*5e7646d2SAndroid Build Coastguard Worker#
660*5e7646d2SAndroid Build Coastguard Worker
661*5e7646d2SAndroid Build Coastguard WorkerHOME=$BASE
662*5e7646d2SAndroid Build Coastguard Workerexport HOME
663*5e7646d2SAndroid Build Coastguard Worker
664*5e7646d2SAndroid Build Coastguard Worker#
665*5e7646d2SAndroid Build Coastguard Worker# Force POSIX locale for tests...
666*5e7646d2SAndroid Build Coastguard Worker#
667*5e7646d2SAndroid Build Coastguard Worker
668*5e7646d2SAndroid Build Coastguard WorkerLANG=C
669*5e7646d2SAndroid Build Coastguard Workerexport LANG
670*5e7646d2SAndroid Build Coastguard Worker
671*5e7646d2SAndroid Build Coastguard WorkerLC_MESSAGES=C
672*5e7646d2SAndroid Build Coastguard Workerexport LC_MESSAGES
673*5e7646d2SAndroid Build Coastguard Worker
674*5e7646d2SAndroid Build Coastguard Worker#
675*5e7646d2SAndroid Build Coastguard Worker# Start the server; run as foreground daemon in the background...
676*5e7646d2SAndroid Build Coastguard Worker#
677*5e7646d2SAndroid Build Coastguard Worker
678*5e7646d2SAndroid Build Coastguard Workerecho "Starting scheduler:"
679*5e7646d2SAndroid Build Coastguard Workerecho "    $runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &"
680*5e7646d2SAndroid Build Coastguard Workerecho ""
681*5e7646d2SAndroid Build Coastguard Worker
682*5e7646d2SAndroid Build Coastguard Worker$runcups $VALGRIND ../scheduler/cupsd -c $BASE/cupsd.conf -f >$BASE/log/debug_log 2>&1 &
683*5e7646d2SAndroid Build Coastguard Worker
684*5e7646d2SAndroid Build Coastguard Workercupsd=$!
685*5e7646d2SAndroid Build Coastguard Worker
686*5e7646d2SAndroid Build Coastguard Workerif test "x$testtype" = x0; then
687*5e7646d2SAndroid Build Coastguard Worker	# Not running tests...
688*5e7646d2SAndroid Build Coastguard Worker	echo "Scheduler is PID $cupsd and is listening on port $port."
689*5e7646d2SAndroid Build Coastguard Worker	echo ""
690*5e7646d2SAndroid Build Coastguard Worker
691*5e7646d2SAndroid Build Coastguard Worker	echo "The $runcups helper script can be used to test programs"
692*5e7646d2SAndroid Build Coastguard Worker	echo "with the server."
693*5e7646d2SAndroid Build Coastguard Worker	exit 0
694*5e7646d2SAndroid Build Coastguard Workerfi
695*5e7646d2SAndroid Build Coastguard Worker
696*5e7646d2SAndroid Build Coastguard Workerif test $argcount -eq 0; then
697*5e7646d2SAndroid Build Coastguard Worker	echo "Scheduler is PID $cupsd; run debugger now if you need to."
698*5e7646d2SAndroid Build Coastguard Worker	echo ""
699*5e7646d2SAndroid Build Coastguard Worker	echo $ac_n "Press ENTER to continue... $ac_c"
700*5e7646d2SAndroid Build Coastguard Worker	read junk
701*5e7646d2SAndroid Build Coastguard Workerelse
702*5e7646d2SAndroid Build Coastguard Worker	echo "Scheduler is PID $cupsd."
703*5e7646d2SAndroid Build Coastguard Worker	sleep 2
704*5e7646d2SAndroid Build Coastguard Workerfi
705*5e7646d2SAndroid Build Coastguard Worker
706*5e7646d2SAndroid Build Coastguard Workerwhile true; do
707*5e7646d2SAndroid Build Coastguard Worker	running=`$runcups ../systemv/lpstat -r 2>/dev/null`
708*5e7646d2SAndroid Build Coastguard Worker	if test "x$running" = "xscheduler is running"; then
709*5e7646d2SAndroid Build Coastguard Worker		break
710*5e7646d2SAndroid Build Coastguard Worker	fi
711*5e7646d2SAndroid Build Coastguard Worker
712*5e7646d2SAndroid Build Coastguard Worker	echo "Waiting for scheduler to become ready..."
713*5e7646d2SAndroid Build Coastguard Worker	sleep 10
714*5e7646d2SAndroid Build Coastguard Workerdone
715*5e7646d2SAndroid Build Coastguard Worker
716*5e7646d2SAndroid Build Coastguard Worker#
717*5e7646d2SAndroid Build Coastguard Worker# Create the test report source file...
718*5e7646d2SAndroid Build Coastguard Worker#
719*5e7646d2SAndroid Build Coastguard Worker
720*5e7646d2SAndroid Build Coastguard Workerdate=`date "+%Y-%m-%d"`
721*5e7646d2SAndroid Build Coastguard Worker
722*5e7646d2SAndroid Build Coastguard Workerstrfile=$BASE/cups-str-$date-$user.html
723*5e7646d2SAndroid Build Coastguard Worker
724*5e7646d2SAndroid Build Coastguard Workerrm -f $strfile
725*5e7646d2SAndroid Build Coastguard Workercat str-header.html >$strfile
726*5e7646d2SAndroid Build Coastguard Worker
727*5e7646d2SAndroid Build Coastguard Worker#
728*5e7646d2SAndroid Build Coastguard Worker# Run the IPP tests...
729*5e7646d2SAndroid Build Coastguard Worker#
730*5e7646d2SAndroid Build Coastguard Worker
731*5e7646d2SAndroid Build Coastguard Workerecho ""
732*5e7646d2SAndroid Build Coastguard Workerecho "Running IPP compliance tests..."
733*5e7646d2SAndroid Build Coastguard Worker
734*5e7646d2SAndroid Build Coastguard Workerecho "    <h1><a name='IPP'>1 - IPP Compliance Tests</a></h1>" >>$strfile
735*5e7646d2SAndroid Build Coastguard Workerecho "    <p>This section provides the results to the IPP compliance tests" >>$strfile
736*5e7646d2SAndroid Build Coastguard Workerecho "    outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
737*5e7646d2SAndroid Build Coastguard Workerecho "    $date by $user on `hostname`." >>$strfile
738*5e7646d2SAndroid Build Coastguard Workerecho "    <pre>" >>$strfile
739*5e7646d2SAndroid Build Coastguard Worker
740*5e7646d2SAndroid Build Coastguard Workerfail=0
741*5e7646d2SAndroid Build Coastguard Workerfor file in 4*.test ../examples/ipp-2.1.test; do
742*5e7646d2SAndroid Build Coastguard Worker	echo $ac_n "Performing `basename $file`: $ac_c"
743*5e7646d2SAndroid Build Coastguard Worker	echo "" >>$strfile
744*5e7646d2SAndroid Build Coastguard Worker        echo $ac_n "`date '+[%d/%b/%Y:%H:%M:%S %z]'` $ac_c" >>$strfile
745*5e7646d2SAndroid Build Coastguard Worker
746*5e7646d2SAndroid Build Coastguard Worker	if test $file = ../examples/ipp-2.1.test; then
747*5e7646d2SAndroid Build Coastguard Worker		uri="ipp://localhost:$port/printers/Test1"
748*5e7646d2SAndroid Build Coastguard Worker		options="-V 2.1 -d NOPRINT=1 -f testfile.ps"
749*5e7646d2SAndroid Build Coastguard Worker	else
750*5e7646d2SAndroid Build Coastguard Worker		uri="ipp://localhost:$port/printers"
751*5e7646d2SAndroid Build Coastguard Worker		options=""
752*5e7646d2SAndroid Build Coastguard Worker	fi
753*5e7646d2SAndroid Build Coastguard Worker	$runcups $VALGRIND ../tools/ipptool -tI $options $uri $file >> $strfile
754*5e7646d2SAndroid Build Coastguard Worker	status=$?
755*5e7646d2SAndroid Build Coastguard Worker
756*5e7646d2SAndroid Build Coastguard Worker	if test $status != 0; then
757*5e7646d2SAndroid Build Coastguard Worker		echo FAIL
758*5e7646d2SAndroid Build Coastguard Worker		fail=`expr $fail + 1`
759*5e7646d2SAndroid Build Coastguard Worker	else
760*5e7646d2SAndroid Build Coastguard Worker		echo PASS
761*5e7646d2SAndroid Build Coastguard Worker	fi
762*5e7646d2SAndroid Build Coastguard Workerdone
763*5e7646d2SAndroid Build Coastguard Worker
764*5e7646d2SAndroid Build Coastguard Workerecho "    </pre>" >>$strfile
765*5e7646d2SAndroid Build Coastguard Worker
766*5e7646d2SAndroid Build Coastguard Worker#
767*5e7646d2SAndroid Build Coastguard Worker# Run the command tests...
768*5e7646d2SAndroid Build Coastguard Worker#
769*5e7646d2SAndroid Build Coastguard Worker
770*5e7646d2SAndroid Build Coastguard Workerecho ""
771*5e7646d2SAndroid Build Coastguard Workerecho "Running command tests..."
772*5e7646d2SAndroid Build Coastguard Worker
773*5e7646d2SAndroid Build Coastguard Workerecho "    <h1><a name='COMMAND'>2 - Command Tests</a></h1>" >>$strfile
774*5e7646d2SAndroid Build Coastguard Workerecho "    <p>This section provides the results to the command tests" >>$strfile
775*5e7646d2SAndroid Build Coastguard Workerecho "    outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
776*5e7646d2SAndroid Build Coastguard Workerecho "    $date by $user on `hostname`." >>$strfile
777*5e7646d2SAndroid Build Coastguard Workerecho "    <pre>" >>$strfile
778*5e7646d2SAndroid Build Coastguard Worker
779*5e7646d2SAndroid Build Coastguard Workerfor file in 5*.sh; do
780*5e7646d2SAndroid Build Coastguard Worker	echo $ac_n "Performing $file: $ac_c"
781*5e7646d2SAndroid Build Coastguard Worker	echo "" >>$strfile
782*5e7646d2SAndroid Build Coastguard Worker        echo "`date '+[%d/%b/%Y:%H:%M:%S %z]'` \"$file\":" >>$strfile
783*5e7646d2SAndroid Build Coastguard Worker
784*5e7646d2SAndroid Build Coastguard Worker	sh $file $pjobs $pprinters >> $strfile
785*5e7646d2SAndroid Build Coastguard Worker	status=$?
786*5e7646d2SAndroid Build Coastguard Worker
787*5e7646d2SAndroid Build Coastguard Worker	if test $status != 0; then
788*5e7646d2SAndroid Build Coastguard Worker		echo FAIL
789*5e7646d2SAndroid Build Coastguard Worker		fail=`expr $fail + 1`
790*5e7646d2SAndroid Build Coastguard Worker	else
791*5e7646d2SAndroid Build Coastguard Worker		echo PASS
792*5e7646d2SAndroid Build Coastguard Worker	fi
793*5e7646d2SAndroid Build Coastguard Workerdone
794*5e7646d2SAndroid Build Coastguard Worker
795*5e7646d2SAndroid Build Coastguard Worker#
796*5e7646d2SAndroid Build Coastguard Worker# Restart the server...
797*5e7646d2SAndroid Build Coastguard Worker#
798*5e7646d2SAndroid Build Coastguard Worker
799*5e7646d2SAndroid Build Coastguard Workerecho $ac_n "Performing restart test: $ac_c"
800*5e7646d2SAndroid Build Coastguard Workerecho "" >>$strfile
801*5e7646d2SAndroid Build Coastguard Workerecho "`date '+[%d/%b/%Y:%H:%M:%S %z]'` \"5.10-restart\":" >>$strfile
802*5e7646d2SAndroid Build Coastguard Worker
803*5e7646d2SAndroid Build Coastguard Workerkill -HUP $cupsd
804*5e7646d2SAndroid Build Coastguard Worker
805*5e7646d2SAndroid Build Coastguard Workerwhile true; do
806*5e7646d2SAndroid Build Coastguard Worker	sleep 10
807*5e7646d2SAndroid Build Coastguard Worker
808*5e7646d2SAndroid Build Coastguard Worker	running=`$runcups ../systemv/lpstat -r 2>/dev/null`
809*5e7646d2SAndroid Build Coastguard Worker	if test "x$running" = "xscheduler is running"; then
810*5e7646d2SAndroid Build Coastguard Worker		break
811*5e7646d2SAndroid Build Coastguard Worker	fi
812*5e7646d2SAndroid Build Coastguard Workerdone
813*5e7646d2SAndroid Build Coastguard Worker
814*5e7646d2SAndroid Build Coastguard Workerdescription="`$runcups ../systemv/lpstat -l -p Test1 | grep Description | sed -e '1,$s/^[^:]*: //g'`"
815*5e7646d2SAndroid Build Coastguard Workerif test "x$description" != "xTest Printer 1"; then
816*5e7646d2SAndroid Build Coastguard Worker	echo "Failed, printer-info for Test1 is '$description', expected 'Test Printer 1'." >>$strfile
817*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL (got '$description', expected 'Test Printer 1')"
818*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
819*5e7646d2SAndroid Build Coastguard Workerelse
820*5e7646d2SAndroid Build Coastguard Worker	echo "Passed." >>$strfile
821*5e7646d2SAndroid Build Coastguard Worker	echo PASS
822*5e7646d2SAndroid Build Coastguard Workerfi
823*5e7646d2SAndroid Build Coastguard Worker
824*5e7646d2SAndroid Build Coastguard Worker
825*5e7646d2SAndroid Build Coastguard Worker#
826*5e7646d2SAndroid Build Coastguard Worker# Perform job history test...
827*5e7646d2SAndroid Build Coastguard Worker#
828*5e7646d2SAndroid Build Coastguard Worker
829*5e7646d2SAndroid Build Coastguard Workerecho $ac_n "Starting history test: $ac_c"
830*5e7646d2SAndroid Build Coastguard Workerecho "" >>$strfile
831*5e7646d2SAndroid Build Coastguard Workerecho "`date '+[%d/%b/%Y:%H:%M:%S %z]'` \"5.11-history\":" >>$strfile
832*5e7646d2SAndroid Build Coastguard Worker
833*5e7646d2SAndroid Build Coastguard Workerecho "    lp -d Test1 testfile.jpg" >>$strfile
834*5e7646d2SAndroid Build Coastguard Worker
835*5e7646d2SAndroid Build Coastguard Worker$runcups ../systemv/lp -d Test1 ../examples/testfile.jpg 2>&1 >>$strfile
836*5e7646d2SAndroid Build Coastguard Workerif test $? != 0; then
837*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL (unable to queue test job)"
838*5e7646d2SAndroid Build Coastguard Worker	echo "    FAILED" >>$strfile
839*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
840*5e7646d2SAndroid Build Coastguard Workerelse
841*5e7646d2SAndroid Build Coastguard Worker	echo "PASS"
842*5e7646d2SAndroid Build Coastguard Worker	echo "    PASSED" >>$strfile
843*5e7646d2SAndroid Build Coastguard Worker
844*5e7646d2SAndroid Build Coastguard Worker	./waitjobs.sh >>$strfile
845*5e7646d2SAndroid Build Coastguard Worker
846*5e7646d2SAndroid Build Coastguard Worker        echo $ac_n "Verifying that history still exists: $ac_c"
847*5e7646d2SAndroid Build Coastguard Worker
848*5e7646d2SAndroid Build Coastguard Worker	echo "    ls -l $BASE/spool" >>$strfile
849*5e7646d2SAndroid Build Coastguard Worker	count=`ls -1 $BASE/spool | wc -l`
850*5e7646d2SAndroid Build Coastguard Worker	if test $count = 1; then
851*5e7646d2SAndroid Build Coastguard Worker		echo "FAIL"
852*5e7646d2SAndroid Build Coastguard Worker		echo "    FAILED (job control files not present)" >>$strfile
853*5e7646d2SAndroid Build Coastguard Worker		ls -l $BASE/spool >>$strfile
854*5e7646d2SAndroid Build Coastguard Worker		fail=`expr $fail + 1`
855*5e7646d2SAndroid Build Coastguard Worker	else
856*5e7646d2SAndroid Build Coastguard Worker		echo "PASS"
857*5e7646d2SAndroid Build Coastguard Worker		echo "    PASSED" >>$strfile
858*5e7646d2SAndroid Build Coastguard Worker
859*5e7646d2SAndroid Build Coastguard Worker		echo $ac_n "Waiting for job history to expire: $ac_c"
860*5e7646d2SAndroid Build Coastguard Worker		echo "" >>$strfile
861*5e7646d2SAndroid Build Coastguard Worker		echo "    sleep 35" >>$strfile
862*5e7646d2SAndroid Build Coastguard Worker		sleep 35
863*5e7646d2SAndroid Build Coastguard Worker
864*5e7646d2SAndroid Build Coastguard Worker		echo "    lpstat" >>$strfile
865*5e7646d2SAndroid Build Coastguard Worker		$runcups ../systemv/lpstat 2>&1 >>$strfile
866*5e7646d2SAndroid Build Coastguard Worker
867*5e7646d2SAndroid Build Coastguard Worker		echo "    ls -l $BASE/spool" >>$strfile
868*5e7646d2SAndroid Build Coastguard Worker		count=`ls -1 $BASE/spool | wc -l`
869*5e7646d2SAndroid Build Coastguard Worker		if test $count != 1; then
870*5e7646d2SAndroid Build Coastguard Worker			echo "FAIL"
871*5e7646d2SAndroid Build Coastguard Worker			echo "    FAILED (job control files still present)" >>$strfile
872*5e7646d2SAndroid Build Coastguard Worker			ls -l $BASE/spool >>$strfile
873*5e7646d2SAndroid Build Coastguard Worker			fail=`expr $fail + 1`
874*5e7646d2SAndroid Build Coastguard Worker		else
875*5e7646d2SAndroid Build Coastguard Worker			echo "PASS"
876*5e7646d2SAndroid Build Coastguard Worker			echo "    PASSED" >>$strfile
877*5e7646d2SAndroid Build Coastguard Worker		fi
878*5e7646d2SAndroid Build Coastguard Worker	fi
879*5e7646d2SAndroid Build Coastguard Workerfi
880*5e7646d2SAndroid Build Coastguard Worker
881*5e7646d2SAndroid Build Coastguard Worker
882*5e7646d2SAndroid Build Coastguard Worker#
883*5e7646d2SAndroid Build Coastguard Worker# Stop the server...
884*5e7646d2SAndroid Build Coastguard Worker#
885*5e7646d2SAndroid Build Coastguard Worker
886*5e7646d2SAndroid Build Coastguard Workerecho "    </pre>" >>$strfile
887*5e7646d2SAndroid Build Coastguard Worker
888*5e7646d2SAndroid Build Coastguard Workerkill $cupsd
889*5e7646d2SAndroid Build Coastguard Workerwait $cupsd
890*5e7646d2SAndroid Build Coastguard Workercupsdstatus=$?
891*5e7646d2SAndroid Build Coastguard Worker
892*5e7646d2SAndroid Build Coastguard Worker#
893*5e7646d2SAndroid Build Coastguard Worker# Verify counts...
894*5e7646d2SAndroid Build Coastguard Worker#
895*5e7646d2SAndroid Build Coastguard Worker
896*5e7646d2SAndroid Build Coastguard Workerecho "Test Summary"
897*5e7646d2SAndroid Build Coastguard Workerecho ""
898*5e7646d2SAndroid Build Coastguard Workerecho "    <h1><a name='SUMMARY'>3 - Test Summary</a></h1>" >>$strfile
899*5e7646d2SAndroid Build Coastguard Worker
900*5e7646d2SAndroid Build Coastguard Workerif test $cupsdstatus != 0; then
901*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: cupsd failed with exit status $cupsdstatus."
902*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: cupsd failed with exit status $cupsdstatus.</p>" >>$strfile
903*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
904*5e7646d2SAndroid Build Coastguard Workerelse
905*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: cupsd exited with no errors."
906*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: cupsd exited with no errors.</p>" >>$strfile
907*5e7646d2SAndroid Build Coastguard Workerfi
908*5e7646d2SAndroid Build Coastguard Worker
909*5e7646d2SAndroid Build Coastguard Worker# Job control files
910*5e7646d2SAndroid Build Coastguard Workercount=`ls -1 $BASE/spool | wc -l`
911*5e7646d2SAndroid Build Coastguard Workercount=`expr $count - 1`
912*5e7646d2SAndroid Build Coastguard Workerif test $count != 0; then
913*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count job control files were not purged."
914*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count job control files were not purged.</p>" >>$strfile
915*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
916*5e7646d2SAndroid Build Coastguard Workerelse
917*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: All job control files purged."
918*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: All job control files purged.</p>" >>$strfile
919*5e7646d2SAndroid Build Coastguard Workerfi
920*5e7646d2SAndroid Build Coastguard Worker
921*5e7646d2SAndroid Build Coastguard Worker# Pages printed on Test1 (within 1 page for timing-dependent cancel issues)
922*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^Test1 ' $BASE/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
923*5e7646d2SAndroid Build Coastguard Workerexpected=`expr $pjobs \* 2 + 34`
924*5e7646d2SAndroid Build Coastguard Workerexpected2=`expr $expected + 2`
925*5e7646d2SAndroid Build Coastguard Workerif test $count -lt $expected -a $count -gt $expected2; then
926*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected."
927*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</p>" >>$strfile
928*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
929*5e7646d2SAndroid Build Coastguard Workerelse
930*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: Printer 'Test1' correctly produced $count page(s)."
931*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: Printer 'Test1' correctly produced $count page(s).</p>" >>$strfile
932*5e7646d2SAndroid Build Coastguard Workerfi
933*5e7646d2SAndroid Build Coastguard Worker
934*5e7646d2SAndroid Build Coastguard Worker# Paged printed on Test2
935*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^Test2 ' $BASE/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
936*5e7646d2SAndroid Build Coastguard Workerexpected=`expr $pjobs \* 2 + 3`
937*5e7646d2SAndroid Build Coastguard Workerif test $count != $expected; then
938*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected."
939*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</p>" >>$strfile
940*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
941*5e7646d2SAndroid Build Coastguard Workerelse
942*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: Printer 'Test2' correctly produced $count page(s)."
943*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: Printer 'Test2' correctly produced $count page(s).</p>" >>$strfile
944*5e7646d2SAndroid Build Coastguard Workerfi
945*5e7646d2SAndroid Build Coastguard Worker
946*5e7646d2SAndroid Build Coastguard Worker# Paged printed on Test3
947*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^Test3 ' $BASE/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
948*5e7646d2SAndroid Build Coastguard Workerexpected=2
949*5e7646d2SAndroid Build Coastguard Workerif test $count != $expected; then
950*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: Printer 'Test3' produced $count page(s), expected $expected."
951*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: Printer 'Test3' produced $count page(s), expected $expected.</p>" >>$strfile
952*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
953*5e7646d2SAndroid Build Coastguard Workerelse
954*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: Printer 'Test3' correctly produced $count page(s)."
955*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: Printer 'Test3' correctly produced $count page(s).</p>" >>$strfile
956*5e7646d2SAndroid Build Coastguard Workerfi
957*5e7646d2SAndroid Build Coastguard Worker
958*5e7646d2SAndroid Build Coastguard Worker# Requests logged
959*5e7646d2SAndroid Build Coastguard Workercount=`wc -l $BASE/log/access_log | awk '{print $1}'`
960*5e7646d2SAndroid Build Coastguard Workerexpected=`expr 35 + 18 + 30 + $pjobs \* 8 + $pprinters \* $pjobs \* 4 + 2`
961*5e7646d2SAndroid Build Coastguard Workerif test $count != $expected; then
962*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count requests logged, expected $expected."
963*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count requests logged, expected $expected.</p>" >>$strfile
964*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
965*5e7646d2SAndroid Build Coastguard Workerelse
966*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count requests logged."
967*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count requests logged.</p>" >>$strfile
968*5e7646d2SAndroid Build Coastguard Workerfi
969*5e7646d2SAndroid Build Coastguard Worker
970*5e7646d2SAndroid Build Coastguard Worker# Did CUPS-Get-Default get logged?
971*5e7646d2SAndroid Build Coastguard Workerif $GREP -q CUPS-Get-Default $BASE/log/access_log; then
972*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'"
973*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</p>" >>$strfile
974*5e7646d2SAndroid Build Coastguard Worker	echo "    <pre>" >>$strfile
975*5e7646d2SAndroid Build Coastguard Worker	$GREP CUPS-Get-Default $BASE/log/access_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
976*5e7646d2SAndroid Build Coastguard Worker	echo "    </pre>" >>$strfile
977*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
978*5e7646d2SAndroid Build Coastguard Workerelse
979*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: CUPS-Get-Default not logged."
980*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: CUPS-Get-Default not logged.</p>" >>$strfile
981*5e7646d2SAndroid Build Coastguard Workerfi
982*5e7646d2SAndroid Build Coastguard Worker
983*5e7646d2SAndroid Build Coastguard Worker# Emergency log messages
984*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^X ' $BASE/log/error_log | wc -l | awk '{print $1}'`
985*5e7646d2SAndroid Build Coastguard Workerif test $count != 0; then
986*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count emergency messages, expected 0."
987*5e7646d2SAndroid Build Coastguard Worker	$GREP '^X ' $BASE/log/error_log
988*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count emergency messages, expected 0.</p>" >>$strfile
989*5e7646d2SAndroid Build Coastguard Worker	echo "    <pre>" >>$strfile
990*5e7646d2SAndroid Build Coastguard Worker	$GREP '^X ' $BASE/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
991*5e7646d2SAndroid Build Coastguard Worker	echo "    </pre>" >>$strfile
992*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
993*5e7646d2SAndroid Build Coastguard Workerelse
994*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count emergency messages."
995*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count emergency messages.</p>" >>$strfile
996*5e7646d2SAndroid Build Coastguard Workerfi
997*5e7646d2SAndroid Build Coastguard Worker
998*5e7646d2SAndroid Build Coastguard Worker# Alert log messages
999*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^A ' $BASE/log/error_log | wc -l | awk '{print $1}'`
1000*5e7646d2SAndroid Build Coastguard Workerif test $count != 0; then
1001*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count alert messages, expected 0."
1002*5e7646d2SAndroid Build Coastguard Worker	$GREP '^A ' $BASE/log/error_log
1003*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count alert messages, expected 0.</p>" >>$strfile
1004*5e7646d2SAndroid Build Coastguard Worker	echo "    <pre>" >>$strfile
1005*5e7646d2SAndroid Build Coastguard Worker	$GREP '^A ' $BASE/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
1006*5e7646d2SAndroid Build Coastguard Worker	echo "    </pre>" >>$strfile
1007*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
1008*5e7646d2SAndroid Build Coastguard Workerelse
1009*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count alert messages."
1010*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count alert messages.</p>" >>$strfile
1011*5e7646d2SAndroid Build Coastguard Workerfi
1012*5e7646d2SAndroid Build Coastguard Worker
1013*5e7646d2SAndroid Build Coastguard Worker# Critical log messages
1014*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^C ' $BASE/log/error_log | wc -l | awk '{print $1}'`
1015*5e7646d2SAndroid Build Coastguard Workerif test $count != 0; then
1016*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count critical messages, expected 0."
1017*5e7646d2SAndroid Build Coastguard Worker	$GREP '^C ' $BASE/log/error_log
1018*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count critical messages, expected 0.</p>" >>$strfile
1019*5e7646d2SAndroid Build Coastguard Worker	echo "    <pre>" >>$strfile
1020*5e7646d2SAndroid Build Coastguard Worker	$GREP '^C ' $BASE/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
1021*5e7646d2SAndroid Build Coastguard Worker	echo "    </pre>" >>$strfile
1022*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
1023*5e7646d2SAndroid Build Coastguard Workerelse
1024*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count critical messages."
1025*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count critical messages.</p>" >>$strfile
1026*5e7646d2SAndroid Build Coastguard Workerfi
1027*5e7646d2SAndroid Build Coastguard Worker
1028*5e7646d2SAndroid Build Coastguard Worker# Error log messages
1029*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^E ' $BASE/log/error_log | $GREP -v 'Unknown default SystemGroup' | wc -l | awk '{print $1}'`
1030*5e7646d2SAndroid Build Coastguard Workerif test $count != 33; then
1031*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count error messages, expected 33."
1032*5e7646d2SAndroid Build Coastguard Worker	$GREP '^E ' $BASE/log/error_log
1033*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count error messages, expected 33.</p>" >>$strfile
1034*5e7646d2SAndroid Build Coastguard Worker	echo "    <pre>" >>$strfile
1035*5e7646d2SAndroid Build Coastguard Worker	$GREP '^E ' $BASE/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
1036*5e7646d2SAndroid Build Coastguard Worker	echo "    </pre>" >>$strfile
1037*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
1038*5e7646d2SAndroid Build Coastguard Workerelse
1039*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count error messages."
1040*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count error messages.</p>" >>$strfile
1041*5e7646d2SAndroid Build Coastguard Workerfi
1042*5e7646d2SAndroid Build Coastguard Worker
1043*5e7646d2SAndroid Build Coastguard Worker# Warning log messages
1044*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^W ' $BASE/log/error_log | $GREP -v CreateProfile | wc -l | awk '{print $1}'`
1045*5e7646d2SAndroid Build Coastguard Workerif test $count != 8; then
1046*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count warning messages, expected 8."
1047*5e7646d2SAndroid Build Coastguard Worker	$GREP '^W ' $BASE/log/error_log
1048*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count warning messages, expected 8.</p>" >>$strfile
1049*5e7646d2SAndroid Build Coastguard Worker	echo "    <pre>" >>$strfile
1050*5e7646d2SAndroid Build Coastguard Worker	$GREP '^W ' $BASE/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
1051*5e7646d2SAndroid Build Coastguard Worker	echo "    </pre>" >>$strfile
1052*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
1053*5e7646d2SAndroid Build Coastguard Workerelse
1054*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count warning messages."
1055*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count warning messages.</p>" >>$strfile
1056*5e7646d2SAndroid Build Coastguard Workerfi
1057*5e7646d2SAndroid Build Coastguard Worker
1058*5e7646d2SAndroid Build Coastguard Worker# Notice log messages
1059*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^N ' $BASE/log/error_log | wc -l | awk '{print $1}'`
1060*5e7646d2SAndroid Build Coastguard Workerif test $count != 0; then
1061*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count notice messages, expected 0."
1062*5e7646d2SAndroid Build Coastguard Worker	$GREP '^N ' $BASE/log/error_log
1063*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count notice messages, expected 0.</p>" >>$strfile
1064*5e7646d2SAndroid Build Coastguard Worker	echo "    <pre>" >>$strfile
1065*5e7646d2SAndroid Build Coastguard Worker	$GREP '^N ' $BASE/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
1066*5e7646d2SAndroid Build Coastguard Worker	echo "    </pre>" >>$strfile
1067*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
1068*5e7646d2SAndroid Build Coastguard Workerelse
1069*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count notice messages."
1070*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count notice messages.</p>" >>$strfile
1071*5e7646d2SAndroid Build Coastguard Workerfi
1072*5e7646d2SAndroid Build Coastguard Worker
1073*5e7646d2SAndroid Build Coastguard Worker# Info log messages
1074*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^I ' $BASE/log/error_log | wc -l | awk '{print $1}'`
1075*5e7646d2SAndroid Build Coastguard Workerif test $count = 0; then
1076*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count info messages, expected more than 0."
1077*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count info messages, expected more than 0.</p>" >>$strfile
1078*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
1079*5e7646d2SAndroid Build Coastguard Workerelse
1080*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count info messages."
1081*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count info messages.</p>" >>$strfile
1082*5e7646d2SAndroid Build Coastguard Workerfi
1083*5e7646d2SAndroid Build Coastguard Worker
1084*5e7646d2SAndroid Build Coastguard Worker# Debug log messages
1085*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^D ' $BASE/log/error_log | wc -l | awk '{print $1}'`
1086*5e7646d2SAndroid Build Coastguard Workerif test $count = 0; then
1087*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count debug messages, expected more than 0."
1088*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count debug messages, expected more than 0.</p>" >>$strfile
1089*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
1090*5e7646d2SAndroid Build Coastguard Workerelse
1091*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count debug messages."
1092*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count debug messages.</p>" >>$strfile
1093*5e7646d2SAndroid Build Coastguard Workerfi
1094*5e7646d2SAndroid Build Coastguard Worker
1095*5e7646d2SAndroid Build Coastguard Worker# Debug2 log messages
1096*5e7646d2SAndroid Build Coastguard Workercount=`$GREP '^d ' $BASE/log/error_log | wc -l | awk '{print $1}'`
1097*5e7646d2SAndroid Build Coastguard Workerif test $count = 0 -a $loglevel = debug2; then
1098*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count debug2 messages, expected more than 0."
1099*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count debug2 messages, expected more than 0.</p>" >>$strfile
1100*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
1101*5e7646d2SAndroid Build Coastguard Workerelif test $count != 0 -a $loglevel = debug; then
1102*5e7646d2SAndroid Build Coastguard Worker	echo "FAIL: $count debug2 messages, expected 0."
1103*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>FAIL: $count debug2 messages, expected 0.</p>" >>$strfile
1104*5e7646d2SAndroid Build Coastguard Worker	fail=`expr $fail + 1`
1105*5e7646d2SAndroid Build Coastguard Workerelse
1106*5e7646d2SAndroid Build Coastguard Worker	echo "PASS: $count debug2 messages."
1107*5e7646d2SAndroid Build Coastguard Worker	echo "    <p>PASS: $count debug2 messages.</p>" >>$strfile
1108*5e7646d2SAndroid Build Coastguard Workerfi
1109*5e7646d2SAndroid Build Coastguard Worker
1110*5e7646d2SAndroid Build Coastguard Worker#
1111*5e7646d2SAndroid Build Coastguard Worker# Log files...
1112*5e7646d2SAndroid Build Coastguard Worker#
1113*5e7646d2SAndroid Build Coastguard Worker
1114*5e7646d2SAndroid Build Coastguard Workerecho "    <h1><a name='LOGS'>4 - Log Files</a></h1>" >>$strfile
1115*5e7646d2SAndroid Build Coastguard Worker
1116*5e7646d2SAndroid Build Coastguard Workerfor file in $BASE/log/*_log; do
1117*5e7646d2SAndroid Build Coastguard Worker        baselog=`basename $file`
1118*5e7646d2SAndroid Build Coastguard Worker
1119*5e7646d2SAndroid Build Coastguard Worker        echo "    <h2><a name=\"$baselog\">$baselog</a></h2>" >>$strfile
1120*5e7646d2SAndroid Build Coastguard Worker        case $baselog in
1121*5e7646d2SAndroid Build Coastguard Worker                error_log)
1122*5e7646d2SAndroid Build Coastguard Worker                        echo "    <blockquote>Note: debug2 messages have been filtered out of the HTML report.</blockquote>" >>$strfile
1123*5e7646d2SAndroid Build Coastguard Worker                        echo "    <pre>" >>$strfile
1124*5e7646d2SAndroid Build Coastguard Worker                        $GREP -v '^d' $BASE/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
1125*5e7646d2SAndroid Build Coastguard Worker                        echo "    </pre>" >>$strfile
1126*5e7646d2SAndroid Build Coastguard Worker                        ;;
1127*5e7646d2SAndroid Build Coastguard Worker
1128*5e7646d2SAndroid Build Coastguard Worker                *)
1129*5e7646d2SAndroid Build Coastguard Worker                        echo "    <pre>" >>$strfile
1130*5e7646d2SAndroid Build Coastguard Worker                        sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' $file >>$strfile
1131*5e7646d2SAndroid Build Coastguard Worker                        echo "    </pre>" >>$strfile
1132*5e7646d2SAndroid Build Coastguard Worker                        ;;
1133*5e7646d2SAndroid Build Coastguard Worker        esac
1134*5e7646d2SAndroid Build Coastguard Workerdone
1135*5e7646d2SAndroid Build Coastguard Worker
1136*5e7646d2SAndroid Build Coastguard Worker#
1137*5e7646d2SAndroid Build Coastguard Worker# Format the reports and tell the user where to find them...
1138*5e7646d2SAndroid Build Coastguard Worker#
1139*5e7646d2SAndroid Build Coastguard Worker
1140*5e7646d2SAndroid Build Coastguard Workercat str-trailer.html >>$strfile
1141*5e7646d2SAndroid Build Coastguard Worker
1142*5e7646d2SAndroid Build Coastguard Workerecho ""
1143*5e7646d2SAndroid Build Coastguard Workerfor file in $BASE/log/*_log; do
1144*5e7646d2SAndroid Build Coastguard Worker        baselog=`basename $file`
1145*5e7646d2SAndroid Build Coastguard Worker        cp $file $baselog-$date-$user
1146*5e7646d2SAndroid Build Coastguard Worker        echo "Copied log file \"$baselog-$date-$user\" to test directory."
1147*5e7646d2SAndroid Build Coastguard Workerdone
1148*5e7646d2SAndroid Build Coastguard Workercp $strfile .
1149*5e7646d2SAndroid Build Coastguard Workerecho "Copied report file \"cups-str-$date-$user.html\" to test directory."
1150*5e7646d2SAndroid Build Coastguard Worker
1151*5e7646d2SAndroid Build Coastguard Worker# Clean out old failure log files after 1 week...
1152*5e7646d2SAndroid Build Coastguard Workerfind . -name \*_log-\*-$user -a -mtime +7 -print -exec rm -f '{}' \; | awk '{print "Removed old log file \"" substr($1,3) "\" from test directory."}'
1153*5e7646d2SAndroid Build Coastguard Workerfind . -name cups-str-\*-$user.html -a -mtime +7 -print -exec rm -f '{}' \; | awk '{print "Removed old report file \"" $1 "\" from test directory."}'
1154*5e7646d2SAndroid Build Coastguard Worker
1155*5e7646d2SAndroid Build Coastguard Workerecho ""
1156*5e7646d2SAndroid Build Coastguard Worker
1157*5e7646d2SAndroid Build Coastguard Workerif test $fail != 0; then
1158*5e7646d2SAndroid Build Coastguard Worker	echo "$fail tests failed."
1159*5e7646d2SAndroid Build Coastguard Worker	exit 1
1160*5e7646d2SAndroid Build Coastguard Workerelse
1161*5e7646d2SAndroid Build Coastguard Worker	echo "All tests were successful."
1162*5e7646d2SAndroid Build Coastguard Workerfi
1163