Netssl/openssl3 (#3575)

* feat(Context): DH init openssl3 port (1/2 hardcoded params)

* create poco-1.11.3 branch, bump version

* update copyright date

* #3567: check legacy provider existence for legacy exception #3567

* fix(Placeholder): comparison for zero value

* feat(Context): DH init openssl3 port (2/2 params from file)

* test(HTTPSClientSession): try/catch to understand CI failure

* chore(cmake): copy the DH parameters file

* fix(OpenSSLInitializer): unload provider on uninitialize

* chore(HTTPSClientSessionTest): remove try/catch

* fix(OpenSSLInitializer): fix provider unloading

* feat(CppUnit): make tests exceptions more descriptive

* chore(CppUnit): a more descriptive name for callback

Co-authored-by: Günter Obiltschnig <guenter.obiltschnig@appinf.com>
This commit is contained in:
Aleksandar Fabijanic
2022-04-28 22:24:43 -05:00
committed by GitHub
parent 4dfbcd33db
commit 7db9831f32
31 changed files with 296 additions and 114 deletions

View File

@@ -10,6 +10,7 @@
#include "CppUnit/CppUnit.h"
#include <string>
#include <vector>
#include <functional>
namespace CppUnit {
@@ -33,8 +34,10 @@ public:
};
public:
using Callback = std::function<std::string(const std::exception&)>;
virtual ~Test() = 0;
virtual void run(TestResult* result) = 0;
virtual void run(TestResult* result, const Callback& callback = nullptr) = 0;
virtual int countTestCases() const = 0;
virtual std::string toString() const = 0;
virtual Test::Type getType() const = 0;
@@ -43,7 +46,7 @@ public:
const std::vector<std::string>& setup() const;
private:
std::vector<std::string> _setup;
std::vector<std::string> _setup;
};
@@ -53,7 +56,7 @@ inline Test::~Test()
// Runs a test and collects its result in a TestResult instance.
inline void Test::run(TestResult *result)
inline void Test::run(TestResult *result, const Callback& callback)
{
}

View File

@@ -90,7 +90,7 @@ public:
TestCase(const std::string& Name, Test::Type testType = Test::Normal);
~TestCase();
virtual void run(TestResult* result);
virtual void run(TestResult* result, const Test::Callback& callback = nullptr);
virtual TestResult* run();
virtual int countTestCases() const;
virtual std::string toString() const;

View File

@@ -35,7 +35,7 @@ public:
int countTestCases() const;
void run(TestResult* result);
void run(TestResult* result, const Test::Callback& callback);
std::string toString() const;

View File

@@ -8,20 +8,19 @@
#include "CppUnit/CppUnit.h"
#include "CppUnit/Test.h"
#include <vector>
#include <string>
#include <ostream>
#if defined(POCO_VXWORKS)
#include <cstdarg>
#endif
#include "Poco/Exception.h"
namespace CppUnit {
class Test;
/*
* A command line based tool to run tests.
* TestRunner expects as its only argument the name of a TestCase class.
@@ -46,7 +45,7 @@ public:
TestRunner(std::ostream& ostr);
~TestRunner();
bool run(const std::vector<std::string>& args);
bool run(const std::vector<std::string>& args, const Test::Callback& callback = nullptr);
void addTest(const std::string& name, Test* test);
protected:
@@ -85,6 +84,16 @@ private:
return runner.run(args) ? 0 : 1; \
}
#else
#define CppUnitPocoExceptionText(exc) \
CppUnit::Test::Callback exc = [] (const std::exception& ex) \
{ \
std::string text; \
const Poco::Exception* pEx = dynamic_cast<const Poco::Exception*>(&ex); \
if (pEx) text = pEx->displayText(); \
else text = ex.what(); \
return text; \
}
#define CppUnitMain(testCase) \
int main(int ac, char **av) \
{ \
@@ -93,7 +102,8 @@ private:
args.push_back(std::string(av[i])); \
CppUnit::TestRunner runner; \
runner.addTest(#testCase, testCase::suite()); \
return runner.run(args) ? 0 : 1; \
CppUnitPocoExceptionText(exc); \
return runner.run(args, exc) ? 0 : 1; \
}
#endif

View File

@@ -41,7 +41,7 @@ public:
TestSuite(const std::string& name = "");
~TestSuite();
void run(TestResult* result);
void run(TestResult* result, const Test::Callback& callback = nullptr);
int countTestCases() const;
void addTest(Test* test);
std::string toString() const;