diff options
Diffstat (limited to 'config_test')
-rw-r--r-- | config_test/Makefile | 6 | ||||
-rwxr-xr-x | config_test/run_tests | 40 |
2 files changed, 31 insertions, 15 deletions
diff --git a/config_test/Makefile b/config_test/Makefile index 295696e9..1064d569 100644 --- a/config_test/Makefile +++ b/config_test/Makefile | |||
@@ -1,9 +1,11 @@ | |||
1 | 1 | ||
2 | all: child_test.c | 2 | all: child_test |
3 | |||
4 | child_test: child_test.c | ||
3 | gcc -o child_test child_test.c | 5 | gcc -o child_test child_test.c |
4 | 6 | ||
5 | test: | 7 | test: |
6 | ./run_tests 10 | 8 | ./run_tests 10 100 > /dev/null |
7 | 9 | ||
8 | clean: | 10 | clean: |
9 | rm -f child_test | 11 | rm -f child_test |
diff --git a/config_test/run_tests b/config_test/run_tests index e41db232..e7db3cae 100755 --- a/config_test/run_tests +++ b/config_test/run_tests | |||
@@ -1,16 +1,30 @@ | |||
1 | #!/bin/ksh | 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 | ||
2 | 7 | ||
3 | i=0 | 8 | total_runs=$2 |
4 | success=0 | 9 | [[ -z $total_runs ]] && total_runs=1 |
5 | fail=0 | 10 | run=1 |
6 | while [[ $i -lt $1 ]] ; do | 11 | while [[ $run -le $total_runs ]] ; do |
7 | ./child_test | 12 | i=0 |
8 | if [[ $? -eq 0 ]] ; then | 13 | success=0 |
9 | success=$(($success+1)) | 14 | fail=0 |
10 | else | 15 | while [[ $i -lt $1 ]] ; do |
11 | fail=$((fail+1)) | 16 | ./child_test |
12 | fi | 17 | if [[ $? -eq 0 ]] ; then |
13 | i=$(($i+1)) | 18 | success=$(($success+1)) |
19 | else | ||
20 | fail=$((fail+1)) | ||
21 | fi | ||
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 "." | ||
14 | done | 28 | done |
15 | print "Success=$success Fail=$fail" | 29 | [[ $total_runs -gt 1 ]] && print -u2 |
16 | [[ $fail -gt 0 ]] && exit 1 | 30 | exit 0 |