Fix static analysis issues 69/288169/2
authorilho kim <ilho159.kim@samsung.com>
Mon, 13 Feb 2023 02:25:54 +0000 (11:25 +0900)
committerilho kim <ilho159.kim@samsung.com>
Mon, 13 Feb 2023 03:58:23 +0000 (12:58 +0900)
- Unchecked return value

Change-Id: Ic59b1ee15622fd86f1bf4782e3df0191aa7fe0aa
Signed-off-by: ilho kim <ilho159.kim@samsung.com>
test/unit_tests/test_cert_db_handlers.cc
test/unit_tests/test_parser_db_handlers.cc
test/unit_tests/test_query_db_handlers.cc

index 8fc35ed..8b8c0fc 100644 (file)
@@ -30,6 +30,7 @@
 #include "server/pkgmgrinfo_internal.h"
 
 #define TEST_CERT_DB "test.pkgmgr_cert.db"
+#define DB_VERSION_FILE "./pkg_db_version.txt"
 
 namespace psd = pkgmgr_server::database;
 
@@ -86,12 +87,12 @@ class CertDBHandlerTest : public ::testing::Test {
     std::string journal_path(TEST_CERT_DB);
     journal_path += "-journal";
     ASSERT_EQ(remove(journal_path.c_str()), 0);
+    ASSERT_EQ(remove(DB_VERSION_FILE), 0);
   }
 
  private:
   void MakeVersionFile() {
-    std::remove("./pkg_db_version.txt");
-    std::ofstream ofs("./pkg_db_version.txt");
+    std::ofstream ofs(DB_VERSION_FILE);
     ofs << "30005";
   }
 
index 30545bd..9310113 100644 (file)
@@ -35,6 +35,7 @@
 #include "server/pkgmgrinfo_internal.h"
 
 #define TEST_PARSER_DB "test.pkgmgr_parser.db"
+#define DB_VERSION_FILE "./pkg_db_version.txt"
 
 namespace psd = pkgmgr_server::database;
 namespace pc = pkgmgr_common;
@@ -119,12 +120,12 @@ class ParserDBHandlerTest : public TestFixture {
     std::string journal_path(TEST_PARSER_DB);
     journal_path += "-journal";
     ASSERT_EQ(remove(journal_path.c_str()), 0);
+    ASSERT_EQ(remove(DB_VERSION_FILE), 0);
   }
 
  private:
   void MakeVersionFile() {
-    std::remove("./pkg_db_version.txt");
-    std::ofstream ofs("./pkg_db_version.txt");
+    std::ofstream ofs(DB_VERSION_FILE);
     ofs << "30005";
   }
 
index e081fab..ddeb14c 100644 (file)
@@ -33,6 +33,7 @@
 #include "server/pkgmgrinfo_internal.h"
 
 #define TEST_PARSER_DB "test.pkgmgr_parser.db"
+#define DB_VERSION_FILE "./pkg_db_version.txt"
 
 namespace psd = pkgmgr_server::database;
 namespace pc = pkgmgr_common;
@@ -99,12 +100,12 @@ class ParserDBHandlerTest : public TestFixture {
     std::string journal_path(TEST_PARSER_DB);
     journal_path += "-journal";
     ASSERT_EQ(remove(journal_path.c_str()), 0);
+    ASSERT_EQ(remove(DB_VERSION_FILE), 0);
   }
 
  private:
   void MakeVersionFile() {
-    std::remove("./pkg_db_version.txt");
-    std::ofstream ofs("./pkg_db_version.txt");
+    std::ofstream ofs(DB_VERSION_FILE);
     ofs << "30005";
   }