1*5e7646d2SAndroid Build Coastguard Worker#!/bin/sh 2*5e7646d2SAndroid Build Coastguard Worker# 3*5e7646d2SAndroid Build Coastguard Worker# Test the lp command. 4*5e7646d2SAndroid Build Coastguard Worker# 5*5e7646d2SAndroid Build Coastguard Worker# Copyright © 2007-2019 by Apple Inc. 6*5e7646d2SAndroid Build Coastguard Worker# Copyright © 1997-2005 by Easy Software Products, all rights reserved. 7*5e7646d2SAndroid Build Coastguard Worker# 8*5e7646d2SAndroid Build Coastguard Worker# Licensed under Apache License v2.0. See the file "LICENSE" for more 9*5e7646d2SAndroid Build Coastguard Worker# information. 10*5e7646d2SAndroid Build Coastguard Worker# 11*5e7646d2SAndroid Build Coastguard Worker 12*5e7646d2SAndroid Build Coastguard Workerecho "LP Default Test" 13*5e7646d2SAndroid Build Coastguard Workerecho "" 14*5e7646d2SAndroid Build Coastguard Workerecho " lp testfile.pdf" 15*5e7646d2SAndroid Build Coastguard Worker$runcups $VALGRIND ../systemv/lp ../examples/testfile.pdf 2>&1 16*5e7646d2SAndroid Build Coastguard Workerif test $? != 0; then 17*5e7646d2SAndroid Build Coastguard Worker echo " FAILED" 18*5e7646d2SAndroid Build Coastguard Worker exit 1 19*5e7646d2SAndroid Build Coastguard Workerelse 20*5e7646d2SAndroid Build Coastguard Worker echo " PASSED" 21*5e7646d2SAndroid Build Coastguard Workerfi 22*5e7646d2SAndroid Build Coastguard Workerecho "" 23*5e7646d2SAndroid Build Coastguard Worker 24*5e7646d2SAndroid Build Coastguard Workerecho "LP Destination Test" 25*5e7646d2SAndroid Build Coastguard Workerecho "" 26*5e7646d2SAndroid Build Coastguard Workerecho " lp -d Test3 -o fit-to-page testfile.jpg" 27*5e7646d2SAndroid Build Coastguard Worker$runcups $VALGRIND ../systemv/lp -d Test3 -o fit-to-page ../examples/testfile.jpg 2>&1 28*5e7646d2SAndroid Build Coastguard Workerif test $? != 0; then 29*5e7646d2SAndroid Build Coastguard Worker echo " FAILED" 30*5e7646d2SAndroid Build Coastguard Worker exit 1 31*5e7646d2SAndroid Build Coastguard Workerelse 32*5e7646d2SAndroid Build Coastguard Worker echo " PASSED" 33*5e7646d2SAndroid Build Coastguard Workerfi 34*5e7646d2SAndroid Build Coastguard Workerecho "" 35*5e7646d2SAndroid Build Coastguard Worker 36*5e7646d2SAndroid Build Coastguard Workerecho "LP Options Test" 37*5e7646d2SAndroid Build Coastguard Workerecho "" 38*5e7646d2SAndroid Build Coastguard Workerecho " lp -d Test1 -P 1-4 -o job-sheets=classified,classified testfile.pdf" 39*5e7646d2SAndroid Build Coastguard Worker$runcups $VALGRIND ../systemv/lp -d Test1 -P 1-4 -o job-sheets=classified,classified ../examples/testfile.pdf 2>&1 40*5e7646d2SAndroid Build Coastguard Workerif test $? != 0; then 41*5e7646d2SAndroid Build Coastguard Worker echo " FAILED" 42*5e7646d2SAndroid Build Coastguard Worker exit 1 43*5e7646d2SAndroid Build Coastguard Workerelse 44*5e7646d2SAndroid Build Coastguard Worker echo " PASSED" 45*5e7646d2SAndroid Build Coastguard Workerfi 46*5e7646d2SAndroid Build Coastguard Workerecho "" 47*5e7646d2SAndroid Build Coastguard Worker 48*5e7646d2SAndroid Build Coastguard Workerecho "LP Flood Test ($1 times in parallel)" 49*5e7646d2SAndroid Build Coastguard Workerecho "" 50*5e7646d2SAndroid Build Coastguard Workerecho " lp -d Test1 testfile.jpg" 51*5e7646d2SAndroid Build Coastguard Workerecho " lp -d Test2 testfile.jpg" 52*5e7646d2SAndroid Build Coastguard Workeri=0 53*5e7646d2SAndroid Build Coastguard Workerpids="" 54*5e7646d2SAndroid Build Coastguard Workerwhile test $i -lt $1; do 55*5e7646d2SAndroid Build Coastguard Worker j=1 56*5e7646d2SAndroid Build Coastguard Worker while test $j -le $2; do 57*5e7646d2SAndroid Build Coastguard Worker $runcups $VALGRIND ../systemv/lp -d test-$j ../examples/testfile.jpg 2>&1 58*5e7646d2SAndroid Build Coastguard Worker j=`expr $j + 1` 59*5e7646d2SAndroid Build Coastguard Worker done 60*5e7646d2SAndroid Build Coastguard Worker 61*5e7646d2SAndroid Build Coastguard Worker $runcups $VALGRIND ../systemv/lp -d Test1 ../examples/testfile.jpg 2>&1 & 62*5e7646d2SAndroid Build Coastguard Worker pids="$pids $!" 63*5e7646d2SAndroid Build Coastguard Worker $runcups $VALGRIND ../systemv/lp -d Test2 ../examples/testfile.jpg 2>&1 & 64*5e7646d2SAndroid Build Coastguard Worker pids="$pids $!" 65*5e7646d2SAndroid Build Coastguard Worker 66*5e7646d2SAndroid Build Coastguard Worker i=`expr $i + 1` 67*5e7646d2SAndroid Build Coastguard Workerdone 68*5e7646d2SAndroid Build Coastguard Workerwait $pids 69*5e7646d2SAndroid Build Coastguard Workerif test $? != 0; then 70*5e7646d2SAndroid Build Coastguard Worker echo " FAILED" 71*5e7646d2SAndroid Build Coastguard Worker exit 1 72*5e7646d2SAndroid Build Coastguard Workerelse 73*5e7646d2SAndroid Build Coastguard Worker echo " PASSED" 74*5e7646d2SAndroid Build Coastguard Workerfi 75*5e7646d2SAndroid Build Coastguard Workerecho "" 76*5e7646d2SAndroid Build Coastguard Worker 77*5e7646d2SAndroid Build Coastguard Worker./waitjobs.sh 78*5e7646d2SAndroid Build Coastguard Worker 79*5e7646d2SAndroid Build Coastguard Workerecho "LPSTAT Completed Jobs Order Test" 80*5e7646d2SAndroid Build Coastguard Workerecho "" 81*5e7646d2SAndroid Build Coastguard Workerecho " lpstat -W completed -o" 82*5e7646d2SAndroid Build Coastguard Worker$runcups $VALGRIND ../systemv/lpstat -W completed -o | tee $BASE/lpstat-completed.txt 83*5e7646d2SAndroid Build Coastguard Workerif test "`uniq -d $BASE/lpstat-completed.txt`" != ""; then 84*5e7646d2SAndroid Build Coastguard Worker echo " FAILED" 85*5e7646d2SAndroid Build Coastguard Worker exit 1 86*5e7646d2SAndroid Build Coastguard Workerelse 87*5e7646d2SAndroid Build Coastguard Worker echo " PASSED" 88*5e7646d2SAndroid Build Coastguard Workerfi 89*5e7646d2SAndroid Build Coastguard Workerecho "" 90