~ubuntu-branches/ubuntu/trusty/cups/trusty

« back to all changes in this revision

Viewing changes to .pc/tests-skip-ipp.patch/test/run-stp-tests.sh

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-08-14 14:51:07 UTC
  • mfrom: (99.1.24 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130814145107-sfo31irtjh6fyv9t
* debian/patches/tests-use-cupsfilters.patch: Update to reflect
  the filter list in cups-filters 1.0.36 and fix the testsuite.
* debian/patches/tests-skip-ipp.patch: Skip the IPP failure for
  now so we can build successfully and fix Ubuntu image builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $"
 
4
#
 
5
#   Perform the complete set of IPP compliance tests specified in the
 
6
#   CUPS Software Test Plan.
 
7
#
 
8
#   Copyright 2007-2012 by Apple Inc.
 
9
#   Copyright 1997-2007 by Easy Software Products, all rights reserved.
 
10
#
 
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/".
 
16
#
 
17
 
 
18
argcount=$#
 
19
 
 
20
#
 
21
# Don't allow "make check" or "make test" to be run by root...
 
22
#
 
23
 
 
24
if test "x`id -u`" = x0; then
 
25
        echo Please run this as a normal user. Not supported when run as root.
 
26
        exit 1
 
27
fi
 
28
 
 
29
#
 
30
# Force the permissions of the files we create...
 
31
#
 
32
 
 
33
umask 022
 
34
 
 
35
#
 
36
# Make the IPP test program...
 
37
#
 
38
 
 
39
make
 
40
 
 
41
#
 
42
# Solaris has a non-POSIX grep in /bin...
 
43
#
 
44
 
 
45
if test -x /usr/xpg4/bin/grep; then
 
46
        GREP=/usr/xpg4/bin/grep
 
47
else
 
48
        GREP=grep
 
49
fi
 
50
 
 
51
#
 
52
# Figure out the proper echo options...
 
53
#
 
54
 
 
55
if (echo "testing\c"; echo 1,2,3) | $GREP c >/dev/null; then
 
56
        ac_n=-n
 
57
        ac_c=
 
58
else
 
59
        ac_n=
 
60
        ac_c='\c'
 
61
fi
 
62
 
 
63
#
 
64
# Greet the tester...
 
65
#
 
66
 
 
67
echo "Welcome to the CUPS Automated Test Script."
 
68
echo ""
 
69
echo "Before we begin, it is important that you understand that the larger"
 
70
echo "tests require significant amounts of RAM and disk space.  If you"
 
71
echo "attempt to run one of the big tests on a system that lacks sufficient"
 
72
echo "disk and virtual memory, the UNIX kernel might decide to kill one or"
 
73
echo "more system processes that you've grown attached to, like the X"
 
74
echo "server.  The question you may want to ask yourself before running a"
 
75
echo "large test is: Do you feel lucky?"
 
76
echo ""
 
77
echo "OK, now that we have the Dirty Harry quote out of the way, please"
 
78
echo "choose the type of test you wish to perform:"
 
79
echo ""
 
80
echo "0 - No testing, keep the scheduler running for me (all systems)"
 
81
echo "1 - Basic conformance test, no load testing (all systems)"
 
82
echo "2 - Basic conformance test, some load testing (minimum 256MB VM, 50MB disk)"
 
83
echo "3 - Basic conformance test, extreme load testing (minimum 1GB VM, 500MB disk)"
 
84
echo "4 - Basic conformance test, torture load testing (minimum 2GB VM, 1GB disk)"
 
85
echo ""
 
86
echo $ac_n "Enter the number of the test you wish to perform: [1] $ac_c"
 
87
 
 
88
if test $# -gt 0; then
 
89
        testtype=$1
 
90
        shift
 
91
else
 
92
        read testtype
 
93
fi
 
94
echo ""
 
95
 
 
96
case "$testtype" in
 
97
        0)
 
98
                echo "Running in test mode (0)"
 
99
                nprinters1=0
 
100
                nprinters2=0
 
101
                pjobs=0
 
102
                pprinters=0
 
103
                ;;
 
104
        2)
 
105
                echo "Running the medium tests (2)"
 
106
                nprinters1=10
 
107
                nprinters2=20
 
108
                pjobs=20
 
109
                pprinters=10
 
110
                ;;
 
111
        3)
 
112
                echo "Running the extreme tests (3)"
 
113
                nprinters1=500
 
114
                nprinters2=1000
 
115
                pjobs=100
 
116
                pprinters=50
 
117
                ;;
 
118
        4)
 
119
                echo "Running the torture tests (4)"
 
120
                nprinters1=10000
 
121
                nprinters2=20000
 
122
                pjobs=200
 
123
                pprinters=100
 
124
                ;;
 
125
        *)
 
126
                echo "Running the timid tests (1)"
 
127
                nprinters1=0
 
128
                nprinters2=0
 
129
                pjobs=10
 
130
                pprinters=0
 
131
                ;;
 
132
esac
 
133
 
 
134
#
 
135
# See if we want to do SSL testing...
 
136
#
 
137
 
 
138
echo ""
 
139
echo "Now you can choose whether to create a SSL/TLS encryption key and"
 
140
echo "certificate for testing; these tests currently require the OpenSSL"
 
141
echo "tools:"
 
142
echo ""
 
143
echo "0 - Do not do SSL/TLS encryption tests"
 
144
echo "1 - Test but do not require encryption"
 
145
echo "2 - Test and require encryption"
 
146
echo ""
 
147
echo $ac_n "Enter the number of the SSL/TLS tests to perform: [0] $ac_c"
 
148
 
 
149
if test $# -gt 0; then
 
150
        ssltype=$1
 
151
        shift
 
152
else
 
153
        read ssltype
 
