Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: sort test output by time and display accumulated sum (#1777)

Yilong Lib9d09bef0d95
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 241c40270b..fab8cea8c7 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -68,4 +68,9 @@ jobs:
- name: Run all tests
run: go test -v ./... -tags=${{ matrix.release-tags }}mysql | tee test.log
- name: Pretty print tests running time
- run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log
+ # grep: filter out lines like "--- PASS: TestVCS (15.04s)"
+ # sed: remove unnecessary characters
+ # awk: re-format lines to "PASS: TestVCS (15.04s)"
+ # sort: cut into columns by delimiter ' ' (single space) and sort by column 3 (test time in seconds) as numeric type in reverse order (largest comes first)
+ # awk: accumulate sum by test time in seconds
+ run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}'