forked from FastLED/FastLED
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate
More file actions
executable file
·162 lines (131 loc) · 4.99 KB
/
validate
File metadata and controls
executable file
·162 lines (131 loc) · 4.99 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/usr/bin/env bash
# validate - FastLED Validation Test Wrapper
#
# Runs the Validation.ino sketch with proper --expect and --fail-on patterns
# to catch ISR failures, hardware issues, and test matrix errors.
#
# Usage:
# bash validate # Run with default patterns
# bash validate --timeout 120 # Override timeout
# bash validate --skip-lint # Skip linting phase
# bash validate --help # Show help
set -euo pipefail
# Default expect patterns - simplified to essential checks only
DEFAULT_EXPECT=(
"TX Pin: 0" # Hardware setup verification
"RX Pin: 1" # Hardware setup verification
"DRIVER_ENABLED: PARLIO" # Parlio driver availability (key driver)
"VALIDATION_READY: true" # Test ready indicator
)
# Stop pattern - early exit when test suite completes successfully
# This allows the test to exit early instead of waiting for timeout
STOP_PATTERN="VALIDATION_SUITE_COMPLETE"
# Default fail-on pattern from Validation.ino (lines 78-98)
DEFAULT_FAIL_ON="ERROR"
# Exit-on-error pattern for immediate device failure detection
# ClearCommError indicates device is stuck (ISR hogging CPU, crashed, etc.)
EXIT_ON_ERROR_PATTERN="ClearCommError"
# Help message
show_help() {
cat <<EOF
FastLED Validation Test Wrapper
Usage:
bash validate [OPTIONS]
Description:
Runs the Validation.ino sketch with comprehensive --expect and --fail-on patterns
to detect ISR failures, hardware issues, and test matrix errors.
STOP PATTERN: "VALIDATION_SUITE_COMPLETE"
- Triggers early successful exit when all tests complete
- Saves time by not waiting for full timeout (typically 60s)
- Only exits if all --expect patterns have been found
- The sketch prints this after completing the test matrix
Default Patterns:
4 --expect patterns covering:
- Hardware setup (TX/RX pins)
- Driver availability (PARLIO)
- Validation ready indicator
1 --stop pattern:
- VALIDATION_SUITE_COMPLETE (early exit when tests complete)
1 --fail-on pattern:
- ERROR (catches test failures via FL_WARN)
1 --exit-on-error pattern:
- ClearCommError (immediate device failure - ISR hang, crash, etc.)
Options:
-h, --help Show this help message
--timeout SECONDS Override default timeout (default: 60s)
--skip-lint Skip C++ linting phase (faster iteration)
--no-expect Clear default --expect patterns (use custom only)
--no-fail-on Clear default --fail-on pattern (use custom only)
Any other options are passed directly to 'bash debug Validation'
Examples:
bash validate # Run with all default patterns
bash validate --timeout 60 # Longer timeout for debugging
bash validate --skip-lint # Skip linting for faster iteration
bash validate --no-expect --expect "CUSTOM PATTERN" # Custom patterns only
Exit Codes:
0 Success (all patterns found, no failures)
1 Failure (missing patterns, ERROR detected, or compilation/upload failed)
130 User interrupt (Ctrl+C)
See Also:
- examples/Validation/Validation.ino (lines 78-102) - Pattern documentation
- examples/Validation/SketchHalt.h (lines 36-52) - Halting state mechanism
- LOOP.md Section 4 - Testing & Validation Loop Workflow
EOF
}
# Parse arguments
USE_DEFAULT_EXPECT=true
USE_DEFAULT_FAIL_ON=true
EXTRA_ARGS=()
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
show_help
exit 0
;;
--no-expect)
USE_DEFAULT_EXPECT=false
shift
;;
--no-fail-on)
USE_DEFAULT_FAIL_ON=false
shift
;;
*)
EXTRA_ARGS+=("$1")
shift
;;
esac
done
# Build final command (bypass bash debug wrapper to avoid --check-usage)
CMD=(uv run ci/debug_attached.py Validation)
# Add input-on-trigger to auto-send START when VALIDATION_READY appears
CMD+=(--input-on-trigger "VALIDATION_READY:START")
# Add default --expect patterns unless disabled
if [[ "$USE_DEFAULT_EXPECT" == "true" ]]; then
for pattern in "${DEFAULT_EXPECT[@]}"; do
CMD+=(--expect "$pattern")
done
fi
# Add default --fail-on pattern unless disabled
if [[ "$USE_DEFAULT_FAIL_ON" == "true" ]]; then
CMD+=(--fail-on "$DEFAULT_FAIL_ON")
fi
# Add stop pattern for early exit when test suite completes
CMD+=(--stop "$STOP_PATTERN")
# Add exit-on-error pattern for immediate device failure detection
CMD+=(--exit-on-error "$EXIT_ON_ERROR_PATTERN")
# Append any extra arguments
CMD+=("${EXTRA_ARGS[@]}")
# Print command for transparency
echo "Running validation with patterns:"
echo " Expect: ${#DEFAULT_EXPECT[@]} patterns (use --help to see list)"
echo " Stop: $STOP_PATTERN (early exit when tests complete)"
echo " Fail-on: $DEFAULT_FAIL_ON"
echo " Exit-on-error: $EXIT_ON_ERROR_PATTERN (immediate failure)"
echo ""
echo "Command: ${CMD[*]}"
echo ""
echo "Note: Using direct backend call (bypasses 'bash debug' wrapper check)"
echo ""
# Execute
exec "${CMD[@]}"