-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.sh
executable file
·40 lines (29 loc) · 814 Bytes
/
main.sh
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
34
35
36
37
38
39
40
error()
{
echo "Error: $1" > /dev/stderr
exit 1
}
correct() { [ "$(cat $BENCHMARK.hash | cut -d' ' -f 2 | grep -c 1)" -eq 0 ]; }
main()
{
cd "$(dirname "$0")/$BENCHMARK" || exit 1
# Download dependencies
./deps.sh $@ || error "Failed to download dependencies for $BENCHMARK"
# Fetch inputs
./input.sh $@ || error "Failed to fetch inputs for $BENCHMARK"
# Run benchmark
( ./run.sh $@ > $BENCHMARK.out 2> $BENCHMARK.err ) || error "Failed to run $BENCHMARK"
# Verify output
./verify.sh $@ > $BENCHMARK.hash || error "Failed to verify output for $BENCHMARK"
# Cleanup outputs
./cleanup.sh $@
if correct; then
echo "$BENCHMARK [pass]"
else
error "$BENCHMARK [fail]"
fi
cd - || exit 1
}
export BENCHMARK="$1"
shift
main $@