Skip to content

Commit

Permalink
Revert "add --quiet mode to test.sh"
Browse files Browse the repository at this point in the history
This reverts commit 13e9fb7.
  • Loading branch information
hundredwatt committed Jan 12, 2024
1 parent 2ddcd74 commit e8c731c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
4 changes: 2 additions & 2 deletions evaluate2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ for fork in "$@"; do
set +e # we don't want prepare.sh, test.sh or hyperfine failing on 1 fork to exit the script early

# Run the test suite
print_and_execute $TIMEOUT ./test.sh --quiet $fork
print_and_execute $TIMEOUT ./test.sh $fork > /dev/null
if [ $? -ne 0 ]; then
failed+=("$fork")
echo ""
Expand All @@ -151,7 +151,7 @@ for fork in "$@"; do
fi

# Run the test on $MEASUREMENTS_FILE; this serves as the warmup
print_and_execute $TIMEOUT ./test.sh --quiet $fork $MEASUREMENTS_FILE
print_and_execute $TIMEOUT ./test.sh $fork $MEASUREMENTS_FILE > /dev/null
if [ $? -ne 0 ]; then
failed+=("$fork")
echo ""
Expand Down
25 changes: 5 additions & 20 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,29 @@
set -euo pipefail

DEFAULT_INPUT="src/test/resources/samples/*.txt"
FORK=${1:-""}
INPUT=${2:-$DEFAULT_INPUT}

if [ "$#" -eq 0 ] || [ "$#" -gt 3 ] || [ "$1" == "-h" ]; then
if [ "$#" -eq 0 ] || [ "$#" -gt 2 ] || [ "$FORK" = "-h" ]; then
echo "Usage: ./test.sh <fork name> [input file pattern]"
echo
echo "For each test sample matching <input file pattern> (default '$DEFAULT_INPUT')"
echo "runs <fork name> implementation and diffs the result with the expected output."
echo "Note that optional <input file pattern> should be quoted if contains wild cards."
echo "Use optional flag --quiet to suppress output."
echo
echo "Examples:"
echo "./test.sh baseline"
echo "./test.sh baseline src/test/resources/samples/measurements-1.txt"
echo "./test.sh baseline 'src/test/resources/samples/measurements-*.txt'"
echo "./test.sh --quiet baseline"
exit 1
fi

QUIET=false
if [ "$1" == "--quiet" ]; then
QUIET=true
shift
fi

FORK=${1:-""}
INPUT=${2:-$DEFAULT_INPUT}

if [ -f "./prepare_$FORK.sh" ]; then
if [ $QUIET == true ]; then
"./prepare_$FORK.sh"
else
"./prepare_$FORK.sh" > /dev/null
fi
"./prepare_$FORK.sh"
fi

for sample in $(ls $INPUT); do
if [ $QUIET != true ]; then
echo "Validating calculate_average_$FORK.sh -- $sample"
fi
echo "Validating calculate_average_$FORK.sh -- $sample"

rm -f measurements.txt
ln -s $sample measurements.txt
Expand Down

0 comments on commit e8c731c

Please sign in to comment.