kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit 0f31a272680990b067b56657b85fb69e396d33df
parent 84bd8059c53fd1cf3c3612683e0d400d36aa9b42
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Sun, 10 May 2026 06:14:03 -0700

test: print pass/fail summary as the last line in every run script

Reorder the per-runner footer so the failures and skipped lists print
before the totals, and add a summary line to dwarf_validate.sh which
previously had none. This way the bottom of any test log is always the
single line you want to read first.

Diffstat:
Mtest/ar/run.sh | 5+++--
Mtest/cg/dwarf_validate.sh | 2++
Mtest/cg/run.sh | 12++++++------
Mtest/elf/run.sh | 17++++++++++-------
Mtest/lex/run.sh | 5+++--
Mtest/libc/glibc/run.sh | 7++++---
Mtest/libc/musl/run.sh | 8++++----
Mtest/link/run.sh | 14+++++++-------
Mtest/parse/run.sh | 12++++++------
Mtest/parse/run_errors.sh | 5+++--
Mtest/pp/run.sh | 5+++--
Mtest/pp/run_errors.sh | 5+++--
12 files changed, 54 insertions(+), 43 deletions(-)

diff --git a/test/ar/run.sh b/test/ar/run.sh @@ -72,8 +72,9 @@ for sh in "$cases_dir"/*.sh; do done total=$((pass + fail)) -printf '\nar-driver: %d/%d passed\n' "$pass" "$total" if [ "$fail" -gt 0 ]; then - printf 'ar-driver: failures:%s\n' "$failures" + printf '\nar-driver: failures:%s\n' "$failures" + printf 'ar-driver: %d/%d passed\n' "$pass" "$total" exit 1 fi +printf '\nar-driver: %d/%d passed\n' "$pass" "$total" diff --git a/test/cg/dwarf_validate.sh b/test/cg/dwarf_validate.sh @@ -76,4 +76,6 @@ for obj in "${OBJS[@]}"; do fi done +total=${#OBJS[@]} +printf '\ndwarf_validate: %d/%d objs failed\n' "$fails" "$total" exit "$fails" diff --git a/test/cg/run.sh b/test/cg/run.sh @@ -420,20 +420,20 @@ T_E_BATCH=${T_E_BATCH:-0} # ---- summary --------------------------------------------------------------- -printf '\nResults: %s pass, %s fail, %s skip\n' "$PASS" "$FAIL" "$SKIP" -printf 'Time: D=%dms R=%dms E=%dms (batch %dms) J=%dms W=%dms\n' \ - "$T_D" "$T_R" "$T_E" "$T_E_BATCH" "$T_J" "$T_W" - if [ ${#FAIL_NAMES[@]} -gt 0 ]; then - printf 'Failed:\n' + printf '\nFailed:\n' for n in "${FAIL_NAMES[@]}"; do printf ' %s\n' "$n"; done fi if [ ${#SKIP_NAMES[@]} -gt 0 ] && [ "$ALLOW_SKIP" != "1" ]; then - printf 'Skipped (treat as failure; set CFREE_TEST_ALLOW_SKIP=1 to allow):\n' + printf '\nSkipped (treat as failure; set CFREE_TEST_ALLOW_SKIP=1 to allow):\n' for n in "${SKIP_NAMES[@]}"; do printf ' %s\n' "$n"; done fi +printf '\nResults: %s pass, %s fail, %s skip\n' "$PASS" "$FAIL" "$SKIP" +printf 'Time: D=%dms R=%dms E=%dms (batch %dms) J=%dms W=%dms\n' \ + "$T_D" "$T_R" "$T_E" "$T_E_BATCH" "$T_J" "$T_W" + if [ $FAIL -gt 0 ]; then exit 1; fi if [ $SKIP -gt 0 ] && [ "$ALLOW_SKIP" != "1" ]; then exit 1; fi exit 0 diff --git a/test/elf/run.sh b/test/elf/run.sh @@ -207,19 +207,22 @@ printf '\n' # ----- summary ----------------------------------------------------------- -printf 'Summary: %s passed, %s failed, %s skipped\n' \ - "$(color_grn $PASS)" \ - "$([ $FAIL -eq 0 ] && echo $FAIL || color_red $FAIL)" \ - "$([ $SKIP -eq 0 ] && echo $SKIP || color_yel $SKIP)" - if [ $FAIL -gt 0 ]; then printf 'Failures:\n' for n in "${FAIL_NAMES[@]}"; do printf ' - %s\n' "$n"; done - exit 1 + printf '\n' fi if [ $SKIP -gt 0 ] && [ "${CFREE_TEST_ALLOW_SKIP:-}" != "1" ]; then printf 'Skips treated as failures (set CFREE_TEST_ALLOW_SKIP=1 to allow):\n' for n in "${SKIP_NAMES[@]}"; do printf ' - %s\n' "$n"; done - exit 1 + printf '\n' fi + +printf 'Summary: %s passed, %s failed, %s skipped\n' \ + "$(color_grn $PASS)" \ + "$([ $FAIL -eq 0 ] && echo $FAIL || color_red $FAIL)" \ + "$([ $SKIP -eq 0 ] && echo $SKIP || color_yel $SKIP)" + +if [ $FAIL -gt 0 ]; then exit 1; fi +if [ $SKIP -gt 0 ] && [ "${CFREE_TEST_ALLOW_SKIP:-}" != "1" ]; then exit 1; fi exit 0 diff --git a/test/lex/run.sh b/test/lex/run.sh @@ -59,8 +59,9 @@ for src in "$cases_dir"/*.c; do done total=$((pass + fail)) -printf '\nlex: %d/%d passed\n' "$pass" "$total" if [ "$fail" -gt 0 ]; then - printf 'lex: failures:%s\n' "$failures" + printf '\nlex: failures:%s\n' "$failures" + printf 'lex: %d/%d passed\n' "$pass" "$total" exit 1 fi +printf '\nlex: %d/%d passed\n' "$pass" "$total" diff --git a/test/libc/glibc/run.sh b/test/libc/glibc/run.sh @@ -237,11 +237,12 @@ for src in "$CASES_DIR"/*.c; do run_case "$src" done -printf '\nResults: %s pass, %s fail\n' "$PASS" "$FAIL" - if [ ${#FAIL_NAMES[@]} -gt 0 ]; then printf '\nFailed:\n' for n in "${FAIL_NAMES[@]}"; do printf ' %s\n' "$n"; done - exit 1 fi + +printf '\nResults: %s pass, %s fail\n' "$PASS" "$FAIL" + +if [ ${#FAIL_NAMES[@]} -gt 0 ]; then exit 1; fi exit 0 diff --git a/test/libc/musl/run.sh b/test/libc/musl/run.sh @@ -221,10 +221,6 @@ for src in "$CASES_DIR"/*.c; do run_case dynamic "$src" done -printf '\nResults:\n' -printf ' static : %s pass, %s fail\n' "$PASS_static" "$FAIL_static" -printf ' dynamic: %s pass, %s fail\n' "$PASS_dynamic" "$FAIL_dynamic" - if [ ${#FAIL_NAMES_static[@]} -gt 0 ]; then printf '\nFailed (static):\n' for n in "${FAIL_NAMES_static[@]}"; do printf ' %s\n' "$n"; done @@ -234,6 +230,10 @@ if [ ${#FAIL_NAMES_dynamic[@]} -gt 0 ]; then for n in "${FAIL_NAMES_dynamic[@]}"; do printf ' %s\n' "$n"; done fi +printf '\nResults:\n' +printf ' static : %s pass, %s fail\n' "$PASS_static" "$FAIL_static" +printf ' dynamic: %s pass, %s fail\n' "$PASS_dynamic" "$FAIL_dynamic" + total_fail=$((FAIL_static + FAIL_dynamic)) if [ $total_fail -gt 0 ]; then exit 1; fi exit 0 diff --git a/test/link/run.sh b/test/link/run.sh @@ -616,21 +616,21 @@ fi # ---- summary --------------------------------------------------------------- -printf '\n' -printf 'Results: %s pass, %s fail, %s skip\n' "$PASS" "$FAIL" "$SKIP" -printf 'Time: R=%dms E=%dms (batch %dms) J=%dms\n' \ - "$T_R" "$T_E" "$T_E_BATCH" "$T_J" - if [ ${#FAIL_NAMES[@]} -gt 0 ]; then - printf 'Failed:\n' + printf '\nFailed:\n' for n in "${FAIL_NAMES[@]}"; do printf ' %s\n' "$n"; done fi if [ ${#SKIP_NAMES[@]} -gt 0 ] && [ "$ALLOW_SKIP" != "1" ]; then - printf 'Skipped (treat as failure; set CFREE_TEST_ALLOW_SKIP=1 to allow):\n' + printf '\nSkipped (treat as failure; set CFREE_TEST_ALLOW_SKIP=1 to allow):\n' for n in "${SKIP_NAMES[@]}"; do printf ' %s\n' "$n"; done fi +printf '\n' +printf 'Results: %s pass, %s fail, %s skip\n' "$PASS" "$FAIL" "$SKIP" +printf 'Time: R=%dms E=%dms (batch %dms) J=%dms\n' \ + "$T_R" "$T_E" "$T_E_BATCH" "$T_J" + if [ $FAIL -gt 0 ]; then exit 1; fi if [ $SKIP -gt 0 ] && [ "$ALLOW_SKIP" != "1" ]; then exit 1; fi exit 0 diff --git a/test/parse/run.sh b/test/parse/run.sh @@ -336,20 +336,20 @@ fi # ---- summary --------------------------------------------------------------- -printf '\nResults: %s pass, %s fail, %s skip\n' "$PASS" "$FAIL" "$SKIP" -printf 'Time: D=%dms R=%dms E=%dms (batch %dms) J=%dms\n' \ - "$T_D" "$T_R" "$T_E" "$T_E_BATCH" "$T_J" - if [ ${#FAIL_NAMES[@]} -gt 0 ]; then - printf 'Failed:\n' + printf '\nFailed:\n' for n in "${FAIL_NAMES[@]}"; do printf ' %s\n' "$n"; done fi if [ ${#SKIP_NAMES[@]} -gt 0 ] && [ "$ALLOW_SKIP" != "1" ]; then - printf 'Skipped (treat as failure; set CFREE_TEST_ALLOW_SKIP=1 to allow):\n' + printf '\nSkipped (treat as failure; set CFREE_TEST_ALLOW_SKIP=1 to allow):\n' for n in "${SKIP_NAMES[@]}"; do printf ' %s\n' "$n"; done fi +printf '\nResults: %s pass, %s fail, %s skip\n' "$PASS" "$FAIL" "$SKIP" +printf 'Time: D=%dms R=%dms E=%dms (batch %dms) J=%dms\n' \ + "$T_D" "$T_R" "$T_E" "$T_E_BATCH" "$T_J" + if [ $FAIL -gt 0 ]; then exit 1; fi if [ $SKIP -gt 0 ] && [ "$ALLOW_SKIP" != "1" ]; then exit 1; fi exit 0 diff --git a/test/parse/run_errors.sh b/test/parse/run_errors.sh @@ -69,8 +69,9 @@ for src in *.c; do done total=$((pass + fail)) -printf '\nparse-err: %d/%d passed\n' "$pass" "$total" if [ "$fail" -gt 0 ]; then - printf 'parse-err: failures:%s\n' "$failures" + printf '\nparse-err: failures:%s\n' "$failures" + printf 'parse-err: %d/%d passed\n' "$pass" "$total" exit 1 fi +printf '\nparse-err: %d/%d passed\n' "$pass" "$total" diff --git a/test/pp/run.sh b/test/pp/run.sh @@ -86,8 +86,9 @@ for src in *.c; do done total=$((pass + fail)) -printf '\npp: %d/%d passed\n' "$pass" "$total" if [ "$fail" -gt 0 ]; then - printf 'pp: failures:%s\n' "$failures" + printf '\npp: failures:%s\n' "$failures" + printf 'pp: %d/%d passed\n' "$pass" "$total" exit 1 fi +printf '\npp: %d/%d passed\n' "$pass" "$total" diff --git a/test/pp/run_errors.sh b/test/pp/run_errors.sh @@ -46,8 +46,9 @@ for src in *.c; do done total=$((pass + fail)) -printf '\npp-err: %d/%d passed\n' "$pass" "$total" if [ "$fail" -gt 0 ]; then - printf 'pp-err: failures:%s\n' "$failures" + printf '\npp-err: failures:%s\n' "$failures" + printf 'pp-err: %d/%d passed\n' "$pass" "$total" exit 1 fi +printf '\npp-err: %d/%d passed\n' "$pass" "$total"