@@ -2,12 +2,20 @@
TOPDIR=$(dirname "$(realpath $0)")
cd ${TOPDIR}/test/tests
+LOG="${TOPDIR}/ptest_$(date +%Y%m%d-%H%M%S).log"
TESTS=$(find . -executable -type f)
for t in ${TESTS}; do
- ./$t
- if [ "$?" = "0" ]; then
- echo "PASS: $t"
- else
- echo "FAIL: $t"
- fi
+ ./"$t" 2>&1 | sed -e '/---\[OK\]/ s/^/PASS: /' \
+ -e '/} OK:/ s/^/PASS: /' \
+ -e '/---\[[0-9]* ERRORS in / s/^/FAIL: /' \
+ -e '/} ERRORS/ s/^/FAIL: /' | tee -a "${LOG}"
done
+
+passed=$(grep '^PASS:' "${LOG}" | wc -l)
+failed=$(grep '^FAIL:' "${LOG}" | wc -l)
+total=$((passed + failed))
+
+echo "=== Test Summary ===" | tee -a "${LOG}"
+echo "TOTAL: ${total}" | tee -a "${LOG}"
+echo "PASSED: ${passed}" | tee -a "${LOG}"
+echo "FAILED: ${failed}" | tee -a "${LOG}"