Repository navigation
Expand file tree
/
Copy pathstress_slot_table.sh
More file actions
executable file
·186 lines (166 loc) · 5.48 KB
/
Copy pathstress_slot_table.sh
File metadata and controls
executable file
·186 lines (166 loc) · 5.48 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CARGO_RUNNER=("$ROOT_DIR/cargo-dev.sh")
STRESS_TIMEOUT_SECS="${CRANPOSE_SLOT_STRESS_TIMEOUT_SECS:-600}"
if [[ "${CRANPOSE_SLOT_STRESS_TIMEOUT_GUARD:-0}" != "1" && "$STRESS_TIMEOUT_SECS" != "0" ]]; then
if ! [[ "$STRESS_TIMEOUT_SECS" =~ ^[1-9][0-9]*$ ]]; then
echo "CRANPOSE_SLOT_STRESS_TIMEOUT_SECS must be 0 or a positive integer." >&2
exit 1
fi
if ! command -v timeout >/dev/null 2>&1; then
echo "timeout is required to enforce the stress-suite wall-clock budget." >&2
exit 1
fi
export CRANPOSE_SLOT_STRESS_TIMEOUT_GUARD=1
exec timeout --signal=KILL "${STRESS_TIMEOUT_SECS}s" "$0" "$@"
fi
if [ ! -x "${CARGO_RUNNER[0]}" ]; then
CARGO_RUNNER=(cargo)
fi
MODEL_STRESS_FRAMES="${CRANPOSE_SLOT_MODEL_STRESS_FRAMES:-10000}"
# shellcheck disable=SC1091
. "$ROOT_DIR/scripts/verification_common.sh"
# shellcheck disable=SC1091
. "$ROOT_DIR/scripts/robot_validation_common.sh"
ROBOT_LOG_PATTERN="(\\[FAIL\\]|TIMEOUT|panicked|thread '.*' panicked|BUILD FAILED|FAILED=[1-9][0-9]*|FAILED_TESTS=.+)"
STRESS_MODE="${CRANPOSE_SLOT_STRESS_MODE:-all}"
STRESS_PERF_SHARD=""
STRESS_ROBOT_SHARD=""
usage() {
cat <<EOF
Usage: $0 [--all|--core|--perf-shard INDEX/TOTAL|--robot-build|--robot-shard INDEX/TOTAL]
Modes:
--all Run the historical full stress path.
--core Run slot validation and generated-frame model stress.
--perf-shard N/M Run slot-table perf stability shard N of M.
--robot-build Build all robot examples for later shards.
--robot-shard N/M Run robot shard N of M using existing binaries.
Environment:
CRANPOSE_SLOT_STRESS_TIMEOUT_SECS defaults to 600. Set it to 0 only for an
explicit uncapped manual run.
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--all)
STRESS_MODE="all"
shift
;;
--core)
STRESS_MODE="core"
shift
;;
--perf-shard)
STRESS_MODE="perf-shard"
STRESS_PERF_SHARD="$2"
shift 2
;;
--robot-build)
STRESS_MODE="robot-build"
shift
;;
--robot-shard)
STRESS_MODE="robot-shard"
STRESS_ROBOT_SHARD="$2"
shift 2
;;
--help|-h)
usage
exit 0
;;
*)
echo "Unknown option: $1" >&2
usage >&2
exit 1
;;
esac
done
if [ "$STRESS_MODE" = "perf-shard" ] && [ -z "$STRESS_PERF_SHARD" ]; then
echo "--perf-shard requires INDEX/TOTAL" >&2
exit 1
fi
if [ "$STRESS_MODE" = "robot-shard" ] && [ -z "$STRESS_ROBOT_SHARD" ]; then
echo "--robot-shard requires INDEX/TOTAL" >&2
exit 1
fi
echo "Slot Table V2 stress suite"
echo "root: $ROOT_DIR"
echo "model stress frames: $MODEL_STRESS_FRAMES"
echo "timeout: ${STRESS_TIMEOUT_SECS}s"
echo "mode: $STRESS_MODE"
run_stress_core() {
run_logged \
"slot validation workspace tests" \
"$ROOT_DIR/slot_stress_validation.tmp" \
"$ROOT_DIR" \
env CRANPOSE_VALIDATE_SLOTS=1 "${CARGO_RUNNER[@]}" test --workspace
run_logged \
"slot model generated-frame stress" \
"$ROOT_DIR/slot_stress_model.tmp" \
"$ROOT_DIR" \
env CRANPOSE_SLOT_MODEL_STRESS_FRAMES="$MODEL_STRESS_FRAMES" \
"${CARGO_RUNNER[@]}" test --release -p cranpose-core \
deterministic_model_render_frames_match_slot_table -- --nocapture
}
run_perf_shard() {
local shard_slug="${STRESS_PERF_SHARD//\//_of_}"
run_logged \
"slot-table perf stability shard $STRESS_PERF_SHARD" \
"$ROOT_DIR/slot_stress_perf_shard_${shard_slug}.tmp" \
"$ROOT_DIR" \
"$ROOT_DIR/perf_slot_table_v2.sh" --stability-check --stability-shard "$STRESS_PERF_SHARD"
}
print_core_logs() {
echo " $ROOT_DIR/slot_stress_validation.tmp"
echo " $ROOT_DIR/slot_stress_model.tmp"
}
case "$STRESS_MODE" in
core)
run_stress_core
echo
echo "Stress core passed. Logs:"
print_core_logs
;;
perf-shard)
run_perf_shard
;;
robot-build)
run_robot_build_gate \
"$ROOT_DIR" \
"stress robot e2e build" \
"$ROOT_DIR/slot_stress_robot_build.tmp" \
"${CRANPOSE_SLOT_STRESS_ROBOT_BUILD_TIMEOUT_SECS:-600}" \
"${CRANPOSE_SLOT_STRESS_ROBOT_ATTEMPTS:-2}"
;;
robot-shard)
run_robot_shard_gate \
"$ROOT_DIR" \
"stress" \
"stress" \
"$STRESS_ROBOT_SHARD" \
"${CRANPOSE_SLOT_STRESS_ROBOT_SHARD_TIMEOUT_SECS:-600}" \
"${CRANPOSE_SLOT_STRESS_ROBOT_ATTEMPTS:-2}"
;;
all)
run_stress_core
run_logged \
"slot-table perf stability" \
"$ROOT_DIR/slot_stress_perf.tmp" \
"$ROOT_DIR" \
"$ROOT_DIR/perf_slot_table_v2.sh" --stability-check
run_logged \
"sequential robot e2e" \
"$ROOT_DIR/slot_stress_robot.tmp" \
"$ROOT_DIR" \
"$ROOT_DIR/run_robot_test.sh" --sequential
verify_robot_summary
echo
echo "Stress suite passed. Logs:"
print_core_logs
echo " $ROOT_DIR/slot_stress_perf.tmp"
echo " $ROOT_DIR/slot_stress_robot.tmp"
echo " $ROOT_DIR/robot_test.log"
echo " $ROOT_DIR/robot_test_summary.txt"
;;
esac