grade scripts

This commit is contained in:
woojin
2023-08-26 00:30:22 +09:00
parent 176d0df5d2
commit 6858e18da2
27 changed files with 141 additions and 430 deletions

View File

@@ -76,17 +76,19 @@ _run_tests_with() {
exit 1
fi
local FAILED=0
for TEST in "${TESTS[@]}"; do
local TEST_CMD="$CARGO test $* $TEST"
timeout ${TIMEOUT:-20s} bash -c "$TEST_CMD 2>/dev/null" 1>&2
local PASSED=0
# local NUM_TESTS=$(echo $TESTS | wc -w)
for TEST in ${TESTS[@]}; do
local TEST_CMD="$CARGO test $* --lib -- $TEST"
timeout ${TIMEOUT:-20s} bash -c "$TEST_CMD 2> /dev/null" 1>&2
case $? in
0) ;;
124) echo_err "Test timed out: $TEST_CMD"; FAILED=$((FAILED + 1));;
*) echo_err "Test failed: $TEST_CMD"; FAILED=$((FAILED + 1));;
0) PASSED=$((PASSED + 1));;
124) echo_err "Test timed out: $TEST_CMD";;
*) echo_err "Test failed: $TEST_CMD";;
esac
done
echo $FAILED
echo $PASSED
}
# example: run_tests