Reduce parallism in tests
If some tests on Windows are co-scheduled, then they run out of commit space and crash. For example, in func-memory, test_external_pointer_large can cause the small CI machines to run out of commit space on Windows.
This commit is contained in:
@@ -177,8 +177,25 @@ if(NOT DEFINED SNMALLOC_ONLY_HEADER_LIBRARY)
|
||||
add_test(${TESTNAME} ${TESTNAME})
|
||||
endif()
|
||||
if (${TEST_CATEGORY} MATCHES "perf")
|
||||
message(STATUS "Single threaded test: ${TESTNAME}")
|
||||
set_tests_properties(${TESTNAME} PROPERTIES PROCESSORS 4)
|
||||
endif()
|
||||
if(MSVC)
|
||||
# On Windows these tests use a lot of memory as it doesn't support
|
||||
# lazy commit.
|
||||
if (${TEST} MATCHES "two_alloc_types")
|
||||
message(STATUS "Single threaded test: ${TESTNAME}")
|
||||
set_tests_properties(${TESTNAME} PROPERTIES PROCESSORS 4)
|
||||
endif()
|
||||
if (${TEST} MATCHES "fixed_region")
|
||||
message(STATUS "Single threaded test: ${TESTNAME}")
|
||||
set_tests_properties(${TESTNAME} PROPERTIES PROCESSORS 4)
|
||||
endif()
|
||||
if (${TEST} MATCHES "memory")
|
||||
message(STATUS "Single threaded test: ${TESTNAME}")
|
||||
set_tests_properties(${TESTNAME} PROPERTIES PROCESSORS 4)
|
||||
endif()
|
||||
endif()
|
||||
if (${TEST_CATEGORY} MATCHES "func")
|
||||
target_compile_definitions(${TESTNAME} PRIVATE -DUSE_SNMALLOC_STATS)
|
||||
endif ()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <iostream>
|
||||
#include <snmalloc.h>
|
||||
#include <test/opt.h>
|
||||
#include <test/xoroshiro.h>
|
||||
@@ -215,11 +216,14 @@ void test_external_pointer_large()
|
||||
// Pre allocate all the objects
|
||||
size_t* objects[count];
|
||||
|
||||
size_t total_size = 0;
|
||||
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
size_t b = snmalloc::bits::is64() ? 28 : 26;
|
||||
size_t rand = r.next() & ((1 << b) - 1);
|
||||
size_t size = (1 << 24) + rand;
|
||||
total_size += size;
|
||||
// store object
|
||||
objects[i] = (size_t*)alloc->alloc(size);
|
||||
// Store allocators size for this object
|
||||
@@ -235,6 +239,9 @@ void test_external_pointer_large()
|
||||
check_external_pointer_large(objects[i]);
|
||||
}
|
||||
|
||||
std::cout << "Total size allocated in test_external_pointer_large: "
|
||||
<< total_size << std::endl;
|
||||
|
||||
// Deallocate everything
|
||||
for (size_t i = 0; i < count; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user