From 7be383a929b46176166471943d159e53bf2cb9f4 Mon Sep 17 00:00:00 2001 From: Alex Fabijanic Date: Thu, 7 Mar 2024 00:20:51 +0100 Subject: [PATCH] try to fix ci --- .github/workflows/ci.yml | 3 +-- Foundation/include/Poco/Any.h | 7 ++++++- Foundation/src/File.cpp | 26 +++++++++++++++++++------- Foundation/testsuite/src/AnyTest.cpp | 2 +- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ad9a258da..a4b97c8674 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -530,8 +530,7 @@ jobs: class CppUnit::TestCaller.testBigPing, class CppUnit::TestCaller.testMTU, class CppUnit::TestCaller.testProxy, - class CppUnit::TestCaller.testProxy, - class CppUnit::TestCaller.testProcessRunner # cmake CI has messed up env path + class CppUnit::TestCaller.testProxy steps: - uses: actions/checkout@v3 - run: cmake -S. -Bcmake-build -DENABLE_NETSSL_WIN=ON -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_JWT=OFF -DENABLE_DATA=ON -DENABLE_DATA_ODBC=ON -DENABLE_DATA_MYSQL=OFF -DENABLE_DATA_POSTGRESQL=OFF -DENABLE_TESTS=ON diff --git a/Foundation/include/Poco/Any.h b/Foundation/include/Poco/Any.h index 4415984f1f..00673863d8 100644 --- a/Foundation/include/Poco/Any.h +++ b/Foundation/include/Poco/Any.h @@ -388,6 +388,9 @@ class Any template friend ValueType* AnyCast(Any*); + template + friend const ValueType* AnyCast(const Any*); + template friend ValueType* UnsafeAnyCast(Any*); @@ -426,7 +429,9 @@ const ValueType* AnyCast(const Any* operand) /// const MyType* pTmp = AnyCast(pAny). /// Returns nullptr if the types don't match. { - return AnyCast(const_cast(operand)); + return operand && operand->type() == typeid(ValueType) + ? &static_cast*>(operand->content())->_held + : nullptr; } diff --git a/Foundation/src/File.cpp b/Foundation/src/File.cpp index 5d9ed5356f..e08eab94a3 100644 --- a/Foundation/src/File.cpp +++ b/Foundation/src/File.cpp @@ -118,14 +118,26 @@ std::string File::absolutePath() const StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); for (const auto& p: st) { - std::string fileName(p); - if (p.size() && p[p.size()-1] != Path::separator()) - fileName.append(1, Path::separator()); - fileName.append(path()); - if (File(fileName).exists()) + try { - ret = fileName; - break; + std::string fileName(p); + if (p.size() && p[p.size()-1] != Path::separator()) + fileName.append(1, Path::separator()); + fileName.append(path()); + if (File(fileName).exists()) + { + ret = fileName; + break; + } + } + catch (const Poco::PathSyntaxException&) + { + // this try/catch is only here to prevent windows cmake CI from failing + // (apparently bad windows path settings in the CI environment): + // + // class CppUnit::TestCaller.testProcessRunner + // "class Poco::PathSyntaxException: + // Bad path syntax: D:/a/poco/poco/cmake-build/bin:C:\Program Files\PowerShell\7\TestApp" } } } diff --git a/Foundation/testsuite/src/AnyTest.cpp b/Foundation/testsuite/src/AnyTest.cpp index e13e4841b5..f1e3e00c6c 100644 --- a/Foundation/testsuite/src/AnyTest.cpp +++ b/Foundation/testsuite/src/AnyTest.cpp @@ -134,7 +134,7 @@ void AnyTest::testAnyCastToReference() int& ra = AnyCast(a); int const& ra_c = AnyCast(a); - // NOTE: The following two AnyCasts will trigger the + // NOTE: The volatile AnyCasts will trigger the // undefined behavior sanitizer. int volatile& ra_v = AnyCast(a); int const volatile& ra_cv = AnyCast(a);