154
fi
 
155
echo ""
 
156
 
 
157
case "$ssltype" in
 
158
        1)
 
159
                echo "Will test but not require encryption (1)"
 
160
                ;;
 
161
        2)
 
162
                echo "Will test and require encryption (2)"
 
163
                ;;
 
164
        *)
 
165
                echo "Not using SSL/TLS (0)"
 
166
                ssltype=0
 
167
                ;;
 
168
esac
 
169
 
 
170
#
 
171
# Information for the server/tests...
 
172
#
 
173
 
 
174
user="$USER"
 
175
if test -z "$user"; then
 
176
        if test -x /usr/ucb/whoami; then
 
177
                user=`/usr/ucb/whoami`
 
178
        else
 
179
                user=`whoami`
 
180
        fi
 
181
 
 
182
        if test -z "$user"; then
 
183
                user="unknown"
 
184
        fi
 
185
fi
 
186
 
 
187
port=8631
 
188
cwd=`pwd`
 
189
root=`dirname $cwd`
 
190
 
 
191
#
 
192
# Make sure that the LPDEST and PRINTER environment variables are
 
193
# not included in the environment that is passed to the tests.  These
 
194
# will usually cause tests to fail erroneously...
 
195
#
 
196
 
 
197
unset LPDEST
 
198
unset PRINTER
 
199
 
 
200
#
 
201
# See if we want to use valgrind...
 
202
#
 
203
 
 
204
echo ""
 
205
echo "This test script can use the Valgrind software from:"
 
206
echo ""
 
207
echo "    http://developer.kde.org/~sewardj/"
 
208
echo ""
 
209
echo $ac_n "Enter Y to use Valgrind or N to not use Valgrind: [N] $ac_c"
 
210
 
 
211
if test $# -gt 0; then
 
212
        usevalgrind=$1
 
213
        shift
 
214
else
 
215
        read usevalgrind
 
216
fi
 
217
echo ""
 
218
 
 
219
case "$usevalgrind" in
 
220
        Y* | y*)
 
221
                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"
 
222
                if test `uname` = Darwin; then
 
223
                        VALGRIND="$VALGRIND --dsymutil=yes"
 
224
                fi
 
225
                export VALGRIND
 
226
                echo "Using Valgrind; log files can be found in /tmp/cups-$user/log..."
 
227
                ;;
 
228
 
 
229
        *)
 
230
                VALGRIND=""
 
231
                export VALGRIND
 
232
                ;;
 
233
esac
 
234
 
 
235
#
 
236
# See if we want to do debug logging of the libraries...
 
237
#
 
238
 
 
239
echo ""
 
240
echo "If CUPS was built with the --enable-debug-printfs configure option, you"
 
241
echo "can enable debug logging of the libraries."
 
242
echo ""
 
243
echo $ac_n "Enter Y or a number from 0 to 9 to enable debug logging or N to not: [N] $ac_c"
 
244
 
 
245
if test $# -gt 0; then
 
246
        usedebugprintfs=$1
 
247
        shift
 
248
else
 
249
        read usedebugprintfs
 
250
fi
 
251
echo ""
 
252
 
 
253
case "$usedebugprintfs" in
 
254
        Y* | y*)
 
255
                echo "Enabling debug printfs; log files can be found in /tmp/cups-$user/log..."
 
256
                CUPS_DEBUG_LOG="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
 
257
                CUPS_DEBUG_LEVEL=5; export CUPS_DEBUG_LEVEL
 
258
                CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
 
259
                ;;
 
260
 
 
261
        0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9)
 
262
                echo "Enabling debug printfs; log files can be found in /tmp/cups-$user/log..."
 
263
                CUPS_DEBUG_LOG="/tmp/cups-$user/log/debug_printfs.%d"; export CUPS_DEBUG_LOG
 
264
                CUPS_DEBUG_LEVEL=$usedebugprintf; export CUPS_DEBUG_LEVEL
 
265
                CUPS_DEBUG_FILTER='^(http|_http|ipp|_ipp|cups.*Request|cupsGetResponse|cupsSend).*$'; export CUPS_DEBUG_FILTER
 
266
                ;;
 
267
 
 
268
        *)
 
269
                ;;
 
270
esac
 
271
 
 
272
#
 
273
# Start by creating temporary directories for the tests...
 
274
#
 
275
 
 
276
echo "Creating directories for test..."
 
277
 
 
278
rm -rf /tmp/cups-$user
 
279
mkdir /tmp/cups-$user
 
280
mkdir /tmp/cups-$user/bin
 
281
mkdir /tmp/cups-$user/bin/backend
 
282
mkdir /tmp/cups-$user/bin/driver
 
283
mkdir /tmp/cups-$user/bin/filter
 
284
mkdir /tmp/cups-$user/certs
 
285
mkdir /tmp/cups-$user/share
 
286
mkdir /tmp/cups-$user/share/banners
 
287
mkdir /tmp/cups-$user/share/drv
 
288
mkdir /tmp/cups-$user/share/locale
 
289
for file in ../locale/cups_*.po; do
 
290
        loc=`basename $file .po | cut -c 6-`
 
291
        mkdir /tmp/cups-$user/share/locale/$loc
 
292
        ln -s $root/locale/cups_$loc.po /tmp/cups-$user/share/locale/$loc
 
293
        ln -s $root/locale/ppdc_$loc.po /tmp/cups-$user/share/locale/$loc
 
294
done
 
295
mkdir /tmp/cups-$user/share/mime
 
296
mkdir /tmp/cups-$user/share/model
 
297
mkdir /tmp/cups-$user/share/ppdc
 
298
mkdir /tmp/cups-$user/interfaces
 
299
mkdir /tmp/cups-$user/log
 
