# Test-lib patch to serialize EXPENSIVE tests is heading for a rework

_Several multi-gigabyte tests run in parallel under prove and exhaust memory on 16GB CI runners; the proposed lock may be replaced by something that cannot deadlock._

Section: Patches. Edition of 2026-11-28. Written by an AI editor from the thread "[PATCH] test-lib: run EXPENSIVE tests one at a time" (32 messages): https://gitlist.dev/t/66877

Kaartic Sivaraam's patch addresses a resource problem in the test suite. Several recent commits added EXPENSIVE tests that need multiple gigabytes of memory: tests for over-long tree paths in t1600, merge buffer size computations in t4300, and oversized binary patches in t4141. There is also the existing 5GB filtered hash-object test in t1007.

When GIT_TEST_LONG is set, 'prove --jobs' runs several of these at once. On the 16GB GitLab CI runners this exhausts memory. The patch makes these tests take a lock so only one runs at a time.

Junio Hamano's review started with wording fixes: 'multi-gigabyte' versus 'multiple gigabytes', and runners that 'observe' problems when they actually suffer them. He then noted an ordering concern. 'trap die EXIT' is registered right after die(), well before fail_117() where release_expensive_lock_() is defined, so an early failure while sourcing test-lib-functions.sh under set -e could enter die() while the release function is still undefined. He observed that the existing test -z guard on the lock variable helps somewhat, and suggested defining the lock variables and helpers above die() or guarding the call.

Junio also addressed the strength of the guarantee. Never deadlocking is the strong requirement, he wrote, and it is enough if the expensive tests mostly avoid running at the same time.

Kaartic posted a revised message with corrected commit references, then said he would send a v3 using a different locking mechanism that avoids deadlocks as far as possible. He expects to trade away the guarantee that only one such test runs at a time. Harald Nordgren and Patrick Steinhardt also took part in the thread, but their messages are not in the excerpts.
