From e4fe05e1b0aa2c0b323ed77980f0f0d47a6f6eda Mon Sep 17 00:00:00 2001 From: Alex Fabijanic Date: Mon, 20 Nov 2023 23:08:03 -0600 Subject: [PATCH] fix test binaries path for cmake --- Data/src/sql-parser/src/sqlparser_win.h | 2 +- Foundation/testsuite/src/ClassLoaderTest.cpp | 15 ++++++++++++++- Foundation/testsuite/src/SharedLibraryTest.cpp | 15 +++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Data/src/sql-parser/src/sqlparser_win.h b/Data/src/sql-parser/src/sqlparser_win.h index 121f28a713..f7a273f859 100644 --- a/Data/src/sql-parser/src/sqlparser_win.h +++ b/Data/src/sql-parser/src/sqlparser_win.h @@ -11,7 +11,7 @@ #ifdef Data_API #define SQLParser_API Data_API - #ifdef Data_EXPORTS + #if defined(Data_EXPORTS) && !defined(SQLParser_EXPORTS) #define SQLParser_EXPORTS #endif #else diff --git a/Foundation/testsuite/src/ClassLoaderTest.cpp b/Foundation/testsuite/src/ClassLoaderTest.cpp index e89f039996..45bafbecdd 100644 --- a/Foundation/testsuite/src/ClassLoaderTest.cpp +++ b/Foundation/testsuite/src/ClassLoaderTest.cpp @@ -15,7 +15,7 @@ #include "Poco/Manifest.h" #include "Poco/Exception.h" #include "Poco/Path.h" -#include "Poco/Path.h" +#include "Poco/File.h" #include "Poco/Format.h" #include "TestPlugin.h" @@ -27,6 +27,7 @@ using Poco::AbstractMetaObject; using Poco::NotFoundException; using Poco::InvalidAccessException; using Poco::Path; +using Poco::File; ClassLoaderTest::ClassLoaderTest(const std::string& name): CppUnit::TestCase(name) @@ -198,6 +199,18 @@ std::string ClassLoaderTest::getFullName(const std::string& libName) .append(Poco::format("Foundation%ctestsuite%cbin%c", c, c, c)) .append(Poco::format("%s%c%s%c", OSNAME, c, OSARCH, c)) .append(libName).append(SharedLibrary::suffix()); + + // CMake + if (!File(name).exists()) + { + name = Path::expand("$POCO_BASE"); + name.append(Poco::format("%ccmake-build%cbin%c", c, c, c)) + .append(libName).append(SharedLibrary::suffix()); + } + + if (!File(name).exists()) + name = libName + SharedLibrary::suffix(); + return name; } diff --git a/Foundation/testsuite/src/SharedLibraryTest.cpp b/Foundation/testsuite/src/SharedLibraryTest.cpp index 7aae9f82dc..ee26fbd00a 100644 --- a/Foundation/testsuite/src/SharedLibraryTest.cpp +++ b/Foundation/testsuite/src/SharedLibraryTest.cpp @@ -14,6 +14,7 @@ #include "Poco/SharedLibrary.h" #include "Poco/Exception.h" #include "Poco/Path.h" +#include "Poco/File.h" #include "Poco/Format.h" @@ -22,6 +23,7 @@ using Poco::NotFoundException; using Poco::LibraryLoadException; using Poco::LibraryAlreadyLoadedException; using Poco::Path; +using Poco::File; typedef int (*GimmeFiveFunc)(); @@ -129,6 +131,7 @@ void SharedLibraryTest::testSharedLibrary3() std::string SharedLibraryTest::getFullName(const std::string& libName) { + // make std::string name = Path::expand("$POCO_BASE"); char c = Path::separator(); std::string OSNAME = Path::expand("$OSNAME"); @@ -137,6 +140,18 @@ std::string SharedLibraryTest::getFullName(const std::string& libName) .append(Poco::format("Foundation%ctestsuite%cbin%c", c, c, c)) .append(Poco::format("%s%c%s%c", OSNAME, c, OSARCH, c)) .append(libName).append(SharedLibrary::suffix()); + + // CMake + if (!File(name).exists()) + { + name = Path::expand("$POCO_BASE"); + name.append(Poco::format("%ccmake-build%cbin%c", c, c, c)) + .append(libName).append(SharedLibrary::suffix()); + } + + if (!File(name).exists()) + name = libName + SharedLibrary::suffix(); + return name; }