diff options
author | Tor Brede Vekterli <vekterli@vespa.ai> | 2023-11-06 09:46:11 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@vespa.ai> | 2023-11-06 09:51:40 +0000 |
commit | 09bbe3a63e31e89eae587335e60efd189c40f6f0 (patch) | |
tree | ec4515ede73f62e4217ef73c233ff6b5f0188963 /searchcore | |
parent | 40badc9abe05362eb94a163a8fed75627b0a4486 (diff) |
Make test for target numdocs auto-tuning aware of sanitizers
Test must mirror the logic used for enabling auto-tuning, or it
will fail when testing on a sanitizer-instrumented build.
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp index 7f24dd6f30f..09cec0d6d01 100644 --- a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp +++ b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp @@ -25,6 +25,7 @@ #include <vespa/vespalib/util/hw_info.h> #include <vespa/vespalib/util/varholder.h> #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/config.h> #include <map> #include <thread> @@ -393,6 +394,15 @@ TEST_FF("require that target numdocs is fixed 1k for indexed mode", } } +constexpr bool target_numdocs_hw_adjustment_is_enabled() noexcept { + // Must mirror logic of `use_hw_memory_presized_target_num_docs()` in documentdbconfigmanager.cpp +#ifndef VESPA_USE_SANITIZER + return true; +#else + return false; +#endif +} + TEST_FF("require that target numdocs follows memory for streaming mode", ConfigTestFixture("search"), DocumentDBConfigManager(f1.configId + "/test", "test")) @@ -401,12 +411,14 @@ TEST_FF("require that target numdocs follows memory for streaming mode", { auto config = getDocumentDBConfig(f1, f2, createHwInfoWithMemory(1_Gi)); AllocStrategy strategy = config->get_alloc_config().make_alloc_strategy(SubDbType::READY); - EXPECT_EQUAL(23342213u, strategy.get_grow_strategy().getMinimumCapacity()); + const auto expected = target_numdocs_hw_adjustment_is_enabled() ? 23342213u : 1024u; + EXPECT_EQUAL(expected, strategy.get_grow_strategy().getMinimumCapacity()); } { auto config = getDocumentDBConfig(f1, f2, createHwInfoWithMemory(10_Gi)); AllocStrategy strategy = config->get_alloc_config().make_alloc_strategy(SubDbType::READY); - EXPECT_EQUAL(233422135u, strategy.get_grow_strategy().getMinimumCapacity()); + const auto expected = target_numdocs_hw_adjustment_is_enabled() ? 233422135u : 1024u; + EXPECT_EQUAL(expected, strategy.get_grow_strategy().getMinimumCapacity()); } } |