Aligned namespaces with an actual master (#18671)

This commit is contained in:
Georgy Krivoruchko 2023-07-28 01:20:54 -07:00 committed by GitHub
parent 349a0d420f
commit 4f13f0c5c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 22 deletions

View File

@ -12,7 +12,9 @@
#include <map> #include <map>
#include <sstream> #include <sstream>
namespace CommonTestUtils { namespace ov {
namespace test {
namespace utils {
/// \brief Enables dynamic load of libpq module /// \brief Enables dynamic load of libpq module
#define PGQL_DYNAMIC_LOAD #define PGQL_DYNAMIC_LOAD
@ -274,5 +276,6 @@ bool parse_test_name(const char* line, std::map<std::string, std::string>& keyVa
/// \returns Returns true if all input string was compiled, false in case of any compilation error /// \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<std::string, std::string>& keyValue, std::string& result); bool compile_string(const std::string& srcStr, const std::map<std::string, std::string>& keyValue, std::string& result);
} // namespace PostgreSQLHelpers } // namespace PostgreSQLHelpers
} // namespace utils
} // namespace CommonTestUtils } // namespace test
} // namespace ov

View File

@ -9,7 +9,9 @@
#include <map> #include <map>
#include <string> #include <string>
namespace CommonTestUtils { namespace ov {
namespace test {
namespace utils {
/// \brief Class-container for PostgreSQLLink-specific data, declared and implemented /// \brief Class-container for PostgreSQLLink-specific data, declared and implemented
/// out of header. Definition mustn't be a part of this header. /// 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() /// Works only if previously called set_manual_start()
void manual_start(void) const; void manual_start(void) const;
}; };
} // namespace utils
} // namespace CommonTestUtils } // namespace test
} // namespace ov
#ifdef ENABLE_CONFORMANCE_PGQL #ifdef ENABLE_CONFORMANCE_PGQL
namespace PostgreSQLLink { namespace PostgreSQLLink {

View File

@ -25,7 +25,9 @@ using ov::test::TestsCommon;
namespace ov { namespace ov {
namespace test { namespace test {
namespace utils {
class PostgreSQLLink; class PostgreSQLLink;
} //namespace utils
class TestsCommon : virtual public ::testing::Test { class TestsCommon : virtual public ::testing::Test {
/// \brief Holds a pointer on PostgreSQL interface implementation (see postgres_link.hpp). /// \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. /// 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 /// 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. /// will show an assert if some code tries to use it by a corresponding getter.
PostgreSQLLink* PGLink; utils::PostgreSQLLink* PGLink;
protected: protected:
TestsCommon(); TestsCommon();
@ -55,7 +57,7 @@ protected:
/// by a wrong behaviour. /// by a wrong behaviour.
/// \returns If object supports PostgreSQL reporting, then the method returns a pointer on /// \returns If object supports PostgreSQL reporting, then the method returns a pointer on
/// PostgreSQL interface implementation, otherwise - shows an assert or return a nullptr. /// PostgreSQL interface implementation, otherwise - shows an assert or return a nullptr.
PostgreSQLLink* GetPGLink() { utils::PostgreSQLLink* GetPGLink() {
#ifdef ENABLE_CONFORMANCE_PGQL #ifdef ENABLE_CONFORMANCE_PGQL
assert(this->PGLink != nullptr); assert(this->PGLink != nullptr);
#endif #endif

View File

@ -4,7 +4,9 @@
#include "common_test_utils/postgres_helpers.hpp" #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_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 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) { if (*modLibPQ == (HMODULE)0) {
modLibPQ = std::shared_ptr<HMODULE>(new HMODULE(dlopen("/opt/homebrew/opt/libpq/lib/libpq.dylib", RTLD_LAZY)), [](HMODULE* ptr) { modLibPQ = std::shared_ptr<HMODULE>(
if (*ptr != (HMODULE)0) { new HMODULE(dlopen("/opt/homebrew/opt/libpq/lib/libpq.dylib", RTLD_LAZY)),
std::cerr << PG_INF << "Freeing /opt/homebrew/opt/libpq/lib/libPQ.dylib handle\n"; [](HMODULE* ptr) {
try { if (*ptr != (HMODULE)0) {
dlclose(*ptr); std::cerr << PG_INF << "Freeing /opt/homebrew/opt/libpq/lib/libPQ.dylib handle\n";
} catch (...) { try {
dlclose(*ptr);
} catch (...) {
}
} }
} });
});
} }
# endif # endif
if (*modLibPQ == (HMODULE)0) { if (*modLibPQ == (HMODULE)0) {
@ -624,5 +628,6 @@ bool compile_string(const std::string& srcStr,
return readPos = srcStr.length(); return readPos = srcStr.length();
} }
} // namespace PostgreSQLHelpers } // namespace PostgreSQLHelpers
} // namespace utils
} // namespace CommonTestUtils } // namespace test
} // namespace ov

View File

@ -12,7 +12,9 @@ static std::map<std::string, std::string>
static std::map<std::string, std::string> static std::map<std::string, std::string>
ExtTestNames; // Map of extended test name convertors. It is used to change a test name automatically. 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; using namespace PostgreSQLHelpers;
@ -808,7 +810,10 @@ bool PostgreSQLLink::remove_custom_field(const std::string fieldName) const {
return false; return false;
} }
} // namespace CommonTestUtils } // namespace utils
} // namespace test
} // namespace ov
namespace PostgreSQLLink { namespace PostgreSQLLink {
std::map<std::string, std::string>* get_ext_test_queries(void) { std::map<std::string, std::string>* get_ext_test_queries(void) {
return &ExtTestQueries; return &ExtTestQueries;

View File

@ -72,7 +72,7 @@ TestsCommon::~TestsCommon() {
TestsCommon::TestsCommon() TestsCommon::TestsCommon()
#ifdef ENABLE_CONFORMANCE_PGQL #ifdef ENABLE_CONFORMANCE_PGQL
: PGLink(new PostgreSQLLink(this)) : PGLink(new utils::PostgreSQLLink(this))
#endif #endif
{ {
auto memsize = getVmSizeInKB(); auto memsize = getVmSizeInKB();