github TypedDevs/bashunit 0.51.0

6 hours ago

🛠️ Changes

  • Performance: a --parallel run on a shell without EPOCHREALTIME no longer forks perl once per test. The clock probe resolved inside a command substitution, so the resolved value died with it and every worker re-probed: 502 perl execs for a 500-test file, now 2. It happened even with per-test timing off, since deciding that timing is off is what asks whether the clock is expensive. Fixed by #1358; this adds the guards that keep it fixed (#1353)
  • A helper can ship a faster body for a newer Bash and keep the Bash 3.0 one as a fallback, chosen once at load time. The floor does not move: 3.0 keeps working and keeps being tested. The compatibility rules now record each construct's minimum version instead of only banning it, and allow one inside a matching version gate, never for a construct that is a parse error on the floor. See adrs/adr-013-bash-version-gated-fast-paths.md (#1352)
  • Performance: a file defining set_up_before_script or tear_down_after_script costs about 5.6ms less on Bash 3.2, and a test rendered with --show-execution-time about 0.74ms less. Four clock reads per file and the per-test padding no longer go through a capture subshell (#1348)
  • Performance: startup is faster on suites of plain test files. Printing "Running N tests" sourced every file a second time and re-ran every data provider before the run began. A file whose functions the provider scan can already see is counted from that scan instead: over this repo's 241 files the counting pass went from 1.72s to 1.51s, and 124 of them no longer source or run a provider twice. Files with a data provider, a heredoc, a multi-line string, an eval, a nested source or a conditional definition keep the old path, so the count can never disagree with the run (#1347)
  • Performance: a sequential run is about 0.7ms faster per test, taking a 500-test file from 2.75s to 2.40s on macOS arm64, bash 3.2. A test's <file>:<line> is resolved on demand instead of forking a subshell per test to read it (#1346)
  • A standalone bashunit assert <fn> ... no longer reports a source location belonging to another process. Launched from inside a test, it inherited that test's exported location and printed it as its own (#1346)
  • Performance: a test in a file that defines set_up or tear_down is about 2.6x faster, 14.1ms to 5.4ms per test on macOS arm64, bash 3.2, which brings it level with a hookless test. Each hook minted its output file with mktemp and removed it with rm, and the ownership marker that left behind made the runner sweep the test's temp files at exit: five forks per test, even for a test that created no temp file (#1345)

🐛 Bug Fixes

  • The deprecation warning for the old --assert option names the invocation you typed: bashunit -a, bashunit --assert or bashunit test --assert. It always said bashunit test --assert, because bashunit -a reaches that path through the inferred test subcommand, so it read like a warning about a command you never ran (#1366)
  • assert_contains_ignore_case documents what it actually guarantees: ASCII case folding. Whether ñ matches Ñ depends on the shell version, the locale and which tr the system ships. Behaviour is unchanged (#1351)
  • A test function whose name another selected name starts with is no longer rejected as a duplicate. test_a alongside test_ab read as one name twice, which made the whole file select nothing (#1347)
  • Coverage counts every line of a multiline statement: array literals, quoted strings, heredocs, backslash continuations. An array written one element per line cost one uncovered line per element, and on Bash 3.x the whole array read as uncovered. A parent statement's hits no longer mark commands inside command or process substitutions as covered (#1338)
  • --exclude-filter keeps a comma as part of the test function name. The value was split at the comma, so --exclude-filter 'test_a,{b}' also excluded test_a. Repeat the flag to exclude several names. BASHUNIT_EXCLUDE_FILTER stays comma-separated (#1340)
  • A --parallel run no longer replays bash's child setpgid warning as the stderr of a file that wrote nothing. The child sets its process group first, so only the message was ever wrong (#1344)
  • A timed-out test finishes its tear_down. The watchdog allowed a flat 0.3s between SIGTERM and SIGKILL, which a loaded machine missed in about one parallel full-suite run in three. It now polls for the body to exit, capped at 2s (#1344)

👥 Contributors

Checksum

SHA256: 307e3a84d5561d1a1d8b5d378184bb1dfda3e7a7856c4a9435d63a53853cf72c

Full Changelog: 0.50.1...0.51.0

Don't miss a new bashunit release

NewReleases is sending notifications on new releases.