300
mkdir /tmp/cups-$user/ppd
 
301
mkdir /tmp/cups-$user/spool
 
302
mkdir /tmp/cups-$user/spool/temp
 
303
mkdir /tmp/cups-$user/ssl
 
304
 
 
305
ln -s $root/backend/dnssd /tmp/cups-$user/bin/backend
 
306
ln -s $root/backend/http /tmp/cups-$user/bin/backend
 
307
ln -s $root/backend/ipp /tmp/cups-$user/bin/backend
 
308
ln -s $root/backend/lpd /tmp/cups-$user/bin/backend
 
309
ln -s $root/backend/mdns /tmp/cups-$user/bin/backend
 
310
ln -s $root/backend/pseudo /tmp/cups-$user/bin/backend
 
311
ln -s $root/backend/snmp /tmp/cups-$user/bin/backend
 
312
ln -s $root/backend/socket /tmp/cups-$user/bin/backend
 
313
ln -s $root/backend/usb /tmp/cups-$user/bin/backend
 
314
ln -s $root/cgi-bin /tmp/cups-$user/bin
 
315
ln -s $root/monitor /tmp/cups-$user/bin
 
316
ln -s $root/notifier /tmp/cups-$user/bin
 
317
ln -s $root/scheduler /tmp/cups-$user/bin/daemon
 
318
ln -s $root/filter/commandtops /tmp/cups-$user/bin/filter
 
319
ln -s $root/filter/gziptoany /tmp/cups-$user/bin/filter
 
320
ln -s $root/filter/pstops /tmp/cups-$user/bin/filter
 
321
ln -s $root/filter/rastertoepson /tmp/cups-$user/bin/filter
 
322
ln -s $root/filter/rastertohp /tmp/cups-$user/bin/filter
 
323
ln -s $root/filter/rastertolabel /tmp/cups-$user/bin/filter
 
324
ln -s $root/filter/rastertopwg /tmp/cups-$user/bin/filter
 
325
 
 
326
ln -s $root/data /tmp/cups-$user/share
 
327
ln -s $root/ppdc/sample.drv /tmp/cups-$user/share/drv
 
328
ln -s $root/conf/mime.types /tmp/cups-$user/share/mime
 
329
ln -s $root/conf/mime.convs /tmp/cups-$user/share/mime
 
