summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-06-14 15:14:17 +0200
committerSander Vrijders <sander@ouroboros.rocks>2026-06-29 08:32:55 +0200
commitf5b15630d20acc893e3000f248f03185763f24b0 (patch)
tree76052a4d3479378841e75fd80ba45c53355bcbad /src/lib
parent89d43d23863aebae7c20df28f9f9f662d8dbc725 (diff)
downloadouroboros-f5b15630d20acc893e3000f248f03185763f24b0.tar.gz
ouroboros-f5b15630d20acc893e3000f248f03185763f24b0.zip
lib: Fix SSM reclaim-orphans test
Age the simulated-leaked blocks via alloc_ts so the aged-reclaim triggers in the test. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ssm/tests/pool_test.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/ssm/tests/pool_test.c b/src/lib/ssm/tests/pool_test.c
index 0f9db24d..f86fbd9e 100644
--- a/src/lib/ssm/tests/pool_test.c
+++ b/src/lib/ssm/tests/pool_test.c
@@ -956,6 +956,8 @@ static int test_ssm_pool_reclaim_orphans(void)
ssize_t ret3;
pid_t my_pid;
pid_t fake_pid = 99999;
+ struct timespec now;
+ uint64_t old_ts;
TEST_START();
@@ -976,9 +978,15 @@ static int test_ssm_pool_reclaim_orphans(void)
goto fail_alloc;
}
- /* Simulate blocks from another process by changing allocator_pid */
+ /* Simulate blocks leaked by a dead process: foreign pid, aged out. */
+ clock_gettime(CLOCK_MONOTONIC, &now);
+ old_ts = ((uint64_t) now.tv_sec - (SSM_POOL_RECLAIM_AGE_S + 1))
+ * 1000000000ULL + (uint64_t) now.tv_nsec;
+
spb1->allocator_pid = fake_pid;
spb2->allocator_pid = fake_pid;
+ spb1->alloc_ts = old_ts;
+ spb2->alloc_ts = old_ts;
/* Keep spb3 with our pid */
/* Reclaim orphans from fake_pid */