source: tools/repeat @ b72d4ed

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since b72d4ed 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
Line 
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"
22        $@ > /dev/null &
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.