From f609760c23cc8d746f43a30d58d2dfa32ab9e2fc Mon Sep 17 00:00:00 2001 From: Jason Nochlin Date: Fri, 12 Jan 2024 09:24:04 -0700 Subject: [PATCH] use tee to capture test output to a temp file and print contents on failure --- evaluate2.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/evaluate2.sh b/evaluate2.sh index dcaaef7c2..8a9e42f87 100755 --- a/evaluate2.sh +++ b/evaluate2.sh @@ -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 @@ -194,6 +197,7 @@ for fork in "$@"; do fi done set -e +rm $test_output # Summary echo -e "${BOLD_WHITE}Summary${RESET}"