Re: [PATCH v5] test-lib: run EXPENSIVE tests one at a time
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Dec 3, 2026, 09:38 UTC
- Message-ID
- <axE4meb1_pNz7BTJ@pks.im>
- In-Reply-To
- <20261202-ks-ci-long-test-hang-fix-v5-1-aeb09e4dbc25@gmail.com>
On Wed, Dec 02, 2026 at 01:23:30AM +0530, Kaartic Sivaraam wrote:
Show 9 quoted lines
> Range-diff vs. v4: > > 1: ad8fa8d872 ! 1: 2fcdeefff3 test-lib: run EXPENSIVE tests one at a time > @@ t/test-lib.sh: test_missing_prereq= > > test_external_has_tap=0 > > ++# Remove the lock only if it still names $1 as its owner, so that > ++# a lock someone else has just taken is left alone.
I feel like this comment is a bit on the verbose side as it doesn't really provide much value over what the code already trivially tells you, but okay.
> ++remove_expensive_lock_owned_by_ () {
> ++ test "$(cat "$expensive_lock_" 2>/dev/null)" = "$1" &&
> ++ rm -f "$expensive_lock_"
> ++}So this is now wrapped in its own function. Makes sense, I guess.
Show 8 quoted lines
> @@ t/test-lib.sh: fail_117 () {
> +have_expensive_lock_=
> +
> +expensive_lock_unavailable_ () {
> -+ say >&3 "cannot take the EXPENSIVE lock, running anyway"
> ++ echo >&2 "# cannot take the EXPENSIVE lock, running anyway"
> + rm -f "$expensive_lock_.$$"
> +}Here we now output to stderr, and we cater towards strict TAP parser by prefixing it with "#". I think this change makes sense, as this should make it more discoverable when this scenario kicks in.
Show 8 quoted lines
> @@ t/test-lib.sh: fail_117 () {
> + #
> + # Another waiter may have taken it over since we
> + # looked, so only remove it if it is still the same.
> -+ if test "$(cat "$expensive_lock_" 2>/dev/null)" = "$owner"
> ++ #
> ++ # Rarely, after a holder is killed, two waiters can
> ++ # both get past this check and run together.Heh, it takes courage to claim that a race happens rarely. My experience is that no matter how unlikely a race, CI systems know to trigger that race often enough to annoy the hell out of you.
Show 7 quoted lines
> ++ if remove_expensive_lock_owned_by_ "$owner" > + then > -+ rm -f "$expensive_lock_" > ++ echo >&2 "# removing stale EXPENSIVE lock left by PID $owner" > + fi > + continue > + fi
It's a bit funny to say "removing" after you have removed the lock already. But providing that context can definitely be helpful, I'd assume.
Anyway, my comments are really only just nits, so please feel free to ignore them. Other than that I'm happy with this version, thanks!
Patrick