4
0

run_tests 690 B

123456789101112131415161718192021222324252627282930
  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
  7. total_runs=$2
  8. [[ -z $total_runs ]] && total_runs=1
  9. run=1
  10. while [[ $run -le $total_runs ]] ; do
  11. i=0
  12. success=0
  13. fail=0
  14. while [[ $i -lt $1 ]] ; do
  15. ./child_test
  16. if [[ $? -eq 0 ]] ; then
  17. success=$(($success+1))
  18. else
  19. fail=$((fail+1))
  20. fi
  21. i=$(($i+1))
  22. done
  23. print "Success=$success Fail=$fail"
  24. [[ $fail -gt 0 ]] && exit 1
  25. run=$(($run+1))
  26. [[ $total_runs -gt 1 ]] && print -u2 -n "."
  27. done
  28. [[ $total_runs -gt 1 ]] && print -u2
  29. exit 0