Skip to content

Commit 7d30554

Browse files
committed
Fix decay tests for --disable-tcache case.
1 parent 39f5875 commit 7d30554

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

test/unit/decay.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ TEST_BEGIN(test_decay_ticks)
160160
* Test tcache fill/flush interactions for large and small size classes,
161161
* using an explicit tcache.
162162
*/
163-
{
163+
if (config_tcache) {
164164
unsigned tcache_ind, i;
165165
size_t tcache_sizes[2];
166166
tcache_sizes[0] = large0;
@@ -204,7 +204,7 @@ TEST_BEGIN(test_decay_ticker)
204204
uint64_t epoch;
205205
uint64_t npurge0 = 0;
206206
uint64_t npurge1 = 0;
207-
size_t sz, tcache_max, large;
207+
size_t sz, large;
208208
unsigned i, nupdates0;
209209
nstime_t time, decay_time, deadline;
210210

@@ -216,10 +216,18 @@ TEST_BEGIN(test_decay_ticker)
216216
* verify the ticker triggers purging.
217217
*/
218218

219-
sz = sizeof(size_t);
220-
assert_d_eq(mallctl("arenas.tcache_max", &tcache_max, &sz, NULL, 0), 0,
221-
"Unexpected mallctl failure");
222-
large = nallocx(tcache_max + 1, flags);
219+
if (config_tcache) {
220+
size_t tcache_max;
221+
222+
sz = sizeof(size_t);
223+
assert_d_eq(mallctl("arenas.tcache_max", &tcache_max, &sz, NULL,
224+
0), 0, "Unexpected mallctl failure");
225+
large = nallocx(tcache_max + 1, flags);
226+
} else {
227+
sz = sizeof(size_t);
228+
assert_d_eq(mallctl("arenas.lrun.0.size", &large, &sz, NULL, 0),
229+
0, "Unexpected mallctl failure");
230+
}
223231

224232
assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
225233
"Unexpected mallctl failure");

0 commit comments

Comments
 (0)