1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 21:55:08 +00:00

test: fix parallel test flakiness and bash 3.2 empty-array expansion

- Fix 'bats_opts[@]: unbound variable' under set -u + bash 3.2: empty
  arrays must use ${arr[@]+"${arr[@]}"} idiom, not "${arr[@]}"
- Split core_performance.bats out of the parallel batch; run it after
  all parallel workers finish so wall-clock timing assertions aren't
  skewed by CPU contention from concurrent bats processes
- Raise MOLE_PERF_GET_INVOKING_USER_LIMIT_MS default 500→2000ms and
  add MOLE_PERF_SECTION_LIMIT_MS (default 2000ms) to give sufficient
  headroom without masking real regressions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Tw93
2026-03-14 10:15:38 +08:00
parent a7b28faeda
commit ba01cb7f43
2 changed files with 66 additions and 40 deletions

View File

@@ -108,7 +108,7 @@ setup() {
@test "get_invoking_user executes quickly" {
local start end elapsed
local limit_ms="${MOLE_PERF_GET_INVOKING_USER_LIMIT_MS:-500}"
local limit_ms="${MOLE_PERF_GET_INVOKING_USER_LIMIT_MS:-2000}"
start=$(date +%s%N)
for i in {1..100}; do
@@ -233,5 +233,6 @@ setup() {
elapsed=$(( (end - start) / 1000000 ))
[ "$elapsed" -lt 2000 ]
local limit_ms="${MOLE_PERF_SECTION_LIMIT_MS:-2000}"
[ "$elapsed" -lt "$limit_ms" ]
}