Add vifffff and viffffff trampolines
[mono-project.git] / scripts / ci / run-step.sh
blob4ea5fbc4c3a3e3593a5fc7c84782901ea32fe587
1 #!/bin/bash -e
2 TIMEOUTCMD=`dirname "${BASH_SOURCE[0]}"`/babysitter
3 if ! ${TIMEOUTCMD} -h >/dev/null 2>&1; then
4 TIMEOUTCMD=timeout # fall back to timeout if babysitter doesn't work (e.g. python not installed or wrong version)
5 fi
7 export MONO_BABYSITTER_LOG_FILE=babysitter_report.json_lines
9 helptext ()
11 echo "run-step.sh {--label=LABEL} {--skip|--timeout=TIMEOUT [--fatal]} command to run with arguments"
14 for i in "$@"
16 case $i in
17 --help)
18 helptext
19 exit 0
21 --label=*)
22 LABEL="${i#*=}"
23 shift # past argument=value
25 --timeout=*)
26 TIMEOUT="${i#*=}"
27 shift # past argument=value
29 --fatal)
30 FATAL="true"
31 shift # past argument
33 --skip)
34 SKIP="true"
35 shift # past argument
38 # unknown option, assume just part of cmdline
40 esac
41 done
42 if [ -n "${SKIP}" ] && [ -z "${LABEL}" ]
43 then helptext
44 exit 1
46 if [ -n "${SKIP}" ]
47 then echo -e "*** start: ${LABEL}\n*** end(0): ${LABEL}: \e[45mSkipped\e[0m"
48 exit 0
50 if [ -z "${LABEL}" ] || [ -z "${TIMEOUT}" ]
51 then helptext
52 exit 1
54 STARTTIME=`date +%s`
55 echo "*** start: ${LABEL}"
56 if [ -n "${FATAL}" ]; then
57 ${TIMEOUTCMD} --signal=ABRT --kill-after=60s ${TIMEOUT} "$@" && echo -e "*** end($(echo $(date +%s) - ${STARTTIME} | bc)): ${LABEL}: \e[42mPassed\e[0m" || (echo -e "*** end($(echo $(date +%s) - ${STARTTIME} | bc)): ${LABEL}: \e[41mFailed\e[0m" && exit 1)
58 else
59 ${TIMEOUTCMD} --signal=ABRT --kill-after=60s ${TIMEOUT} "$@" && echo -e "*** end($(echo $(date +%s) - ${STARTTIME} | bc)): ${LABEL}: \e[42mPassed\e[0m" || echo -e "*** end($(echo $(date +%s) - ${STARTTIME} | bc)): ${LABEL}: \e[43mUnstable\e[0m"