未验证 提交 9951551e 编写于 作者: O openharmony_ci 提交者: Gitee

!1078 修复单元测试

Merge pull request !1078 from cheng_jinsong/master_cc
...@@ -499,6 +499,7 @@ unsigned long GetMountFlags(char *mountFlag, char *fsSpecificData, size_t fsSpec ...@@ -499,6 +499,7 @@ unsigned long GetMountFlags(char *mountFlag, char *fsSpecificData, size_t fsSpec
int GetBlockDevicePath(const char *partName, char *path, size_t size) int GetBlockDevicePath(const char *partName, char *path, size_t size)
{ {
BEGET_CHECK_RETURN_VALUE(partName != NULL && path != NULL, -1);
Fstab *fstab = LoadFstabFromCommandLine(); Fstab *fstab = LoadFstabFromCommandLine();
if (fstab == NULL) { if (fstab == NULL) {
BEGET_LOGI("fstab not found from cmdline, try to get it from file"); BEGET_LOGI("fstab not found from cmdline, try to get it from file");
......
...@@ -56,8 +56,7 @@ HWTEST_F(MountUnitTest, TestGetBlockDevicePath, TestSize.Level1) ...@@ -56,8 +56,7 @@ HWTEST_F(MountUnitTest, TestGetBlockDevicePath, TestSize.Level1)
if (fd < 0) { if (fd < 0) {
return; return;
} }
GetBlockDevicePath(nullptr, nullptr, 0); GetBlockDevicePath("/test", path, sizeof(path));
GetBlockDevicePath(nullptr, path, sizeof(path));
close(fd); close(fd);
ReadConfig(); ReadConfig();
unlink("/bin/updater"); unlink("/bin/updater");
......
...@@ -139,16 +139,13 @@ public: ...@@ -139,16 +139,13 @@ public:
EXPECT_EQ(ret, 0); EXPECT_EQ(ret, 0);
ret = clientParamSercurityOps.securityFreeLabel(&srclabel); ret = clientParamSercurityOps.securityFreeLabel(&srclabel);
EXPECT_EQ(ret, 0); EXPECT_EQ(ret, 0);
int fd = open("/bin/updater", O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRWXU); uint8_t updataMode = GetParamWorkSpace()->ops.updaterMode;
if (fd < 0) { GetParamWorkSpace()->ops.updaterMode = 1; // 1 test updater mode
return 0;
}
RegisterSecuritySelinuxOps(&clientParamSercurityOps, 0); RegisterSecuritySelinuxOps(&clientParamSercurityOps, 0);
if (clientParamSercurityOps.securityCheckParamPermission != nullptr) { if (clientParamSercurityOps.securityCheckParamPermission != nullptr) {
clientParamSercurityOps.securityCheckParamPermission(nullptr, nullptr, 0); clientParamSercurityOps.securityCheckParamPermission(nullptr, nullptr, 0);
} }
close(fd); GetParamWorkSpace()->ops.updaterMode = updataMode;
unlink("/bin/updater");
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册