test: run_tests.sh now supports testing specific directories
✅ 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 <noreply@anthropic.com>
This commit is contained in:
@ -94,10 +94,26 @@ run_case() {
|
|||||||
rm -f "$tmp_out" "$tmp_norm" "$tmp_json"
|
rm -f "$tmp_out" "$tmp_norm" "$tmp_json"
|
||||||
}
|
}
|
||||||
|
|
||||||
for d in "$TARGET_DIR"/*; do
|
# 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
|
[ -d "$d" ] || continue
|
||||||
run_case "$d"
|
run_case "$d"
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $fail -ne 0 ]; then
|
if [ $fail -ne 0 ]; then
|
||||||
echo "[TEST/SUMMARY] failures=$fail" >&2
|
echo "[TEST/SUMMARY] failures=$fail" >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user