YACA: Check openssl errors even if test passes 97/75797/4
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 21 Jun 2016 11:33:17 +0000 (13:33 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 21 Jun 2016 14:24:33 +0000 (16:24 +0200)
Change-Id: Ib1efae6d2edc3a37ed2813ae8774cd66b0522a2f

src/yaca/yaca-test-common.h

index a78b4b8..9ba8b20 100644 (file)
@@ -49,10 +49,21 @@ do {
                 assertMsg << err;                                                 \
             clear_openssl_errors();                                               \
         }                                                                         \
-        DPL::Test::TestFailed e(#test,                                            \
+        DPL::Test::TestFailed e(#test, __FILE__, __LINE__, assertMsg.str());      \
+        if (!std::uncaught_exception())                                           \
+            throw e;                                                              \
+        DPL::Test::TestRunnerSingleton::Instance().addFailReason(e.GetMessage()); \
+    } else if (!get_openssl_errors().empty()) {                                   \
+        std::ostringstream failMsg;                                               \
+        failMsg << DPL::gdbbacktrace();                              \
+        failMsg << std::endl << "OPENSSL ERRORS:" << std::endl;                 \
+        for (auto &err : get_openssl_errors())                                    \
+            failMsg << err;                                                     \
+        clear_openssl_errors();                                                   \
+        DPL::Test::TestFailed e("Unhandled OpenSSL error",                        \
                                 __FILE__,                                         \
                                 __LINE__,                                         \
-                                assertMsg.str());                                 \
+                                failMsg.str());                                 \
         if (!std::uncaught_exception())                                           \
             throw e;                                                              \
         DPL::Test::TestRunnerSingleton::Instance().addFailReason(e.GetMessage()); \