[CodeClean/Test] use glib function sandbox/sangjung/tizen_7_backport accepted/tizen/7.0/unified/20240426.015338 accepted/tizen/8.0/unified/20240424.115821 accepted/tizen/unified/20240425.114336 accepted/tizen/unified/toolchain/20240427.045645 accepted/tizen/unified/x/20240426.050326
authorJaeyun Jung <jy1210.jung@samsung.com>
Thu, 18 Apr 2024 07:45:31 +0000 (16:45 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Thu, 18 Apr 2024 09:13:40 +0000 (18:13 +0900)
Code clean, use glib function to remove temp file for unittest.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
tests/plugin-parser/unittest_mlops_plugin_parser.cc

index 135a813b908016cc45e76d04b64ae9a863d3bb4a..f4386f9ce39d22fb105e0fa893ff1fdb56d0d974 100644 (file)
@@ -17,6 +17,7 @@
  */
 #include <glib.h>
 #include <gmodule.h>
+#include <glib/gstdio.h>
 #include <gio/gio.h>
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
@@ -395,7 +396,7 @@ TEST_F (PkgMgrInfoMockTestFixture, rpk_install7_n)
   ASSERT_TRUE (create_and_set_file (config_file_path, json_with_invalid_format));
   EXPECT_NE (exec_plugin_parser_func ("PKGMGR_MDPARSER_PLUGIN_INSTALL", pkgid, appid, NULL), 0);
 
-  if (remove (config_file_path) != 0) {
+  if (g_remove (config_file_path) != 0) {
     g_printerr ("Error removing file: %s\n", g_strerror (errno));
     ASSERT_TRUE (false);
   }
@@ -413,7 +414,7 @@ TEST_F (PkgMgrInfoMockTestFixture, rpk_install7_n)
   ASSERT_TRUE (create_and_set_file (config_file_path, json_with_no_name));
   EXPECT_NE (exec_plugin_parser_func ("PKGMGR_MDPARSER_PLUGIN_INSTALL", pkgid, appid, NULL), 0);
 
-  if (remove (config_file_path) != 0) {
+  if (g_remove (config_file_path) != 0) {
     g_printerr ("Error removing file: %s\n", g_strerror (errno));
     ASSERT_TRUE (false);
   }
@@ -430,7 +431,7 @@ TEST_F (PkgMgrInfoMockTestFixture, rpk_install7_n)
   ASSERT_TRUE (create_and_set_file (config_file_path, json_with_no_name_pipeline));
   EXPECT_NE (exec_plugin_parser_func ("PKGMGR_MDPARSER_PLUGIN_INSTALL", pkgid, appid, NULL), 0);
 
-  if (remove (config_file_path) != 0) {
+  if (g_remove (config_file_path) != 0) {
     g_printerr ("Error removing file: %s\n", g_strerror (errno));
     ASSERT_TRUE (false);
   }
@@ -449,7 +450,7 @@ TEST_F (PkgMgrInfoMockTestFixture, rpk_install7_n)
   ASSERT_TRUE (create_and_set_file (config_file_path, json_with_no_name_resource));
   EXPECT_NE (exec_plugin_parser_func ("PKGMGR_MDPARSER_PLUGIN_INSTALL", pkgid, appid, NULL), 0);
 
-  if (remove (config_file_path) != 0) {
+  if (g_remove (config_file_path) != 0) {
     g_printerr ("Error removing file: %s\n", g_strerror (errno));
     ASSERT_TRUE (false);
   }