Fixing timing test runner
All checks were successful
Merge-Checker / build_and_test (pull_request) Successful in 2m48s
All checks were successful
Merge-Checker / build_and_test (pull_request) Successful in 2m48s
This commit is contained in:
@@ -42,38 +42,40 @@ jobs:
|
|||||||
- name: Compare timing results
|
- name: Compare timing results
|
||||||
id: check_diff
|
id: check_diff
|
||||||
run: |
|
run: |
|
||||||
# Ensure the previous version exists (from git)
|
|
||||||
git show origin/${{ github.event.pull_request.head.ref }}:unit-tests/timing-results/matrix-timing-tests.txt > old.txt || echo "" > old.txt
|
git show origin/${{ github.event.pull_request.head.ref }}:unit-tests/timing-results/matrix-timing-tests.txt > old.txt || echo "" > old.txt
|
||||||
cp unit-tests/timing-results/matrix-timing-tests.txt new.txt
|
cp unit-tests/timing-results/matrix-timing-tests.txt new.txt
|
||||||
|
|
||||||
echo "Comparing timing results..."
|
echo "Comparing timing results for changes ≥ 0.1s..."
|
||||||
|
|
||||||
CHANGED=0
|
|
||||||
awk '
|
awk '
|
||||||
BEGIN { change_threshold=0.1 }
|
BEGIN {
|
||||||
/^[0-9]+\.[0-9]+ s: / {
|
change_threshold = 0.1
|
||||||
new_time = $1
|
changed = 0
|
||||||
label = substr($0, index($0, ":") + 2)
|
|
||||||
if (label_times[label]) {
|
|
||||||
old_time = label_times[label]
|
|
||||||
delta = new_time - old_time
|
|
||||||
if (delta < 0) delta = -delta
|
|
||||||
if (delta >= change_threshold) {
|
|
||||||
changed = 1
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
changed = 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
FILENAME == "old.txt" && /^[0-9]+\.[0-9]+ s: / {
|
FILENAME == "old.txt" && /^[0-9]+\.[0-9]+ s: / {
|
||||||
label = substr($0, index($0, ":") + 2)
|
label = substr($0, index($0, ":") + 2)
|
||||||
label_times[label] = $1
|
label_times[label] = $1
|
||||||
}
|
}
|
||||||
|
FILENAME == "new.txt" && /^[0-9]+\.[0-9]+ s: / {
|
||||||
|
new_time = $1
|
||||||
|
label = substr($0, index($0, ":") + 2)
|
||||||
|
old_time = label_times[label]
|
||||||
|
delta = new_time - old_time
|
||||||
|
if (delta < 0) delta = -delta
|
||||||
|
if (old_time != "" && delta >= change_threshold) {
|
||||||
|
printf "⚠️ %.3f s → %.3f s: %s (Δ=%.3f s)\n", old_time, new_time, label, delta
|
||||||
|
changed = 1
|
||||||
|
} else if (old_time == "") {
|
||||||
|
printf "🆕 New timing entry: %.3f s: %s\n", new_time, label
|
||||||
|
changed = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
END {
|
END {
|
||||||
exit changed == 1 ? 0 : 1
|
exit changed == 1 ? 0 : 1
|
||||||
}
|
}
|
||||||
' old.txt new.txt
|
' old.txt new.txt
|
||||||
|
|
||||||
|
|
||||||
- name: Commit and push timing results
|
- name: Commit and push timing results
|
||||||
if: steps.check_diff.outcome == 'success' && github.event.pull_request.head.repo.full_name == github.repository
|
if: steps.check_diff.outcome == 'success' && github.event.pull_request.head.repo.full_name == github.repository
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user