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