Merge pull request #1469 from sni/master
[monitoring-plugins.git] / config_test / run_tests
blobe7db3cae7f84b236ae934f28cb1f2290defbd787
1 #!/bin/ksh
2 # $1 is the number of iterations to run
3 # If $2 is specified, this is the number of times you run each iteration
4 # If there is a fail at run, exit 1
5 # Prints to stdout # of successes and passes
6 # Prints to stderr a dot for each run
8 total_runs=$2
9 [[ -z $total_runs ]] && total_runs=1
10 run=1
11 while [[ $run -le $total_runs ]] ; do
12 i=0
13 success=0
14 fail=0
15 while [[ $i -lt $1 ]] ; do
16 ./child_test
17 if [[ $? -eq 0 ]] ; then
18 success=$(($success+1))
19 else
20 fail=$((fail+1))
22 i=$(($i+1))
23 done
24 print "Success=$success Fail=$fail"
25 [[ $fail -gt 0 ]] && exit 1
26 run=$(($run+1))
27 [[ $total_runs -gt 1 ]] && print -u2 -n "."
28 done
29 [[ $total_runs -gt 1 ]] && print -u2
30 exit 0