From c699cc56365d828388b082ff0f64bc4d6f7496c7 Mon Sep 17 00:00:00 2001 From: Daniel Schemmel Date: Thu, 29 Jun 2023 00:57:09 +0000 Subject: Perform location_info tests in KDAlloc's random test --- unittests/KDAlloc/randomtest.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/unittests/KDAlloc/randomtest.cpp b/unittests/KDAlloc/randomtest.cpp index 1120ee4e..c78746bb 100644 --- a/unittests/KDAlloc/randomtest.cpp +++ b/unittests/KDAlloc/randomtest.cpp @@ -78,7 +78,17 @@ public: auto choice = std::uniform_int_distribution( 0, allocations.size() - 1)(rng); #if defined(USE_KDALLOC) + assert(allocator.location_info(allocations[choice].first, 1) == + klee::kdalloc::LocationInfo::LI_AllocatedOrQuarantined); + assert(allocator.location_info(allocations[choice].first, + allocations[choice].second) == + klee::kdalloc::LocationInfo::LI_AllocatedOrQuarantined); allocator.free(allocations[choice].first, allocations[choice].second); + assert(allocator.location_info(allocations[choice].first, 1) == + klee::kdalloc::LocationInfo::LI_Unallocated); + assert(allocator.location_info(allocations[choice].first, + allocations[choice].second) == + klee::kdalloc::LocationInfo::LI_Unallocated); #else free(allocations[choice].first); #endif @@ -152,7 +162,7 @@ int main() { auto start = std::chrono::steady_clock::now(); RandomTest tester; - tester.run(10'000'000); + tester.run(1'000'000); auto stop = std::chrono::steady_clock::now(); std::cout << std::dec -- cgit 1.4.1