Skip to content

Commit

Permalink
use tee to capture test output to a temp file and print contents on f…
Browse files Browse the repository at this point in the history
…ailure
  • Loading branch information
hundredwatt committed Jan 12, 2024
1 parent e8c731c commit f609760
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions evaluate2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,29 @@ fi
# Run tests and benchmark for each fork
filetimestamp=$(date +"%Y%m%d%H%M%S") # same for all fork.out files from this run
failed=()
test_output=$(mktemp)
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 $fork > /dev/null
print_and_execute $TIMEOUT ./test.sh $fork | tee $test_output > /dev/null 2>&1
if [ $? -ne 0 ]; then
failed+=("$fork")
echo ""
echo -e "${BOLD_RED}FAILURE${RESET}: ./test.sh $fork failed"
cat $test_output
echo ""

continue
fi

# Run the test on $MEASUREMENTS_FILE; this serves as the warmup
print_and_execute $TIMEOUT ./test.sh $fork $MEASUREMENTS_FILE > /dev/null
print_and_execute $TIMEOUT ./test.sh $fork $MEASUREMENTS_FILE | tee $test_output > /dev/null 2>&1
if [ $? -ne 0 ]; then
failed+=("$fork")
echo ""
echo -e "${BOLD_RED}FAILURE${RESET}: ./test.sh $fork $MEASUREMENTS_FILE failed"
cat $test_output
echo ""

continue
Expand Down Expand Up @@ -194,6 +197,7 @@ for fork in "$@"; do
fi
done
set -e
rm $test_output

# Summary
echo -e "${BOLD_WHITE}Summary${RESET}"
Expand Down

0 comments on commit f609760

Please sign in to comment.