This repository was archived by the owner on Oct 28, 2025. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathmanual_validation.sh
More file actions
executable file
·329 lines (272 loc) · 10.1 KB
/
Copy pathmanual_validation.sh
File metadata and controls
executable file
·329 lines (272 loc) · 10.1 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
#!/bin/bash
# Manual validation script for regression detection system
set -e
echo "🔍 Manual Validation of Performance Regression Detection System"
echo "=============================================================="
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Configuration
WORKFLOWS_DIR="./examples/workflows"
OUTPUT_DIR="./performance_test_outputs"
BASELINE_DIR="./benchmarks/baselines"
# Test workflows
WORKFLOWS=(
"simple_conditioning.json"
"medium_txt2img.json"
"complex_workflow.json"
"latent_operations.json"
"memory_intensive.json"
)
# Function to validate workflow files
validate_workflow_files() {
echo -e "\n${BLUE}1. Validating workflow files...${NC}"
local all_valid=true
for workflow in "${WORKFLOWS[@]}"; do
local workflow_path="$WORKFLOWS_DIR/$workflow"
if [ -f "$workflow_path" ]; then
echo -e " ${GREEN}✅ $workflow exists${NC}"
# Check if it's valid JSON
if python3 -m json.tool "$workflow_path" > /dev/null 2>&1; then
echo -e " ${GREEN}✅ Valid JSON format${NC}"
else
echo -e " ${RED}❌ Invalid JSON format${NC}"
all_valid=false
fi
# Check workflow structure
if grep -q '"class_type"' "$workflow_path" && grep -q '"inputs"' "$workflow_path"; then
echo -e " ${GREEN}✅ Valid workflow structure${NC}"
else
echo -e " ${RED}❌ Invalid workflow structure${NC}"
all_valid=false
fi
else
echo -e " ${RED}❌ $workflow missing${NC}"
all_valid=false
fi
done
if [ "$all_valid" = true ]; then
echo -e "\n${GREEN}✅ All workflow files are valid${NC}"
else
echo -e "\n${RED}❌ Some workflow files have issues${NC}"
return 1
fi
}
# Function to validate CLI command structure
validate_cli_structure() {
echo -e "\n${BLUE}2. Validating CLI command structure...${NC}"
# Check if CLI source exists
if [ -f "comfy-cli/src/main.rs" ]; then
echo -e " ${GREEN}✅ CLI source file exists${NC}"
else
echo -e " ${RED}❌ CLI source file missing${NC}"
return 1
fi
# Check if performance commands are defined
if grep -q "PerformanceCommands" "comfy-cli/src/main.rs"; then
echo -e " ${GREEN}✅ Performance commands defined${NC}"
else
echo -e " ${RED}❌ Performance commands not defined${NC}"
return 1
fi
# Check for specific commands
local commands=("StoreBaseline" "DetectRegressions" "ListBaselines" "Report")
for cmd in "${commands[@]}"; do
if grep -q "$cmd" "comfy-cli/src/main.rs"; then
echo -e " ${GREEN}✅ $cmd command found${NC}"
else
echo -e " ${RED}❌ $cmd command missing${NC}"
fi
done
}
# Function to validate regression detection logic
validate_regression_logic() {
echo -e "\n${BLUE}3. Validating regression detection logic...${NC}"
# Check if performance regression module exists
if [ -f "comfy-core/src/performance_regression.rs" ]; then
echo -e " ${GREEN}✅ Performance regression module exists${NC}"
else
echo -e " ${RED}❌ Performance regression module missing${NC}"
return 1
fi
# Check for key structures
local structures=("PerformanceBaseline" "TestPerformance" "RegressionResult" "PerformanceRegressionDetector")
for struct in "${structures[@]}"; do
if grep -q "struct $struct" "comfy-core/src/performance_regression.rs"; then
echo -e " ${GREEN}✅ $struct defined${NC}"
else
echo -e " ${RED}❌ $struct missing${NC}"
fi
done
# Check for key methods
local methods=("store_baseline" "detect_regressions" "generate_regression_report")
for method in "${methods[@]}"; do
if grep -q "fn $method" "comfy-core/src/performance_regression.rs"; then
echo -e " ${GREEN}✅ $method method found${NC}"
else
echo -e " ${RED}❌ $method method missing${NC}"
fi
done
}
# Function to validate test script
validate_test_script() {
echo -e "\n${BLUE}4. Validating test script...${NC}"
if [ -f "scripts/test_regression_detection.sh" ]; then
echo -e " ${GREEN}✅ Test script exists${NC}"
if [ -x "scripts/test_regression_detection.sh" ]; then
echo -e " ${GREEN}✅ Test script is executable${NC}"
else
echo -e " ${YELLOW}⚠️ Test script not executable${NC}"
fi
# Check for key functions
local functions=("run_performance_test" "introduce_regression" "test_regression_detection" "analyze_results")
for func in "${functions[@]}"; do
if grep -q "$func()" "scripts/test_regression_detection.sh"; then
echo -e " ${GREEN}✅ $func function found${NC}"
else
echo -e " ${RED}❌ $func function missing${NC}"
fi
done
else
echo -e " ${RED}❌ Test script missing${NC}"
return 1
fi
}
# Function to validate GitHub Actions workflow
validate_github_actions() {
echo -e "\n${BLUE}5. Validating GitHub Actions workflow...${NC}"
if [ -f ".github/workflows/performance-regression.yml" ]; then
echo -e " ${GREEN}✅ GitHub Actions workflow exists${NC}"
# Check for key steps
local steps=("Checkout code" "Install Rust" "Build project" "Run performance tests")
for step in "${steps[@]}"; do
if grep -q "$step" ".github/workflows/performance-regression.yml"; then
echo -e " ${GREEN}✅ $step found${NC}"
else
echo -e " ${RED}❌ $step missing${NC}"
fi
done
else
echo -e " ${RED}❌ GitHub Actions workflow missing${NC}"
return 1
fi
}
# Function to simulate baseline creation
simulate_baseline_creation() {
echo -e "\n${BLUE}6. Simulating baseline creation...${NC}"
# Create baseline directory
mkdir -p "$BASELINE_DIR"
echo -e " ${GREEN}✅ Baseline directory created${NC}"
# Create a sample baseline file
local sample_baseline='{
"commit_hash": "abc123def456",
"timestamp": 1703123456,
"test_results": {
"workflow_simple_conditioning": {
"test_name": "workflow_simple_conditioning",
"execution_time": "PT200MS",
"memory_usage": 25000000,
"cpu_usage": 30.0,
"iterations": 5,
"success_rate": 1.0,
"metadata": {}
}
},
"system_info": {
"os": "linux",
"architecture": "x86_64",
"cpu_model": "Intel Core i7",
"memory_gb": 16,
"rust_version": "1.75.0",
"cargo_version": "1.75.0"
}
}'
echo "$sample_baseline" > "$BASELINE_DIR/abc123def456.json"
echo -e " ${GREEN}✅ Sample baseline created${NC}"
# Verify baseline file
if python3 -m json.tool "$BASELINE_DIR/abc123def456.json" > /dev/null 2>&1; then
echo -e " ${GREEN}✅ Baseline file is valid JSON${NC}"
else
echo -e " ${RED}❌ Baseline file is invalid JSON${NC}"
return 1
fi
}
# Function to simulate regression detection
simulate_regression_detection() {
echo -e "\n${BLUE}7. Simulating regression detection...${NC}"
# Create a regression report
local regression_report='# Performance Regression Report
**Commit**: def456ghi789
**Timestamp**: 2024-01-15 10:30:00 UTC
## 🚨 Major Regressions (1)
### workflow_simple_conditioning
- **Time Delta**: 1000ms (500.0%)
- **Memory Delta**: 5MB (20.0%)
- **CPU Delta**: 15.0%
- **Confidence**: 95.0%
## ⚠️ Major Regressions (0)
## ⚡ Moderate Regressions (0)
## 📊 Minor Regressions (0)'
echo "$regression_report" > "./performance_regression_report.md"
echo -e " ${GREEN}✅ Regression report created${NC}"
# Verify report content
if grep -q "Performance Regression Report" "./performance_regression_report.md"; then
echo -e " ${GREEN}✅ Regression report contains expected content${NC}"
else
echo -e " ${RED}❌ Regression report missing expected content${NC}"
return 1
fi
}
# Function to validate documentation
validate_documentation() {
echo -e "\n${BLUE}8. Validating documentation...${NC}"
local docs=(
"REGRESSION_DETECTION_VALIDATION_GUIDE.md"
"REAL_WORKFLOW_VALIDATION_SUMMARY.md"
"PERFORMANCE_REGRESSION_DETECTION_SUMMARY.md"
)
for doc in "${docs[@]}"; do
if [ -f "$doc" ]; then
echo -e " ${GREEN}✅ $doc exists${NC}"
# Check for key sections
if grep -q "## " "$doc"; then
echo -e " ${GREEN}✅ Contains structured sections${NC}"
else
echo -e " ${YELLOW}⚠️ May be missing structured sections${NC}"
fi
else
echo -e " ${RED}❌ $doc missing${NC}"
fi
done
}
# Main validation function
main() {
echo "Starting manual validation..."
# Run all validation steps
validate_workflow_files
validate_cli_structure
validate_regression_logic
validate_test_script
validate_github_actions
simulate_baseline_creation
simulate_regression_detection
validate_documentation
echo -e "\n${GREEN}🎉 Manual validation completed!${NC}"
echo -e "\n${BLUE}Summary:${NC}"
echo " ✅ Workflow files validated"
echo " ✅ CLI structure validated"
echo " ✅ Regression detection logic validated"
echo " ✅ Test script validated"
echo " ✅ GitHub Actions workflow validated"
echo " ✅ Baseline creation simulated"
echo " ✅ Regression detection simulated"
echo " ✅ Documentation validated"
echo -e "\n${YELLOW}Note: Full end-to-end testing requires building the project${NC}"
echo " Run 'cargo build --release' to build the CLI binary"
echo " Then run './scripts/test_regression_detection.sh comprehensive'"
}
# Run main function
main "$@"