]> git.ipfire.org Git - thirdparty/cups.git/blob - test/waitjobs.sh
Update test suite for new location of test files.
[thirdparty/cups.git] / test / waitjobs.sh
1 #!/bin/sh
2 #
3 # Script to wait for jobs to complete.
4 #
5 # Copyright © 2008-2019 by Apple Inc.
6 #
7 # Licensed under Apache License v2.0. See the file "LICENSE" for more
8 # information.
9 #
10
11 #
12 # Get timeout from command-line
13 #
14
15 if test $# = 1; then
16 timeout=$1
17 else
18 timeout=360
19 fi
20
21 #
22 # Figure out the proper echo options...
23 #
24
25 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
26 ac_n=-n
27 ac_c=
28 else
29 ac_n=
30 ac_c='\c'
31 fi
32
33 echo $ac_n "Waiting for jobs to complete...$ac_c"
34 oldjobs=0
35
36 while test $timeout -gt 0; do
37 jobs=`$runcups ../systemv/lpstat 2>/dev/null | wc -l | tr -d ' '`
38 if test $jobs = 0; then
39 break
40 fi
41
42 if test $jobs != $oldjobs; then
43 echo $ac_n "$jobs...$ac_c"
44 oldjobs=$jobs
45 fi
46
47 sleep 5
48 timeout=`expr $timeout - 5`
49 done
50
51 echo ""