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 a78b4b89bcf40ba61089657598b587a0f4a3e8a3..9ba8b2032b2cc9476b2da36b32e613c928b71ee0 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()); \