run.sh (1043B)
1 #!/bin/sh 2 # Driver-level `kit ar` test harness. 3 # 4 # Each test/ar/cases/*.sh is a scenario script. The harness allocates a fresh 5 # sandbox dir per case, cd's in, runs the script with $KIT exported, captures 6 # stdout+stderr, and diffs against the matching .expected. The shared loop, 7 # reporting, and sandbox/cleanup live in test/lib/kit_sh_report.sh. 8 # 9 # Honors $KIT for the binary path; defaults to build/kit. 10 11 set -u 12 13 script_dir=$(cd "$(dirname "$0")" && pwd) 14 repo_root=$(cd "$script_dir/../.." && pwd) 15 cases_dir="$script_dir/cases" 16 KIT_KIT_DIR="$repo_root/test/lib" 17 . "$repo_root/test/lib/kit_sh_kit.sh" 18 19 KIT="${KIT:-$repo_root/build/kit}" 20 export KIT 21 kit_require_kit ar-driver 22 23 kit_workdir ar 24 kit_report_init 25 for sh in "$cases_dir"/*.sh; do 26 [ -e "$sh" ] || continue 27 name=$(basename "${sh%.sh}") 28 # Pass cases_dir so a failing case's .actual is kept there for debugging 29 # (the sandbox under KIT_WORK is removed on exit). 30 kit_scenario_case "$name" "$sh" "${sh%.sh}.expected" "$cases_dir" 31 done 32 kit_summary ar-driver 33 kit_exit