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