diff --git a/test/unittest/control_fd/control_fd_unittest.c b/test/unittest/control_fd/control_fd_unittest.c deleted file mode 100644 index 308ed57cd..000000000 --- a/test/unittest/control_fd/control_fd_unittest.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include "control_fd.h" -#include "securec.h" - -using namespace std; -using namespace testing::ext; - -namespace init_ut { -class ControlfdUnitTest : public testing::Test { -public: - static void SetUpTestCase(void) {}; - static void TearDownTestCase(void) {}; - void SetUp(void) {}; - void TearDown(void) {}; -}; - -HWTEST_F(ControlfdUnitTest, Init_CmdServiceInit_001, TestSize.Level0) -{ - char *socketPath = "dev/test"; - CallbackControlFdProcess callback; - LoopHandle loopHandle; - CmdServiceInit(socketPath, callback, loopHandle); -} - -HWTEST_F(ControlfdUnitTest, Init_CmdClientInit_001, TestSize.Level1) -{ - char *socketPath = "dev/test"; - CallbackControlFdProcess callback; - uint16_t type = 0; - const char *cmd; - CmdClientInit(socketPath, type, cmd, callback); -} - -HWTEST_F(ControlfdUnitTest, Init_CmdServiceProcessDelClient_001, TestSize.Level1) -{ - pid_t pid = 0; - CmdServiceProcessDelClient(pid); -} - -HWTEST_F(ControlfdUnitTest, Init_CmdServiceProcessDestroyClient_001, TestSize.Level1) -{ - CmdServiceProcessDestroyClient(); -} - -HWTEST_F(ControlfdUnitTest, Init_InitPtyInterface_001, TestSize.Level1) -{ - CmdAgent *agent; - uint16_t type; - const char *cmd; - CallbackSendMsgProcess callback; - int ret = InitPtyInterface(agent, type, cmd, callback); - EXPECT_EQ(ret, 0); -} -} // namespace init_ut \ No newline at end of file diff --git a/test/unittest/fd_holder/fs_holder_unittest.c b/test/unittest/fd_holder/fs_holder_unittest.c deleted file mode 100644 index bafca1b9f..000000000 --- a/test/unittest/fd_holder/fs_holder_unittest.c +++ /dev/null @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2024 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "fd_holder_internal.h" -#include "securec.h" - -using namespace std; -using namespace testing::ext; - -namespace init_ut { -class Fd_HolderUnitTest : public testing::Test { -public: - static void SetUpTestCase(void) {}; - static void TearDownTestCase(void) {}; - void SetUp(void) {}; - void TearDown(void) {}; -}; - -HWTEST_F(Fd_HolderUnitTest, Init_BuildControlMessage_001, TestSize.Level0) -{ - struct msghdr *msghdr; - int *fds; - int fdCount = 0; - bool sendUcred = true; - int ret = BuildControlMessage(msghdr, fds, fdCount, sendUcred); - EXPECT_EQ(ret, 0); -} - -HWTEST_F(Fd_HolderUnitTest, Init_BuildControlMessage_001, TestSize.Level0) -{ - int sock; - struct iovec iovec; - size_t *outFdCount; - bool nonblock; - pid_t *requestPid; - ReceiveFds(sock, iovec iovec, outFdCount, nonblock, requestPid); -} -} \ No newline at end of file diff --git a/test/unittest/fs_manager/erofs_common_unittest.c b/test/unittest/fs_manager/erofs_common_unittest.c deleted file mode 100644 index f22ad7aa1..000000000 --- a/test/unittest/fs_manager/erofs_common_unittest.c +++ /dev/null @@ -1,51 +0,0 @@ -/* -* Copyright (c) 2024 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "erofs_overlay_common.h" -#include "securec.h" - -using namespace std; -using namespace testing::ext; - -namespace init_ut { -class ErofsOverlayUnitTest : public testing::Test { -public: - static void SetUpTestCase(void) {}; - static void TearDownTestCase(void) {}; - void SetUp(void) {}; - void TearDown(void) {}; -}; - -HWTEST_F(ErofsOverlayUnitTest, Init_IsOverlayEnable_001, TestSize.Level0) -{ - bool ret = IsOverlayEnable(); - EXPECT_EQ(ret, true); -} - -HWTEST_F(ErofsOverlayUnitTest, Init_CheckIsExt4_001, TestSize.Level0) -{ - const char *dev; - uint64_t offset; - bool ret = CheckIsExt4(dev, offset); - EXPECT_EQ(ret, true); -} - -HWTEST_F(ErofsOverlayUnitTest, Init_CheckIsErofs_001, TestSize.Level0) -{ - const char *dev; - bool ret = CheckIsErofs(dev); - EXPECT_EQ(ret, true); -} -} \ No newline at end of file diff --git a/test/unittest/fs_manager/erofs_mount_unittest.c b/test/unittest/fs_manager/erofs_mount_unittest.c deleted file mode 100644 index 101f0b6a9..000000000 --- a/test/unittest/fs_manager/erofs_mount_unittest.c +++ /dev/null @@ -1,46 +0,0 @@ -/* -* Copyright (c) 2024 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "erofs_mount_overlay.h" -#include "securec.h" - -using namespace std; -using namespace testing::ext; - -namespace init_ut { -class ErofsMountUnitTest : public testing::Test { -public: - static void SetUpTestCase(void) {}; - static void TearDownTestCase(void) {}; - void SetUp(void) {}; - void TearDown(void) {}; -}; - -HWTEST_F(ErofsMountUnitTest, Init_DoMountOverlayDevice_001, TestSize.Level0) -{ - FstabItem *item; - int ret = DoMountOverlayDevice(item); - EXPECT_EQ(ret, 0); -} - -HWTEST_F(ErofsMountUnitTest, Init_MountExt4Device_001, TestSize.Level0) -{ - const char *dev; - const char *mnt; - bool isFirstMount = true; - int ret = MountExt4Device(dev, mnt, isFirstMount); - EXPECT_EQ(ret, 0); -} -} \ No newline at end of file diff --git a/test/unittest/fs_manager/erofs_remount_unittest.c b/test/unittest/fs_manager/erofs_remount_unittest.c deleted file mode 100644 index c5e2d1757..000000000 --- a/test/unittest/fs_manager/erofs_remount_unittest.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2024 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "erofs_overlay_common.h" -#include "securec.h" - -using namespace std; -using namespace testing::ext; - -namespace init_ut { -class ErofsRemountUnitTest : public testing::Test { -public: - static void SetUpTestCase(void) {}; - static void TearDownTestCase(void) {}; - void SetUp(void) {}; - void TearDown(void) {}; -}; - -HWTEST_F(ErofsRemountUnitTest, Init_GetRemountResult_001, TestSize.Level0) -{ - int ret = GetRemountResult(); - EXPECT_EQ(ret, true); -} - -HWTEST_F(ErofsRemountUnitTest, Init_CheckIsExt4_001, TestSize.Level0) -{ - bool result = true; - SetRemountResultFlag(result); -} - -HWTEST_F(ErofsRemountUnitTest, Init_RemountOverlay_001, TestSize.Level0) -{ - int ret = RemountOverlay(); - EXPECT_EQ(ret, true); -} - -HWTEST_F(ErofsRemountUnitTest, Init_MountOverlayOne_001, TestSize.Level0) -{ - const char *mnt; - int ret = MountOverlayOne(mnt); - EXPECT_EQ(ret, true); -} - -HWTEST_F(ErofsRemountUnitTest, Init_OverlayRemountVendorPre_001, TestSize.Level0) -{ - OverlayRemountVendorPre(); -} - -HWTEST_F(ErofsRemountUnitTest, Init_OverlayRemountVendorPost_001, TestSize.Level0) -{ - OverlayRemountVendorPost(); -} -} \ No newline at end of file diff --git a/test/unittest/fs_manager/libfs_dm_unittest.c b/test/unittest/fs_manager/libfs_dm_unittest.c deleted file mode 100644 index fbeeb5fbb..000000000 --- a/test/unittest/fs_manager/libfs_dm_unittest.c +++ /dev/null @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2024 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "fs_dm.h" -#include "securec.h" - -using namespace std; -using namespace testing::ext; - -namespace init_ut { -class FsDmUnitTest : public testing::Test { -public: - static void SetUpTestCase(void) {}; - static void TearDownTestCase(void) {}; - void SetUp(void) {}; - void TearDown(void) {}; -}; - -HWTEST_F(FsDmUnitTest, Init_FsDmInitDmDev_001, TestSize.Level0) -{ - char *devPath = "test"; - bool useSocket = true; - int ret = FsDmInitDmDev(devPath, useSocket); - EXPECT_EQ(ret, 0); -} - -HWTEST_F(FsDmUnitTest, Init_FsDmCreateDevice_001, TestSize.Level0) -{ - char **dmDevPath = "test"; - const char *devName = "test"; - DmVerityTarget *target; - int ret = FsDmCreateDevice(dmDevPath, devName, target); - EXPECT_EQ(ret, 0); -} - -HWTEST_F(FsDmUnitTest, Init_FsDmRemoveDevice_001, TestSize.Level0) -{ - const char *devName = "test"; - int ret = FsDmRemoveDevice(devName); - EXPECT_EQ(ret, 0); -} - -HWTEST_F(FsDmUnitTest, Init_FsDmCreateLinearDevice_001, TestSize.Level0) -{ - const char *devName = "test"; - char *dmBlkName = "test"; - uint64_t dmBlkNameLen = 0; - DmVerityTarget *target; - int ret = FsDmCreateLinearDevice(devName, dmBlkName, dmBlkNameLen, target); - EXPECT_EQ(ret, 0); -} -} \ No newline at end of file diff --git a/test/unittest/hook/hook_unittest.c b/test/unittest/hook/hook_unittest.c deleted file mode 100644 index 5c1d8bb4e..000000000 --- a/test/unittest/hook/hook_unittest.c +++ /dev/null @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2024 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include "fs_hvb.h" -#include "securec.h" - -using namespace std; -using namespace testing::ext; - -namespace init_ut { -class HookUnitTest : public testing::Test { -public: - static void SetUpTestCase(void) {}; - static void TearDownTestCase(void) {}; - void SetUp(void) {}; - void TearDown(void) {}; -}; - -HWTEST_F(HookUnitTest, Init_HookMgrAdd_001, TestSize.Level0) -{ - HOOK_MGR *hookMgr; - int stage = 0; - int prio = 0; - OhosHook hook; - int ret = HookMgrAdd(hookMgr, stage, prio, hook); - EXPECT_EQ(ret, 0); -} - -HWTEST_F(HookUnitTest, Init_HookMgrAddEx_001, TestSize.Level0) -{ - HOOK_MGR *hookMgr; - const HOOK_INFO *hookInfo; - int ret = HookMgrAddEx(hookMgr, hookInfo); - EXPECT_EQ(ret, 0); -} - -HWTEST_F(HookUnitTest, Init_HookMgrDel_001, TestSize.Level0) -{ - HOOK_MGR *hookMgr; - int stage; - OhosHook hook; - HookMgrDel(hookMgr, stage, hook); -} - -HWTEST_F(HookUnitTest, Init_HookMgrExecute_001, TestSize.Level0) -{ - HOOK_MGR *hookMgr; - int stage; - void *executionContext; - const HOOK_EXEC_OPTIONS *extraArgs; - int ret = HookMgrExecute(hookMgr, stage, executionContext, extraArgs); - EXPECT_EQ(ret, 0); -} - -HWTEST_F(HookUnitTest, Init_HookMgrTraversal_001, TestSize.Level0) -{ - HOOK_MGR *hookMgr; - void *traversalCookie; - OhosHookTraversal traversal; - HookMgrTraversal(HOOK_MGR *hookMgr, void *traversalCookie, OhosHookTraversal traversal); -} -} \ No newline at end of file