From 411c0a3e6397ce13ef35b2218e874d8b973e1fc9 Mon Sep 17 00:00:00 2001 From: nyash-codex Date: Sat, 8 Nov 2025 04:17:57 +0900 Subject: [PATCH] test: run_tests.sh now supports testing specific directories MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ Enhancement: - tools/hako_check/run_tests.sh: Added argument handling (lines 97-116) - Previously: Always ran all tests regardless of arguments - Now: Can run specific test directory when provided as argument - Example: bash run_tests.sh tools/hako_check/tests/HC021_analyzer_io_safety ✅ Use cases: - Faster iteration during rule development - Targeted debugging of specific rule tests - CI/CD pipeline optimization 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude --- tools/hako_check/run_tests.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tools/hako_check/run_tests.sh b/tools/hako_check/run_tests.sh index 4c0194c9..d05cea0c 100644 --- a/tools/hako_check/run_tests.sh +++ b/tools/hako_check/run_tests.sh @@ -94,10 +94,26 @@ run_case() { rm -f "$tmp_out" "$tmp_norm" "$tmp_json" } -for d in "$TARGET_DIR"/*; do - [ -d "$d" ] || continue - run_case "$d" -done +# Handle arguments: if provided, test only specified dirs; otherwise test all +if [ $# -gt 0 ]; then + # Test only specified directories + for arg in "$@"; do + # Convert relative path to absolute + if [[ "$arg" == /* ]]; then + d="$arg" + else + d="$ROOT/$arg" + fi + [ -d "$d" ] || { echo "[TEST] not a directory: $d" >&2; continue; } + run_case "$d" + done +else + # Test all directories + for d in "$TARGET_DIR"/*; do + [ -d "$d" ] || continue + run_case "$d" + done +fi if [ $fail -ne 0 ]; then echo "[TEST/SUMMARY] failures=$fail" >&2