mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Reduce unit test runtimes dramatically for debug builds
This commit is contained in:
parent
93d3e7eb30
commit
9aa61440ea
@ -120,6 +120,7 @@ endif ()
|
|||||||
#for config
|
#for config
|
||||||
if (RELEASE_BUILD)
|
if (RELEASE_BUILD)
|
||||||
set(HS_OPTIMIZE ON)
|
set(HS_OPTIMIZE ON)
|
||||||
|
add_definitions(-DNDEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include (${CMAKE_MODULE_PATH}/sanitize.cmake)
|
include (${CMAKE_MODULE_PATH}/sanitize.cmake)
|
||||||
|
@ -157,7 +157,11 @@ TEST_P(HyperscanScanGigabytesMatch, StreamingMatch) {
|
|||||||
|
|
||||||
// gb is the number of gigabytes to scan between pre-block and post-block
|
// gb is the number of gigabytes to scan between pre-block and post-block
|
||||||
// run over 1,2,4,8 gb
|
// run over 1,2,4,8 gb
|
||||||
|
#ifdef NDEBUG
|
||||||
for (unsigned long long gb = 1; gb <= 8; gb *= 2) {
|
for (unsigned long long gb = 1; gb <= 8; gb *= 2) {
|
||||||
|
#else
|
||||||
|
for (unsigned long long gb = 1; gb <= 2; gb *= 2) {
|
||||||
|
#endif
|
||||||
SCOPED_TRACE(gb);
|
SCOPED_TRACE(gb);
|
||||||
|
|
||||||
hs_stream_t *stream = nullptr;
|
hs_stream_t *stream = nullptr;
|
||||||
@ -261,12 +265,12 @@ TEST_P(HyperscanScanGigabytesMatch, BlockMatch) {
|
|||||||
1*1024,
|
1*1024,
|
||||||
#ifdef BIG_BLOCKS
|
#ifdef BIG_BLOCKS
|
||||||
4*1024, 32*1024, 128*1024, 512*1024,
|
4*1024, 32*1024, 128*1024, 512*1024,
|
||||||
|
#ifdef NDEBUG
|
||||||
// gigabytes
|
// gigabytes
|
||||||
1024*1024,
|
1024*1024,
|
||||||
#ifdef ARCH_X86_64
|
|
||||||
// big cases for big beefy machines
|
// big cases for big beefy machines
|
||||||
2048*1024, 3072*1024
|
2048*1024, 3072*1024
|
||||||
#endif // ARCH_X86_64
|
#endif // NDEBUG
|
||||||
#endif // BIG_BLOCKS
|
#endif // BIG_BLOCKS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -235,7 +235,11 @@ static const unsigned test_modes[] = {HS_MODE_BLOCK, HS_MODE_STREAM,
|
|||||||
static const unsigned test_flags[] = {0, HS_FLAG_SINGLEMATCH,
|
static const unsigned test_flags[] = {0, HS_FLAG_SINGLEMATCH,
|
||||||
HS_FLAG_SOM_LEFTMOST};
|
HS_FLAG_SOM_LEFTMOST};
|
||||||
|
|
||||||
|
#ifdef NDEBUG
|
||||||
static const unsigned test_sizes[] = {1, 10, 100, 500, 10000};
|
static const unsigned test_sizes[] = {1, 10, 100, 500, 10000};
|
||||||
|
#else
|
||||||
|
static const unsigned test_sizes[] = {1, 10, 100, 500};
|
||||||
|
#endif
|
||||||
|
|
||||||
static const pair<unsigned, unsigned> test_bounds[] = {{3u, 10u}, {10u, 100u}};
|
static const pair<unsigned, unsigned> test_bounds[] = {{3u, 10u}, {10u, 100u}};
|
||||||
|
|
||||||
|
@ -1327,16 +1327,19 @@ static const MultiBitTestParam multibitTests[] = {
|
|||||||
{ 1024, 1 },
|
{ 1024, 1 },
|
||||||
{ 1025, 1 },
|
{ 1025, 1 },
|
||||||
{ 2099, 1 },
|
{ 2099, 1 },
|
||||||
|
#ifdef NDEBUG
|
||||||
{ 10000, 1 },
|
{ 10000, 1 },
|
||||||
{ 32768, 1 },
|
{ 32768, 1 },
|
||||||
{ 32769, 1 },
|
{ 32769, 1 },
|
||||||
{ 200000, 1 },
|
{ 200000, 1 },
|
||||||
|
#endif
|
||||||
|
|
||||||
// Larger cases, bigger strides.
|
// Larger cases, bigger strides.
|
||||||
{ 1U << 18, 3701 },
|
{ 1U << 18, 3701 },
|
||||||
{ 1U << 19, 3701 },
|
{ 1U << 19, 3701 },
|
||||||
{ 1U << 20, 3701 },
|
{ 1U << 20, 3701 },
|
||||||
{ 1U << 21, 3701 },
|
{ 1U << 21, 3701 },
|
||||||
|
#ifdef NDEBUG
|
||||||
{ 1U << 22, 3701 },
|
{ 1U << 22, 3701 },
|
||||||
{ 1U << 23, 3701 },
|
{ 1U << 23, 3701 },
|
||||||
{ 1U << 24, 3701 },
|
{ 1U << 24, 3701 },
|
||||||
@ -1347,6 +1350,7 @@ static const MultiBitTestParam multibitTests[] = {
|
|||||||
{ 1U << 29, 24413 },
|
{ 1U << 29, 24413 },
|
||||||
{ 1U << 30, 50377 },
|
{ 1U << 30, 50377 },
|
||||||
{ 1U << 31, 104729 },
|
{ 1U << 31, 104729 },
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(MultiBit, MultiBitTest, ValuesIn(multibitTests));
|
INSTANTIATE_TEST_CASE_P(MultiBit, MultiBitTest, ValuesIn(multibitTests));
|
||||||
|
@ -165,10 +165,12 @@ TEST(MultiBitComp, CompCompsizeSparse) {
|
|||||||
257,
|
257,
|
||||||
4097,
|
4097,
|
||||||
(1U << 18) + 1,
|
(1U << 18) + 1,
|
||||||
|
#ifdef NDEBUG
|
||||||
(1U << 24) + 1,
|
(1U << 24) + 1,
|
||||||
(1U << 30) + 1
|
(1U << 30) + 1
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
for (u32 i = 0; i < 5; i++) {
|
for (u32 i = 0; i < sizeof(test_set)/sizeof(u32); i++) {
|
||||||
u32 test_size = test_set[i];
|
u32 test_size = test_set[i];
|
||||||
mmbit_holder ba(test_size);
|
mmbit_holder ba(test_size);
|
||||||
|
|
||||||
@ -225,10 +227,12 @@ TEST(MultiBitComp, CompCompsizeDense) {
|
|||||||
257,
|
257,
|
||||||
4097,
|
4097,
|
||||||
(1U << 18) + 1,
|
(1U << 18) + 1,
|
||||||
|
#ifdef NDEBUG
|
||||||
(1U << 24) + 1,
|
(1U << 24) + 1,
|
||||||
(1U << 30) + 1
|
(1U << 30) + 1
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
for (u32 i = 0; i < 5; i++) {
|
for (u32 i = 0; i < sizeof(test_set)/sizeof(u32); i++) {
|
||||||
u32 test_size = test_set[i];
|
u32 test_size = test_set[i];
|
||||||
mmbit_holder ba(test_size);
|
mmbit_holder ba(test_size);
|
||||||
|
|
||||||
@ -760,16 +764,19 @@ static const MultiBitCompTestParam multibitCompTests[] = {
|
|||||||
{ 1025, 1 },
|
{ 1025, 1 },
|
||||||
{ 2099, 1 }, // 4097 = 64 ^ 2 + 1
|
{ 2099, 1 }, // 4097 = 64 ^ 2 + 1
|
||||||
{ 4097, 1 },
|
{ 4097, 1 },
|
||||||
|
#ifdef NDEBUG
|
||||||
{ 10000, 1 },
|
{ 10000, 1 },
|
||||||
{ 32768, 1 },
|
{ 32768, 1 },
|
||||||
{ 32769, 1 },
|
{ 32769, 1 },
|
||||||
{ 200000, 1 },
|
{ 200000, 1 },
|
||||||
{ 262145, 1 }, // 262145 = 64 * 3 + 1
|
{ 262145, 1 }, // 262145 = 64 * 3 + 1
|
||||||
|
#endif
|
||||||
|
|
||||||
// Larger cases, bigger strides.
|
// Larger cases, bigger strides.
|
||||||
{ 1U << 19, 3701 },
|
{ 1U << 19, 3701 },
|
||||||
{ 1U << 20, 3701 },
|
{ 1U << 20, 3701 },
|
||||||
{ 1U << 21, 3701 },
|
{ 1U << 21, 3701 },
|
||||||
|
#ifdef NDEBUG
|
||||||
{ 1U << 22, 3701 },
|
{ 1U << 22, 3701 },
|
||||||
{ 1U << 23, 3701 },
|
{ 1U << 23, 3701 },
|
||||||
{ 1U << 24, 3701 },
|
{ 1U << 24, 3701 },
|
||||||
@ -780,6 +787,7 @@ static const MultiBitCompTestParam multibitCompTests[] = {
|
|||||||
{ 1U << 29, 24413 },
|
{ 1U << 29, 24413 },
|
||||||
{ 1U << 30, 50377 },
|
{ 1U << 30, 50377 },
|
||||||
{ 1U << 31, 104729 },
|
{ 1U << 31, 104729 },
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(MultiBitComp, MultiBitCompTest,
|
INSTANTIATE_TEST_CASE_P(MultiBitComp, MultiBitCompTest,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user