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