source: tools/repeat @ 2b7bf59

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 2b7bf59 was e1c1829, checked in by Thierry Delisle <tdelisle@…>, 7 years ago

Added monitor tests to preempt longrun tests

  • Property mode set to 100755
File size: 551 bytes
RevLine 
[cc3e4d0]1#!/bin/bash
2
3if [ $1 == "-h" -o $1 == "--help" ]; then
4        echo "$(basename $0) [-s|-p] ITERATIONS COMMAND"
5        exit
6fi
7
8ACTION=$1
9ITERATION=$2
10shift 2
11
12_term() { 
13  echo "Caught SIGTERM signal!" 
14  kill -TERM "$child" 2>/dev/null
15  exit
16}
17
18trap _term SIGTERM SIGINT
19
20for (( i = 0; i < ITERATION; i ++ )); do
21        echo -ne "\r$i / $ITERATION"
[e1c1829]22        $@ > /dev/null &
[cc3e4d0]23        child=$! 
24        wait "$child"
25        RET=$?
26        if [ $RET -ne 0 ]; then
27                echo "FAILURE: $RET @ $i"
28        fi
29        if [ $ACTION == "-s" -a $RET -ne 0 ]; then
30                exit $RET
31        fi
32done
33echo -ne "\r$ITERATION / $ITERATION"
34
35exit 0
Note: See TracBrowser for help on using the repository browser.