| 30 | InkFreeList *flist = nullptr; |
| 31 | |
| 32 | void * |
| 33 | test(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 | |
| 68 | int |
| 69 | main(int /* argc ATS_UNUSED */, char * /*argv ATS_UNUSED */[]) |
no test coverage detected