File: run_until_fail.sh

package info (click to toggle)
rust-capstone 0.13.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 824 kB
  • sloc: sh: 341; ansic: 6; makefile: 2
file content (22 lines) | stat: -rwxr-xr-x 437 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
# Run command for MAX_ITER iterations or until the command fails.

iter=0
MAX_ITER=${MAX_ITER:-1000}

while [ $iter -lt $MAX_ITER ]
do
    # Print message every 100 iterations
    if [ $(expr $iter % 100) = 0 ]; then
        echo iter $iter
    fi

    if ! output="$("$@" 2>&1)"; then
        echo "$output"
        echo
        echo "Failed after $iter tests"
        exit 1
    fi

    iter=$(expr $iter + 1)
done