-
Notifications
You must be signed in to change notification settings - Fork 556
Expand file tree
/
Copy pathread_debug.sh
More file actions
78 lines (75 loc) · 2.53 KB
/
Copy pathread_debug.sh
File metadata and controls
78 lines (75 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
# ============================================================
# read_debug.sh — Read the latest Behat debug dump
#
# Usage:
# ./read_debug.sh → shows the latest meta + form_summary
# ./read_debug.sh full → shows the latest full HTML
# ./read_debug.sh all → shows meta + form_summary + full HTML
# ./read_debug.sh clean → delete all debug files
# ============================================================
# Debug files are written by FeatureContext.php on step failure.
# Naming convention: <timestamp>_<scenario>_{full.html,meta.txt,form_summary.txt}
DEBUG_DIR="$(dirname "$0")/behat_debug"
if [ ! -d "$DEBUG_DIR" ]; then
echo "No behat_debug/ directory found. No failures captured yet."
exit 0
fi
case "${1:-summary}" in
clean)
rm -f "$DEBUG_DIR"/*.html "$DEBUG_DIR"/*.txt
echo "Debug files cleaned."
exit 0
;;
full)
LATEST=$(ls -t "$DEBUG_DIR"/*_full.html 2>/dev/null | head -1)
if [ -z "$LATEST" ]; then
echo "No full HTML dump found."
exit 0
fi
echo "=== LATEST FULL HTML DUMP: $(basename "$LATEST") ==="
cat "$LATEST"
;;
all)
# Meta
LATEST_META=$(ls -t "$DEBUG_DIR"/*_meta.txt 2>/dev/null | head -1)
if [ -n "$LATEST_META" ]; then
echo ""
echo "=== META ==="
cat "$LATEST_META"
fi
echo ""
# Form summary
LATEST_SUMMARY=$(ls -t "$DEBUG_DIR"/*_form_summary.txt 2>/dev/null | head -1)
if [ -n "$LATEST_SUMMARY" ]; then
echo ""
echo "=== FORM SUMMARY ==="
cat "$LATEST_SUMMARY"
fi
echo ""
# Full HTML (first 500 lines to avoid flooding)
LATEST_FULL=$(ls -t "$DEBUG_DIR"/*_full.html 2>/dev/null | head -1)
if [ -n "$LATEST_FULL" ]; then
echo ""
echo "=== FULL HTML (first 500 lines) ==="
head -500 "$LATEST_FULL"
fi
;;
summary|*)
# Meta
LATEST_META=$(ls -t "$DEBUG_DIR"/*_meta.txt 2>/dev/null | head -1)
if [ -n "$LATEST_META" ]; then
echo "=== META ==="
cat "$LATEST_META"
echo ""
fi
# Form summary
LATEST_SUMMARY=$(ls -t "$DEBUG_DIR"/*_form_summary.txt 2>/dev/null | head -1)
if [ -n "$LATEST_SUMMARY" ]; then
echo "=== FORM SUMMARY ==="
cat "$LATEST_SUMMARY"
else
echo "No form summary found."
fi
;;
esac