From: Jaehyun Kim Date: Wed, 24 Mar 2021 08:34:39 +0000 (+0900) Subject: Fix uncaught exception in haltests X-Git-Tag: submit/tizen/20210329.051231~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5126beb741a86033f4f1489b93830a49cde457f1;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git Fix uncaught exception in haltests Change-Id: I7615631a4da292493757b00a8c4c9340429f60ec Signed-off-by: Jaehyun Kim --- diff --git a/haltests/wifi-haltests.cpp b/haltests/wifi-haltests.cpp index 508fb76..a40c9a0 100755 --- a/haltests/wifi-haltests.cpp +++ b/haltests/wifi-haltests.cpp @@ -425,12 +425,27 @@ TEST(WifiHaltest, SoftapDeinit_p) int main(int argc, char **argv) { + int ret = -1; + if (argc > 1 && argv[argc - 1][0] != '-') { g_strlcpy(ap_name, argv[argc - 1], MAX_AP_LENGTH); argc--; } __set_p2p_ifname(); - InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); + + try { + InitGoogleTest(&argc, argv); + } catch(...) { + std::cout << "Exception occurred." << std::endl; + } + + try { + ret = RUN_ALL_TESTS(); + } catch (const ::testing::internal::GoogleTestFailureException& e) { + ret = -1; + std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl; + } + + return ret; }