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