330
ln -s $root/data/*.h /tmp/cups-$user/share/ppdc
 
331
ln -s $root/data/*.defs /tmp/cups-$user/share/ppdc
 
332
ln -s $root/templates /tmp/cups-$user/share
 
333
 
 
334
#
 
335
# Local filters and configuration files...
 
336
#
 
337
 
 
338
if test `uname` = Darwin; then
 
339
        ln -s /usr/libexec/cups/filter/cgpdfto* /tmp/cups-$user/bin/filter
 
340
        ln -s /usr/libexec/cups/filter/cgbannertopdf /tmp/cups-$user/bin/filter
 
341
        ln -s /usr/libexec/cups/filter/cgimagetopdf /tmp/cups-$user/bin/filter
 
342
        ln -s /usr/libexec/cups/filter/cgtexttopdf /tmp/cups-$user/bin/filter
 
343
        ln -s /usr/libexec/cups/filter/nsimagetopdf /tmp/cups-$user/bin/filter
 
344
        ln -s /usr/libexec/cups/filter/nstexttopdf /tmp/cups-$user/bin/filter
 
345
        ln -s /usr/libexec/cups/filter/pictwpstops /tmp/cups-$user/bin/filter
 
346
        ln -s /usr/libexec/cups/filter/pstoappleps /tmp/cups-$user/bin/filter
 
347
        ln -s /usr/libexec/cups/filter/pstocupsraster /tmp/cups-$user/bin/filter
 
348
        ln -s /usr/libexec/cups/filter/pstopdffilter /tmp/cups-$user/bin/filter
 
349
        ln -s /usr/libexec/cups/filter/rastertourf /tmp/cups-$user/bin/filter
 
350
        ln -s /usr/libexec/cups/filter/xhtmltopdf /tmp/cups-$user/bin/filter
 
351
 
 
352
        if test -f /private/etc/cups/apple.types; then
 
353
                ln -s /private/etc/cups/apple.* /tmp/cups-$user/share/mime
 
354
        elif test -f /usr/share/cups/mime/apple.types; then
 
355
                ln -s /usr/share/cups/mime/apple.* /tmp/cups-$user/share/mime
 
356
        fi
 
357
else
 
358
        ln -s /usr/lib/cups/filter/imagetops /tmp/cups-$user/bin/filter
 
359
        ln -s /usr/lib/cups/filter/imagetoraster /tmp/cups-$user/bin/filter
 
360
        ln -s /usr/lib/cups/filter/pdftops /tmp/cups-$user/bin/filter
 
361
        ln -s /usr/lib/cups/filter/texttops /tmp/cups-$user/bin/filter
 
362
 
 
363
        ln -s /usr/share/cups/mime/legacy.convs /tmp/cups-$user/share/mime
 
364
        ln -s /usr/share/cups/charsets /tmp/cups-$user/share
 
365
        if test -f $root/data/psglyphs; then
 
366
                ln -s /usr/share/cups/data/psglyphs $root/data
 
367
        fi
 
368
        ln -s /usr/share/cups/fonts /tmp/cups-$user/share
 
369
 
 
370
        #
 
371
        # cups-filters 1.0.36
 
372
        #
 
373
        ln -s /usr/share/cups/mime/cupsfilters.types /tmp/cups-$user/share/mime
 
374
        ln -s /usr/share/cups/mime/cupsfilters.convs /tmp/cups-$user/share/mime
 
375
 
 
376
        ln -s /usr/lib/cups/filter/bannertopdf /tmp/cups-$user/bin/filter
 
377
        ln -s /usr/lib/cups/filter/commandtoescpx /tmp/cups-$user/bin/filter
 
378
        ln -s /usr/lib/cups/filter/commandtopclx /tmp/cups-$user/bin/filter
 
379
        ln -s /usr/lib/cups/filter/gstopxl /tmp/cups-$user/bin/filter
 
380
        ln -s /usr/lib/cups/filter/gstoraster /tmp/cups-$user/bin/filter
 
381
        ln -s /usr/lib/cups/filter/imagetopdf /tmp/cups-$user/bin/filter
 
382
        ln -s /usr/lib/cups/filter/imagetops /tmp/cups-$user/bin/filter
 
383
        ln -s /usr/lib/cups/filter/imagetoraster /tmp/cups-$user/bin/filter
 
384
        ln -s /usr/lib/cups/filter/pdftoijs /tmp/cups-$user/bin/filter
 
385
        ln -s /usr/lib/cups/filter/pdftoopvp /tmp/cups-$user/bin/filter
 
386
        ln -s /usr/lib/cups/filter/pdftopdf /tmp/cups-$user/bin/filter
 
387
        ln -s /usr/lib/cups/filter/pdftops /tmp/cups-$user/bin/filter
 
388
        ln -s /usr/lib/cups/filter/pdftoraster /tmp/cups-$user/bin/filter
 
389
        ln -s /usr/lib/cups/filter/pstopdf /tmp/cups-$user/bin/filter
 
390
        ln -s /usr/lib/cups/filter/rastertoescpx /tmp/cups-$user/bin/filter
 
391
        ln -s /usr/lib/cups/filter/rastertopclx /tmp/cups-$user/bin/filter
 
392
        ln -s /usr/lib/cups/filter/textonly /tmp/cups-$user/bin/filter
 
393
        ln -s /usr/lib/cups/filter/texttopdf /tmp/cups-$user/bin/filter
 
394
        ln -s /usr/lib/cups/filter/texttops /tmp/cups-$user/bin/filter
 
395
        ln -s /usr/lib/cups/filter/urftopdf /tmp/cups-$user/bin/filter
 
396
 
 
397
        ln -s /usr/share/cups/banners/classified /tmp/cups-$user/share/banners
 
398
        ln -s /usr/share/cups/banners/confidential /tmp/cups-$user/share/banners
 
399
        ln -s /usr/share/cups/banners/secret /tmp/cups-$user/share/banners
 
400
        ln -s /usr/share/cups/banners/standard /tmp/cups-$user/share/banners
 
401
        ln -s /usr/share/cups/banners/topsecret /tmp/cups-$user/share/banners
 
402
        ln -s /usr/share/cups/banners/unclassified /tmp/cups-$user/share/banners
 
403
fi
 
404
 
 
405
#
 
406
# Then create the necessary config files...
 
407
#
 
408
 
 
409
echo "Creating cupsd.conf for test..."
 
410
 
 
411
if test $ssltype = 2; then
 
412
        encryption="Encryption Required"
 
413
else
 
414
        encryption=""
 
415
fi
 
416
 
 
417
cat >/tmp/cups-$user/cupsd.conf <<EOF
 
418
StrictConformance Yes
 
419
Browsing Off
 
420
Listen localhost:$port
 
421
PassEnv LOCALEDIR
 
422
PassEnv DYLD_INSERT_LIBRARIES
 
423
MaxSubscriptions 3
 
424
MaxLogSize 0
 
425
AccessLogLevel actions
 
426
LogLevel debug2
 
427
LogTimeFormat usecs
 
428
PreserveJobHistory Yes
 
429
<Policy default>
 
430
<Limit All>
 
431
Order Allow,Deny
 
432
$encryption
 
433
</Limit>
 
434
</Policy>
 
435
EOF
 
436
 
 
437
cat >/tmp/cups-$user/cups-files.conf <<EOF
 
438
FileDevice yes
 
439
Printcap
 
440
User $user
 
441
ServerRoot /tmp/cups-$user
 
442
StateDir /tmp/cups-$user
 
443
ServerBin /tmp/cups-$user/bin
 
444
CacheDir /tmp/cups-$user/share
 
445
DataDir /tmp/cups-$user/share
 
446
FontPath /tmp/cups-$user/share/fonts
 
447
DocumentRoot $root/doc
 
448
RequestRoot /tmp/cups-$user/spool
 
449
TempDir /tmp/cups-$user/spool/temp
 
450
PidFile /tmp/cups-$user/cupsd.pid
 
451
AccessLog /tmp/cups-$user/log/access_log
 
452
ErrorLog /tmp/cups-$user/log/error_log
 
453
PageLog /tmp/cups-$user/log/page_log
 
454
EOF
 
455
 
 
456
#
 
457
# Setup lots of test queues - half with PPD files, half without...
 
458
#
 
459
 
 
460
echo "Creating printers.conf for test..."
 
461
 
 
462
i=1
 
463
while test $i -le $nprinters1; do
 
464
        cat >>/tmp/cups-$user/printers.conf <<EOF
 
465
<Printer test-$i>
 
466
Accepting Yes
 
467
DeviceURI file:/dev/null
 
468
Info Test PS printer $i
 
469
JobSheets none none
 
470
Location CUPS test suite
 
471
State Idle
 
472
StateMessage Printer $1 is idle.
 
473
</Printer>
 
474
EOF
 
475
 
 
476
        cp testps.ppd /tmp/cups-$user/ppd/test-$i.ppd
 
477
 
 
478
        i=`expr $i + 1`
 
479
done
 
480
 
 
481
while test $i -le $nprinters2; do
 
482
        cat >>/tmp/cups-$user/printers.conf <<EOF
 
483
<Printer test-$i>
 
484
Accepting Yes
 
485
DeviceURI file:/dev/null
 
486
Info Test raw printer $i
 
487
JobSheets none none
 
488
Location CUPS test suite
 
489
State Idle
 
490
StateMessage Printer $1 is idle.
 
491
</Printer>
 
492
EOF
 
493
 
 
494
        i=`expr $i + 1`
 
495
done
 
496
 
 
497
if test -f /tmp/cups-$user/printers.conf; then
 
498
        cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig
 
499
else
 
500
        touch /tmp/cups-$user/printers.conf.orig
 
501
fi
 
502
 
 
503
#
 
504
# Setup the paths...
 
505
#
 
506
 
 
507
echo "Setting up environment variables for test..."
 
508
 
 
509
if test "x$LD_LIBRARY_PATH" = x; then
 
510
        LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
 
511
else
 
512
        LD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$LD_LIBRARY_PATH"
 
513
fi
 
514
 
 
515
export LD_LIBRARY_PATH
 
516
 
 
517
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"
 
518
if test `uname` = SunOS -a -r /usr/lib/libCrun.so.1; then
 
519
        LD_PRELOAD="/usr/lib/libCrun.so.1:$LD_PRELOAD"
 
520
fi
 
521
# Add cups-filters'
 
522
LD_PRELOAD="/usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/libcupsfilters.so.1:$LD_PRELOAD"
 
523
export LD_PRELOAD
 
524
 
 
525
if test "x$DYLD_LIBRARY_PATH" = x; then
 
526
        DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
 
527
else
 
528
        DYLD_LIBRARY_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$DYLD_LIBRARY_PATH"
 
529
fi
 
530
 
 
531
export DYLD_LIBRARY_PATH
 
532
 
 
533
if test "x$SHLIB_PATH" = x; then
 
534
        SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc"
 
535
else
 
536
        SHLIB_PATH="$root/cups:$root/filter:$root/cgi-bin:$root/scheduler:$root/ppdc:$SHLIB_PATH"
 
537
fi
 
538
 
 
539
export SHLIB_PATH
 
540
 
 
541
CUPS_DISABLE_APPLE_DEFAULT=yes; export CUPS_DISABLE_APPLE_DEFAULT
 
542
CUPS_SERVER=localhost:8631; export CUPS_SERVER
 
543
CUPS_SERVERROOT=/tmp/cups-$user; export CUPS_SERVERROOT
 
544
CUPS_STATEDIR=/tmp/cups-$user; export CUPS_STATEDIR
 
545
CUPS_DATADIR=/tmp/cups-$user/share; export CUPS_DATADIR
 
546
LOCALEDIR=/tmp/cups-$user/share/locale; export LOCALEDIR
 
547
 
 
548
#
 
549
# Set a new home directory to avoid getting user options mixed in...
 
550
#
 
551
 
 
552
HOME=/tmp/cups-$user
 
553
export HOME
 
554
 
 
555
#
 
556
# Force POSIX locale for tests...
 
557
#
 
558
 
 
559
LANG=C
 
560
export LANG
 
561
 
 
562
LC_MESSAGES=C
 
563
export LC_MESSAGES
 
564
 
 
565
#
 
566
# Start the server; run as foreground daemon in the background...
 
567
#
 
568
 
 
569
echo "Starting scheduler:"
 
570
echo "    $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &"
 
571
echo ""
 
572
 
 
573
if test `uname` = Darwin -a "x$VALGRIND" = x; then
 
574
        DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib
 
575
        ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
 
576
else
 
577
        $VALGRIND ../scheduler/cupsd -c /tmp/cups-$user/cupsd.conf -f >/tmp/cups-$user/log/debug_log 2>&1 &
 
578
fi
 
579
 
 
580
cupsd=$!
 
581
 
 
582
if test "x$testtype" = x0; then
 
583
        # Not running tests...
 
584
        echo "Scheduler is PID $cupsd and is listening on port 8631."
 
585
        echo ""
 
586
 
 
587
        # Create a helper script to run programs with...
 
588
        runcups="/tmp/cups-$user/runcups"
 
589
 
 
590
        echo "#!/bin/sh" >$runcups
 
591
        echo "# Helper script for running CUPS test instance." >>$runcups
 
592
        echo "" >>$runcups
 
593
        echo "# Set required environment variables..." >>$runcups
 
594
        echo "CUPS_DATADIR=\"$CUPS_DATADIR\"; export CUPS_DATADIR" >>$runcups
 
595
        echo "CUPS_SERVER=\"$CUPS_SERVER\"; export CUPS_SERVER" >>$runcups
 
596
        echo "CUPS_SERVERROOT=\"$CUPS_SERVERROOT\"; export CUPS_SERVERROOT" >>$runcups
 
597
        echo "CUPS_STATEDIR=\"$CUPS_STATEDIR\"; export CUPS_STATEDIR" >>$runcups
 
598
        echo "DYLD_LIBRARY_PATH=\"$DYLD_LIBRARY_PATH\"; export DYLD_LIBRARY_PATH" >>$runcups
 
599
        echo "LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\"; export LD_LIBRARY_PATH" >>$runcups
 
600
        echo "LD_PRELOAD=\"$LD_PRELOAD\"; export LD_PRELOAD" >>$runcups
 
601
        echo "LOCALEDIR=\"$LOCALEDIR\"; export LOCALEDIR" >>$runcups
 
602
        echo "SHLIB_PATH=\"$SHLIB_PATH\"; export SHLIB_PATH" >>$runcups
 
603
        echo "" >>$runcups
 
604
        echo "# Run command..." >>$runcups
 
605
        echo "exec \"\$@\"" >>$runcups
 
606
 
 
607
        chmod +x $runcups
 
608
 
 
609
        echo "The $runcups helper script can be used to test programs"
 
610
        echo "with the server."
 
611
        exit 0
 
612
fi
 
613
 
 
614
if test $argcount -eq 0; then
 
615
        echo "Scheduler is PID $cupsd; run debugger now if you need to."
 
616
        echo ""
 
617
        echo $ac_n "Press ENTER to continue... $ac_c"
 
618
        read junk
 
619
else
 
620
        echo "Scheduler is PID $cupsd."
 
621
        sleep 2
 
622
fi
 
623
 
 
624
IPP_PORT=$port; export IPP_PORT
 
625
 
 
626
while true; do
 
627
        running=`../systemv/lpstat -r 2>/dev/null`
 
628
        if test "x$running" = "xscheduler is running"; then
 
629
                break
 
630
        fi
 
631
 
 
632
        echo "Waiting for scheduler to become ready..."
 
633
        sleep 10
 
634
done
 
635
 
 
636
#
 
637
# Create the test report source file...
 
638
#
 
639
 
 
640
date=`date "+%Y-%m-%d"`
 
641
strfile=/tmp/cups-$user/cups-str-1.6-$date-$user.html
 
642
 
 
643
rm -f $strfile
 
644
cat str-header.html >$strfile
 
645
 
 
646
#
 
647
# Run the IPP tests...
 
648
#
 
649
 
 
650
echo ""
 
651
echo "Running IPP compliance tests..."
 
652
 
 
653
echo "<H1>1 - IPP Compliance Tests</H1>" >>$strfile
 
654
echo "<P>This section provides the results to the IPP compliance tests" >>$strfile
 
655
echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
 
656
echo `date "+%Y-%m-%d"` by $user on `hostname`. >>$strfile
 
657
echo "<PRE>" >>$strfile
 
658
 
 
659
fail=0
 
660
for file in 4*.test ipp-2.1.test; do
 
661
        echo $ac_n "Performing $file: $ac_c"
 
662
        echo "" >>$strfile
 
663
 
 
664
        if test $file = ipp-2.1.test; then
 
665
                uri="ipp://localhost:$port/printers/Test1"
 
666
                options="-V 2.1 -d NOPRINT=1 -f testfile.ps"
 
667
        else
 
668
                uri="ipp://localhost:$port/printers"
 
669
                options=""
 
670
        fi
 
671
        $VALGRIND ./ipptool -tI $options $uri $file >> $strfile
 
672
        status=$?
 
673
 
 
674
        if test $status != 0; then
 
675
                echo FAIL
 
676
                fail=`expr $fail + 1`
 
677
        else
 
678
                echo PASS
 
679
        fi
 
680
done
 
681
 
 
682
echo "</PRE>" >>$strfile
 
683
 
 
684
#
 
685
# Run the command tests...
 
686
#
 
687
 
 
688
echo ""
 
689
echo "Running command tests..."
 
690
 
 
691
echo "<H1>2 - Command Tests</H1>" >>$strfile
 
692
echo "<P>This section provides the results to the command tests" >>$strfile
 
693
echo "outlined in the CUPS Software Test Plan. These tests were run on" >>$strfile
 
694
echo $date by $user on `hostname`. >>$strfile
 
695
echo "<PRE>" >>$strfile
 
696
 
 
697
for file in 5*.sh; do
 
698
        #
 
699
        # Make sure the past jobs are done before going on.
 
700
        #
 
701
        ./waitjobs.sh 1800
 
702
 
 
703
        echo $ac_n "Performing $file: $ac_c"
 
704
        echo "" >>$strfile
 
705
        echo "\"$file\":" >>$strfile
 
706
 
 
707
        sh $file $pjobs $pprinters >> $strfile
 
708
        status=$?
 
709
 
 
710
        if test $status != 0; then
 
711
                echo FAIL
 
712
                fail=`expr $fail + 1`
 
713
        else
 
714
                echo PASS
 
715
        fi
 
716
done
 
717
 
 
718
echo "</PRE>" >>$strfile
 
719
 
 
720
#
 
721
# Stop the server...
 
722
#
 
723
 
 
724
kill $cupsd
 
725
 
 
726
#
 
727
# Append the log files for post-mortim...
 
728
#
 
729
 
 
730
echo "<H1>3 - Log Files</H1>" >>$strfile
 
731
 
 
732
#
 
733
# Verify counts...
 
734
#
 
735
 
 
736
echo "Test Summary"
 
737
echo ""
 
738
echo "<H2>Summary</H2>" >>$strfile
 
739
 
 
740
# Job control files
 
741
count=`ls -1 /tmp/cups-$user/spool | wc -l`
 
742
count=`expr $count - 1`
 
743
if test $count != 0; then
 
744
        echo "FAIL: $count job control files were not purged."
 
745
        echo "<P>FAIL: $count job control files were not purged.</P>" >>$strfile
 
746
        fail=`expr $fail + 1`
 
747
else
 
748
        echo "PASS: All job control files purged."
 
749
        echo "<P>PASS: All job control files purged.</P>" >>$strfile
 
750
fi
 
751
 
 
752
# Pages printed on Test1 (within 1 page for timing-dependent cancel issues)
 
753
count=`$GREP '^Test1 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
 
754
expected=`expr $pjobs \* 2 + 34`
 
755
expected2=`expr $expected + 2`
 
756
if test $count -lt $expected -a $count -gt $expected2; then
 
757
        echo "FAIL: Printer 'Test1' produced $count page(s), expected $expected."
 
758
        echo "<P>FAIL: Printer 'Test1' produced $count page(s), expected $expected.</P>" >>$strfile
 
759
        fail=`expr $fail + 1`
 
760
else
 
761
        echo "PASS: Printer 'Test1' correctly produced $count page(s)."
 
762
        echo "<P>PASS: Printer 'Test1' correctly produced $count page(s).</P>" >>$strfile
 
763
fi
 
764
 
 
765
# Paged printed on Test2
 
766
count=`$GREP '^Test2 ' /tmp/cups-$user/log/page_log | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
 
767
expected=`expr $pjobs \* 2 + 3`
 
768
if test $count != $expected; then
 
769
        echo "FAIL: Printer 'Test2' produced $count page(s), expected $expected."
 
770
        echo "<P>FAIL: Printer 'Test2' produced $count page(s), expected $expected.</P>" >>$strfile
 
771
        fail=`expr $fail + 1`
 
772
else
 
773
        echo "PASS: Printer 'Test2' correctly produced $count page(s)."
 
774
        echo "<P>PASS: Printer 'Test2' correctly produced $count page(s).</P>" >>$strfile
 
775
fi
 
776
 
 
777
# Paged printed on Test3
 
778
count=`$GREP '^Test3 ' /tmp/cups-$user/log/page_log | grep -v total | awk 'BEGIN{count=0}{count=count+$7}END{print count}'`
 
779
expected=2
 
780
if test $count != $expected; then
 
781
        echo "FAIL: Printer 'Test3' produced $count page(s), expected $expected."
 
782
        echo "<P>FAIL: Printer 'Test3' produced $count page(s), expected $expected.</P>" >>$strfile
 
783
        fail=`expr $fail + 1`
 
784
else
 
785
        echo "PASS: Printer 'Test3' correctly produced $count page(s)."
 
786
        echo "<P>PASS: Printer 'Test3' correctly produced $count page(s).</P>" >>$strfile
 
787
fi
 
788
 
 
789
# Requests logged
 
790
count=`wc -l /tmp/cups-$user/log/access_log | awk '{print $1}'`
 
791
expected=`expr 37 + 18 + 28 + $pjobs \* 8 + $pprinters \* $pjobs \* 4`
 
792
if test $count != $expected; then
 
793
        echo "FAIL: $count requests logged, expected $expected."
 
794
        echo "<P>FAIL: $count requests logged, expected $expected.</P>" >>$strfile
 
795
        fail=`expr $fail + 1`
 
796
else
 
797
        echo "PASS: $count requests logged."
 
798
        echo "<P>PASS: $count requests logged.</P>" >>$strfile
 
799
fi
 
800
 
 
801
# Did CUPS-Get-Default get logged?
 
802
if $GREP -q CUPS-Get-Default /tmp/cups-$user/log/access_log; then
 
803
        echo "FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'"
 
804
        echo "<P>FAIL: CUPS-Get-Default logged with 'AccessLogLevel actions'</P>" >>$strfile
 
805
        echo "<PRE>" >>$strfile
 
806
        $GREP CUPS-Get-Default /tmp/cups-$user/log/access_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
 
807
        echo "</PRE>" >>$strfile
 
808
        fail=`expr $fail + 1`
 
809
else
 
810
        echo "PASS: CUPS-Get-Default not logged."
 
811
        echo "<P>PASS: CUPS-Get-Default not logged.</P>" >>$strfile
 
812
fi
 
813
 
 
814
# Emergency log messages
 
815
count=`$GREP '^X ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 
816
if test $count != 0; then
 
817
        echo "FAIL: $count emergency messages, expected 0."
 
818
        $GREP '^X ' /tmp/cups-$user/log/error_log
 
819
        echo "<P>FAIL: $count emergency messages, expected 0.</P>" >>$strfile
 
820
        echo "<PRE>" >>$strfile
 
821
        $GREP '^X ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
 
822
        echo "</PRE>" >>$strfile
 
823
        fail=`expr $fail + 1`
 
824
else
 
825
        echo "PASS: $count emergency messages."
 
826
        echo "<P>PASS: $count emergency messages.</P>" >>$strfile
 
827
fi
 
828
 
 
829
# Alert log messages
 
830
count=`$GREP '^A ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 
831
if test $count != 0; then
 
832
        echo "FAIL: $count alert messages, expected 0."
 
833
        $GREP '^A ' /tmp/cups-$user/log/error_log
 
834
        echo "<P>FAIL: $count alert messages, expected 0.</P>" >>$strfile
 
835
        echo "<PRE>" >>$strfile
 
836
        $GREP '^A ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
 
837
        echo "</PRE>" >>$strfile
 
838
        fail=`expr $fail + 1`
 
839
else
 
840
        echo "PASS: $count alert messages."
 
841
        echo "<P>PASS: $count alert messages.</P>" >>$strfile
 
842
fi
 
843
 
 
844
# Critical log messages
 
845
count=`$GREP '^C ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 
846
if test $count != 0; then
 
847
        echo "FAIL: $count critical messages, expected 0."
 
848
        $GREP '^C ' /tmp/cups-$user/log/error_log
 
849
        echo "<P>FAIL: $count critical messages, expected 0.</P>" >>$strfile
 
850
        echo "<PRE>" >>$strfile
 
851
        $GREP '^C ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
 
852
        echo "</PRE>" >>$strfile
 
853
        fail=`expr $fail + 1`
 
854
else
 
855
        echo "PASS: $count critical messages."
 
856
        echo "<P>PASS: $count critical messages.</P>" >>$strfile
 
857
fi
 
858
 
 
859
# Error log messages
 
860
count=`$GREP '^E ' /tmp/cups-$user/log/error_log | grep -v '(usb) crashed on signal 11' | grep -v '(dnssd) stopped with status 1' | wc -l | awk '{print $1}'`
 
861
if test $count != 33; then
 
862
        echo "FAIL: $count error messages, expected 33."
 
863
        $GREP '^E ' /tmp/cups-$user/log/error_log
 
864
        echo "<P>FAIL: $count error messages, expected 33.</P>" >>$strfile
 
865
        echo "<PRE>" >>$strfile
 
866
        $GREP '^E ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
 
867
        echo "</PRE>" >>$strfile
 
868
        fail=`expr $fail + 1`
 
869
else
 
870
        echo "PASS: $count error messages."
 
871
        echo "<P>PASS: $count error messages.</P>" >>$strfile
 
872
fi
 
873
 
 
874
# Warning log messages
 
875
count=`$GREP '^W ' /tmp/cups-$user/log/error_log | grep -v 'Unable to initialize USB access via libusb, libusb error' | grep -v 'org.freedesktop.ColorManager' | grep -v -E 'Avahi client failed: -(1|26)' | wc -l | awk '{print $1}'`
 
876
if test $count != 9; then
 
877
        echo "FAIL: $count warning messages, expected 9."
 
878
        $GREP '^W ' /tmp/cups-$user/log/error_log
 
879
        echo "<P>FAIL: $count warning messages, expected 9.</P>" >>$strfile
 
880
        echo "<PRE>" >>$strfile
 
881
        $GREP '^W ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
 
882
        echo "</PRE>" >>$strfile
 
883
        fail=`expr $fail + 1`
 
884
else
 
885
        echo "PASS: $count warning messages."
 
886
        echo "<P>PASS: $count warning messages.</P>" >>$strfile
 
887
fi
 
888
 
 
889
# Notice log messages
 
890
count=`$GREP '^N ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 
891
if test $count != 0; then
 
892
        echo "FAIL: $count notice messages, expected 0."
 
893
        $GREP '^N ' /tmp/cups-$user/log/error_log
 
894
        echo "<P>FAIL: $count notice messages, expected 0.</P>" >>$strfile
 
895
        echo "<PRE>" >>$strfile
 
896
        $GREP '^N ' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
 
897
        echo "</PRE>" >>$strfile
 
898
        fail=`expr $fail + 1`
 
899
else
 
900
        echo "PASS: $count notice messages."
 
901
        echo "<P>PASS: $count notice messages.</P>" >>$strfile
 
902
fi
 
903
 
 
904
# Info log messages
 
905
count=`$GREP '^I ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 
906
if test $count = 0; then
 
907
        echo "FAIL: $count info messages, expected more than 0."
 
908
        echo "<P>FAIL: $count info messages, expected more than 0.</P>" >>$strfile
 
909
        fail=`expr $fail + 1`
 
910
else
 
911
        echo "PASS: $count info messages."
 
912
        echo "<P>PASS: $count info messages.</P>" >>$strfile
 
913
fi
 
914
 
 
915
# Debug log messages
 
916
count=`$GREP '^D ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 
917
if test $count = 0; then
 
918
        echo "FAIL: $count debug messages, expected more than 0."
 
919
        echo "<P>FAIL: $count debug messages, expected more than 0.</P>" >>$strfile
 
920
        fail=`expr $fail + 1`
 
921
else
 
922
        echo "PASS: $count debug messages."
 
923
        echo "<P>PASS: $count debug messages.</P>" >>$strfile
 
924
fi
 
925
 
 
926
# Debug2 log messages
 
927
count=`$GREP '^d ' /tmp/cups-$user/log/error_log | wc -l | awk '{print $1}'`
 
928
if test $count = 0; then
 
929
        echo "FAIL: $count debug2 messages, expected more than 0."
 
930
        echo "<P>FAIL: $count debug2 messages, expected more than 0.</P>" >>$strfile
 
931
        fail=`expr $fail + 1`
 
932
else
 
933
        echo "PASS: $count debug2 messages."
 
934
        echo "<P>PASS: $count debug2 messages.</P>" >>$strfile
 
935
fi
 
936
 
 
937
# Log files...
 
938
echo "<H2>access_log</H2>" >>$strfile
 
939
echo "<PRE>" >>$strfile
 
940
sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' /tmp/cups-$user/log/access_log >>$strfile
 
941
echo "</PRE>" >>$strfile
 
942
 
 
943
echo "<H2>error_log</H2>" >>$strfile
 
944
echo "<PRE>" >>$strfile
 
945
$GREP -v '^d' /tmp/cups-$user/log/error_log | sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' >>$strfile
 
946
echo "</PRE>" >>$strfile
 
947
 
 
948
echo "<H2>page_log</H2>" >>$strfile
 
949
echo "<PRE>" >>$strfile
 
950
sed -e '1,$s/&/&amp;/g' -e '1,$s/</&lt;/g' /tmp/cups-$user/log/page_log >>$strfile
 
951
echo "</PRE>" >>$strfile
 
952
 
 
953
#
 
954
# Format the reports and tell the user where to find them...
 
955
#
 
956
 
 
957
cat str-trailer.html >>$strfile
 
958
 
 
959
echo ""
 
960
 
 
961
if test $fail != 0; then
 
962
        echo "$fail tests failed."
 
963
        cp /tmp/cups-$user/log/error_log error_log-$date-$user
 
964
        cp $strfile .
 
965
else
 
966
        echo "All tests were successful."
 
967
fi
 
968
 
 
969
echo "Log files can be found in /tmp/cups-$user/log."
 
970
echo "A HTML report was created in $strfile."
 
971
echo ""
 
972
 
 
973
if test $fail != 0; then
 
974
        echo "Copies of the error_log and `basename $strfile` files are in"
 
975
        echo "`pwd`."
 
976
        echo ""
 
977
 
 
978
        exit 1
 
979
fi
 
980
 
 
981
#
 
982
# End of "$Id: run-stp-tests.sh 9034 2010-03-09 07:03:06Z mike $"
 
983
#