Skip to content

Commit

Permalink
Merge pull request #4271 from pocoproject/4064-fix-test-bin-path
Browse files Browse the repository at this point in the history
fix test binaries path for cmake
  • Loading branch information
pavledragisic authored Nov 21, 2023
2 parents def4dbe + e4fe05e commit 8af08cc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Data/src/sql-parser/src/sqlparser_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion Foundation/testsuite/src/ClassLoaderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down
15 changes: 15 additions & 0 deletions Foundation/testsuite/src/SharedLibraryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "Poco/SharedLibrary.h"
#include "Poco/Exception.h"
#include "Poco/Path.h"
#include "Poco/File.h"
#include "Poco/Format.h"


Expand All @@ -22,6 +23,7 @@ using Poco::NotFoundException;
using Poco::LibraryLoadException;
using Poco::LibraryAlreadyLoadedException;
using Poco::Path;
using Poco::File;


typedef int (*GimmeFiveFunc)();
Expand Down Expand Up @@ -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");
Expand All @@ -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;
}

Expand Down

0 comments on commit 8af08cc

Please sign in to comment.