From 4f13f0c5c9b01c26e7a6e202c62e4d3ce0d1e64a Mon Sep 17 00:00:00 2001 From: Georgy Krivoruchko Date: Fri, 28 Jul 2023 01:20:54 -0700 Subject: [PATCH] Aligned namespaces with an actual master (#18671) --- .../common_test_utils/postgres_helpers.hpp | 9 ++++--- .../common_test_utils/postgres_link.hpp | 9 ++++--- .../include/common_test_utils/test_common.hpp | 6 +++-- .../src/postgres_helpers.cpp | 27 +++++++++++-------- .../common_test_utils/src/postgres_link.cpp | 9 +++++-- .../common_test_utils/src/test_common.cpp | 2 +- 6 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp index 257fb9fe1d8..dff641a5f97 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_helpers.hpp @@ -12,7 +12,9 @@ #include #include -namespace CommonTestUtils { +namespace ov { +namespace test { +namespace utils { /// \brief Enables dynamic load of libpq module #define PGQL_DYNAMIC_LOAD @@ -274,5 +276,6 @@ bool parse_test_name(const char* line, std::map& keyVa /// \returns Returns true if all input string was compiled, false in case of any compilation error bool compile_string(const std::string& srcStr, const std::map& keyValue, std::string& result); } // namespace PostgreSQLHelpers - -} // namespace CommonTestUtils +} // namespace utils +} // namespace test +} // namespace ov diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_link.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_link.hpp index cfa8ea2c1f9..94828fc55f6 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_link.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/postgres_link.hpp @@ -9,7 +9,9 @@ #include #include -namespace CommonTestUtils { +namespace ov { +namespace test { +namespace utils { /// \brief Class-container for PostgreSQLLink-specific data, declared and implemented /// out of header. Definition mustn't be a part of this header. @@ -72,8 +74,9 @@ public: /// Works only if previously called set_manual_start() void manual_start(void) const; }; - -} // namespace CommonTestUtils +} // namespace utils +} // namespace test +} // namespace ov #ifdef ENABLE_CONFORMANCE_PGQL namespace PostgreSQLLink { diff --git a/src/tests/test_utils/common_test_utils/include/common_test_utils/test_common.hpp b/src/tests/test_utils/common_test_utils/include/common_test_utils/test_common.hpp index 685b0ae4bfd..f832f32dbbb 100644 --- a/src/tests/test_utils/common_test_utils/include/common_test_utils/test_common.hpp +++ b/src/tests/test_utils/common_test_utils/include/common_test_utils/test_common.hpp @@ -25,7 +25,9 @@ using ov::test::TestsCommon; namespace ov { namespace test { +namespace utils { class PostgreSQLLink; +} //namespace utils class TestsCommon : virtual public ::testing::Test { /// \brief Holds a pointer on PostgreSQL interface implementation (see postgres_link.hpp). @@ -35,7 +37,7 @@ class TestsCommon : virtual public ::testing::Test { /// uses in a project, which doesn't define expected definition. /// But if no handler of the variable is linked to a final runtime, then it /// will show an assert if some code tries to use it by a corresponding getter. - PostgreSQLLink* PGLink; + utils::PostgreSQLLink* PGLink; protected: TestsCommon(); @@ -55,7 +57,7 @@ protected: /// by a wrong behaviour. /// \returns If object supports PostgreSQL reporting, then the method returns a pointer on /// PostgreSQL interface implementation, otherwise - shows an assert or return a nullptr. - PostgreSQLLink* GetPGLink() { + utils::PostgreSQLLink* GetPGLink() { #ifdef ENABLE_CONFORMANCE_PGQL assert(this->PGLink != nullptr); #endif diff --git a/src/tests/test_utils/common_test_utils/src/postgres_helpers.cpp b/src/tests/test_utils/common_test_utils/src/postgres_helpers.cpp index 783553af198..2a7148133ea 100644 --- a/src/tests/test_utils/common_test_utils/src/postgres_helpers.cpp +++ b/src/tests/test_utils/common_test_utils/src/postgres_helpers.cpp @@ -4,7 +4,9 @@ #include "common_test_utils/postgres_helpers.hpp" -namespace CommonTestUtils { +namespace ov { +namespace test { +namespace utils { const char* PGQL_ENV_CONN_NAME = "OV_POSTGRES_CONN"; // Environment variable with connection settings const char* PGQL_ENV_SESS_NAME = "OV_TEST_SESSION_ID"; // Environment variable identifies current session @@ -242,15 +244,17 @@ bool PostgreSQLConnection::load_libpq(void) { }); } if (*modLibPQ == (HMODULE)0) { - modLibPQ = std::shared_ptr(new HMODULE(dlopen("/opt/homebrew/opt/libpq/lib/libpq.dylib", RTLD_LAZY)), [](HMODULE* ptr) { - if (*ptr != (HMODULE)0) { - std::cerr << PG_INF << "Freeing /opt/homebrew/opt/libpq/lib/libPQ.dylib handle\n"; - try { - dlclose(*ptr); - } catch (...) { + modLibPQ = std::shared_ptr( + new HMODULE(dlopen("/opt/homebrew/opt/libpq/lib/libpq.dylib", RTLD_LAZY)), + [](HMODULE* ptr) { + if (*ptr != (HMODULE)0) { + std::cerr << PG_INF << "Freeing /opt/homebrew/opt/libpq/lib/libPQ.dylib handle\n"; + try { + dlclose(*ptr); + } catch (...) { + } } - } - }); + }); } # endif if (*modLibPQ == (HMODULE)0) { @@ -624,5 +628,6 @@ bool compile_string(const std::string& srcStr, return readPos = srcStr.length(); } } // namespace PostgreSQLHelpers - -} // namespace CommonTestUtils +} // namespace utils +} // namespace test +} // namespace ov diff --git a/src/tests/test_utils/common_test_utils/src/postgres_link.cpp b/src/tests/test_utils/common_test_utils/src/postgres_link.cpp index 165b8cf5b63..30b5a1f3ec1 100644 --- a/src/tests/test_utils/common_test_utils/src/postgres_link.cpp +++ b/src/tests/test_utils/common_test_utils/src/postgres_link.cpp @@ -12,7 +12,9 @@ static std::map static std::map ExtTestNames; // Map of extended test name convertors. It is used to change a test name automatically. -namespace CommonTestUtils { +namespace ov { +namespace test { +namespace utils { using namespace PostgreSQLHelpers; @@ -808,7 +810,10 @@ bool PostgreSQLLink::remove_custom_field(const std::string fieldName) const { return false; } -} // namespace CommonTestUtils +} // namespace utils +} // namespace test +} // namespace ov + namespace PostgreSQLLink { std::map* get_ext_test_queries(void) { return &ExtTestQueries; diff --git a/src/tests/test_utils/common_test_utils/src/test_common.cpp b/src/tests/test_utils/common_test_utils/src/test_common.cpp index 7020d859f16..fc1534ac984 100644 --- a/src/tests/test_utils/common_test_utils/src/test_common.cpp +++ b/src/tests/test_utils/common_test_utils/src/test_common.cpp @@ -72,7 +72,7 @@ TestsCommon::~TestsCommon() { TestsCommon::TestsCommon() #ifdef ENABLE_CONFORMANCE_PGQL - : PGLink(new PostgreSQLLink(this)) + : PGLink(new utils::PostgreSQLLink(this)) #endif { auto memsize = getVmSizeInKB();