Fix/Coverity/1123913,1123863 : Handle thrown exception
authorgichan-jang <gichan2.jang@samsung.com>
Tue, 11 Feb 2020 04:21:59 +0000 (13:21 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Tue, 11 Feb 2020 04:57:55 +0000 (13:57 +0900)
Fix to catch exception from GTest
Coverity CID : 1123913, 1123863 and potential error code

Signed-off-by: gichan-jang <gichan2.jang@samsung.com>
tests/nnstreamer_filter_armnn/unittest_filter_armnn.cc
tests/nnstreamer_filter_edgetpu/unittest_edgetpu.cc
tests/tizen_nnfw_runtime/unittest_tizen_nnfw_runtime_raw.cc

index 82e78af..0f62b8e 100644 (file)
@@ -468,12 +468,19 @@ TEST (nnstreamer_filter_armnn, invoke_01)
 int
 main (int argc, char **argv)
 {
-  int result;
+  int result = -1;
 
-  testing::InitGoogleTest (&argc, argv);
-
-  result = RUN_ALL_TESTS ();
+  try {
+    testing::InitGoogleTest (&argc, argv);
+  } catch (...) {
+    g_warning ("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue'");
+  }
 
+  try {
+    result = RUN_ALL_TESTS ();
+  } catch (...) {
+    g_warning ("catch `testing::internal::GoogleTestFailureException`");
+  }
+  
   return result;
 }
-
index 84c0e37..71c7d19 100644 (file)
@@ -132,12 +132,21 @@ TEST (edgetpu_tflite_direct, error_02_n)
  */
 int main (int argc, char **argv)
 {
-  int result;
+  int result = -1;
 
-  testing::InitGoogleTest (&argc, argv);
+  try {
+    testing::InitGoogleTest (&argc, argv);
+  } catch (...) {
+    g_warning ("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue'");
+  }
 
   gst_init (&argc, &argv);
-  result = RUN_ALL_TESTS ();
+
+  try {
+    result = RUN_ALL_TESTS ();
+  } catch (...) {
+    g_warning ("catch `testing::internal::GoogleTestFailureException`");
+  }
 
   return result;
 }
index 36e4599..a3ae761 100644 (file)
@@ -1281,15 +1281,21 @@ TEST (nnstreamer_nnfw_mlapi, multimodel_02_p)
 int
 main (int argc, char **argv)
 {
-  int result;
-
-  testing::InitGoogleTest (&argc, argv);
+  int result = -1;
 
+  try {
+    testing::InitGoogleTest (&argc, argv);
+  } catch (...) {
+    g_warning ("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue'");
+  }
   /* ignore tizen feature status while running the testcases */
   set_feature_state (1);
 
-  result = RUN_ALL_TESTS ();
-
+  try {
+    result = RUN_ALL_TESTS ();
+  } catch (...) {
+    g_warning ("catch `testing::internal::GoogleTestFailureException`");
+  }
   set_feature_state (-1);
 
   return result;