MCPcopy Create free account
hub / github.com/apache/trafficserver / test

Function test

src/tscore/test_freelist.cc:32–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30InkFreeList *flist = nullptr;
31
32void *
33test(void *d)
34{
35 int id;
36 void *m1, *m2, *m3;
37
38 id = (intptr_t)d;
39
40 time_t start = time(nullptr);
41 int count = 0;
42 for (;;) {
43 m1 = ink_freelist_new(flist);
44 m2 = ink_freelist_new(flist);
45 m3 = ink_freelist_new(flist);
46
47 if ((m1 == m2) || (m1 == m3) || (m2 == m3)) {
48 printf("0x%08" PRIx64 " 0x%08" PRIx64 " 0x%08" PRIx64 "\n", static_cast<uint64_t>((uintptr_t)m1),
49 static_cast<uint64_t>((uintptr_t)m2), static_cast<uint64_t>((uintptr_t)m3));
50 exit(1);
51 }
52
53 memset(m1, id, 64);
54 memset(m2, id, 64);
55 memset(m3, id, 64);
56
57 ink_freelist_free(flist, m1);
58 ink_freelist_free(flist, m2);
59 ink_freelist_free(flist, m3);
60
61 // break out of the test if we have run more then 60 seconds
62 if (++count % 1000 == 0 && (start + 60) < time(nullptr)) {
63 return nullptr;
64 }
65 }
66}
67
68int
69main(int /* argc ATS_UNUSED */, char * /*argv ATS_UNUSED */[])

Callers 3

mainFunction · 0.70
test_Errata.ccFile · 0.50

Calls 3

ink_freelist_newFunction · 0.85
memsetFunction · 0.85
ink_freelist_freeFunction · 0.85

Tested by

no test coverage detected