Skip to content

Commit

Permalink
Fix main.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
vagos committed Oct 20, 2024
1 parent 7a3ab3e commit 255866b
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions main.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
BENCHMARK="$1"

cd "$(dirname "$0")/$BENCHMARK" || exit 1

error()
{
echo "Error: $1" > /dev/stderr
exit 1
}

# Download dependencies
./deps.sh || error "Failed to download dependencies for $BENCHMARK"
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
./inputs.sh $@ || error "Failed to fetch inputs 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"

if correct; then
echo "$BENCHMARK [pass]"
else
error "$BENCHMARK [fail]"
fi

cd - || exit 1
}

# Run benchmark
./run.sh > $BENCHMARK.out 2> $BENCHMARK.err || error "Failed to run $BENCHMARK"
export BENCHMARK="$1"
shift

# Verify output
./verify.sh > $BENCHMARK.hash || error "Failed to verify output for $BENCHMARK"
main $@

0 comments on commit 255866b

Please sign in to comment.