-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunBenchmark.sh
More file actions
executable file
·56 lines (45 loc) · 1.45 KB
/
Copy pathrunBenchmark.sh
File metadata and controls
executable file
·56 lines (45 loc) · 1.45 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
#!/bin/bash
# Run benchmark tests for pose_detection
# This script runs the performance benchmark integration tests
set -e # Exit on any error
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
OUTPUT_DIR="$SCRIPT_DIR/example/benchmark_results"
echo "================================================"
echo "Running benchmark tests from example directory..."
echo "================================================"
mkdir -p "$OUTPUT_DIR"
cd "$SCRIPT_DIR/example"
# Run tests and capture output
TEMP_OUTPUT=$(mktemp)
flutter test integration_test/pose_detector_benchmark_test.dart -d macos --timeout 60m 2>&1 | tee "$TEMP_OUTPUT"
# Extract JSON blocks and save to files
echo ""
echo "Extracting benchmark results..."
# Use awk to extract JSON between markers and save to files
awk -v OUTPUT_DIR="$OUTPUT_DIR" '
/📊 BENCHMARK_JSON_START:/ {
filename = $0
sub(/.*BENCHMARK_JSON_START:/, "", filename)
capturing = 1
json = ""
next
}
/📊 BENCHMARK_JSON_END:/ {
if (capturing) {
# Need parentheses for concatenation when redirecting output
print json > (OUTPUT_DIR "/" filename)
print " Saved: " filename
}
capturing = 0
next
}
capturing {
json = json $0 "\n"
}
' "$TEMP_OUTPUT"
rm "$TEMP_OUTPUT"
echo ""
echo "================================================"
echo "✓ Benchmark tests completed successfully!"
echo "Results saved to: example/benchmark_results/"
echo "================================================"