summaryrefslogtreecommitdiff
path: root/fake/run.sh
blob: 5bf7846c03556e91ca222d1b2d3f4bfd61b8d2e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

naptime=
fail=
while getopts s:f flag; do
  case "${flag}" in
    s) naptime="${OPTARG}";;
    f) fail=1;;
    *)
       echo "Bad arg" 1>&2
       exit 1
    ;;
  esac
done
if test x"${naptime:-}" != x; then
  if test -w /dev/console; then
    console=/dev/console
  fi
  echo "fakebench sleeping for ${naptime} seconds" | tee /dev/stdout ${console}
  sleep ${naptime}
fi
echo "Ran a benchmark"
echo "Some stderr" 1>&2
mkdir -p fakeresults
touch fakeresults/fake1
touch fakeresults/fake2
touch extralog
result=$?
if test x"${fail:-}" = x; then
  exit ${result}
else
  false
fi