Fix unit test crash 19/239019/1
authorhyunho <hhstark.kang@samsung.com>
Tue, 21 Jul 2020 05:56:50 +0000 (14:56 +0900)
committerhyunho <hhstark.kang@samsung.com>
Tue, 21 Jul 2020 05:56:50 +0000 (14:56 +0900)
- 64bit unittest crashed by SEGFAULT

Change-Id: Ie99694e0a11d258be55d34fd62ff39f95f226f39
Signed-off-by: hyunho <hhstark.kang@samsung.com>
unittest/mock/mock.cc
unittest/mock/pkgmgr_info_mock.h
unittest/src/test_widget_service.cc

index c100a99..8b5ccba 100644 (file)
@@ -70,4 +70,6 @@ DEFINE_FAKE_VALUE_FUNC(int, pkgmgrinfo_pkginfo_get_usr_pkginfo,
     const char *, uid_t, pkgmgrinfo_pkginfo_h *);
 DEFINE_FAKE_VALUE_FUNC(int, pkgmgrinfo_pkginfo_get_mainappid,
     pkgmgrinfo_pkginfo_h, char **);
+DEFINE_FAKE_VALUE_FUNC(int, pkgmgrinfo_pkginfo_destroy_pkginfo,
+    pkgmgrinfo_pkginfo_h);
 
index 5057e2a..5051246 100644 (file)
@@ -36,6 +36,8 @@ DECLARE_FAKE_VALUE_FUNC(int, pkgmgrinfo_pkginfo_get_usr_pkginfo,
        const char *, uid_t, pkgmgrinfo_pkginfo_h *);
 DECLARE_FAKE_VALUE_FUNC(int, pkgmgrinfo_pkginfo_get_mainappid,
        pkgmgrinfo_pkginfo_h, char **);
+DECLARE_FAKE_VALUE_FUNC(int, pkgmgrinfo_pkginfo_destroy_pkginfo,
+       pkgmgrinfo_pkginfo_h);
 
 #ifdef __cplusplus
 }
index f8e28cc..dfa5b46 100644 (file)
@@ -150,6 +150,10 @@ int __fake_pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **
   return PMINFO_R_OK;
 }
 
+int __fake_pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle) {
+  return PMINFO_R_OK;
+}
+
 class WidgetServiceTest : public ::testing::Test {
   public:
     virtual void SetUp() {
@@ -172,6 +176,7 @@ class WidgetServiceTest : public ::testing::Test {
       getuid_fake.custom_fake = __fake_getuid;
       pkgmgrinfo_pkginfo_get_usr_pkginfo_fake.custom_fake = __fake_pkgmgrinfo_pkginfo_get_usr_pkginfo;
       pkgmgrinfo_pkginfo_get_mainappid_fake.custom_fake = __fake_pkgmgrinfo_pkginfo_get_mainappid;
+      pkgmgrinfo_pkginfo_destroy_pkginfo_fake.custom_fake = __fake_pkgmgrinfo_pkginfo_destroy_pkginfo;
     }
     virtual void TearDown() {
     }