mirror of
https://gitee.com/openharmony/startup_init
synced 2024-12-12 21:28:49 +00:00
unittest
Signed-off-by: chengjinsong <chengjinsong2@huawei.com> Change-Id: I7636f5820a960b7b97f94edd84c0306f6cb7c2a4
This commit is contained in:
parent
a856c2c15a
commit
3c0cf37118
@ -47,7 +47,7 @@ HWTEST_F(MountUnitTest, TestMountRequriedPartitions, TestSize.Level0)
|
||||
int ret = MountRequriedPartitions(&fstab1);
|
||||
EXPECT_EQ(ret, -1);
|
||||
}
|
||||
LoadRequiredFstab();
|
||||
ReleaseFstab(LoadRequiredFstab());
|
||||
}
|
||||
HWTEST_F(MountUnitTest, TestGetBlockDevicePath, TestSize.Level1)
|
||||
{
|
||||
|
@ -136,4 +136,15 @@ HWTEST_F(InnerkitsUnitTest, GetBlockDevicePath_unittest, TestSize.Level1)
|
||||
EXPECT_EQ(GetBlockDevicePath("/misc", devicePath, MAX_BUFFER_LEN), 0);
|
||||
EXPECT_EQ(GetBlockDevicePath("/invalid", devicePath, MAX_BUFFER_LEN), -1);
|
||||
}
|
||||
|
||||
HWTEST_F(InnerkitsUnitTest, DoFormat_unittest, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(DoFormat("/testpath", "ext4"), 1);
|
||||
EXPECT_NE(DoFormat("/testpath", "f2fs"), 1);
|
||||
}
|
||||
|
||||
HWTEST_F(InnerkitsUnitTest, MountAllWithFstabFile_unittest, TestSize.Level1)
|
||||
{
|
||||
EXPECT_NE(MountAllWithFstabFile("/etc/fstab.required", 0), 1);
|
||||
}
|
||||
} // namespace init_ut
|
||||
|
@ -205,9 +205,16 @@ static void PrepareInnerKitsCfg()
|
||||
"aa aa\n"
|
||||
"aa aa aa\n"
|
||||
"aa aa aa aa\n";
|
||||
const char *fstabRequired = "# fstab file.\n"
|
||||
"#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>\n"
|
||||
"/dev/block/platform/fe310000.sdhci/by-name/testsystem /usr ext4 ro,barrier=1 wait,required\n"
|
||||
"/dev/block/platform/fe310000.sdhci/by-name/testvendor /vendor ext4 ro,barrier=1 wait,required\n"
|
||||
"/dev/block/platform/fe310000.sdhci/by-name/testuserdata1 /data f2fs noatime,nosuid,nodev wait,check,quota\n"
|
||||
"/dev/block/platform/fe310000.sdhci/by-name/testuserdata2 /data ext4 noatime,fscrypt=xxx wait,check,quota\n"
|
||||
"/dev/block/platform/fe310000.sdhci/by-name/testmisc /misc none none wait,required";
|
||||
mkdir("/data/init_ut/mount_unitest/", S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
CreateTestFile("/data/init_ut/mount_unitest/ReadFstabFromFile1.fstable", innerKitsCfg);
|
||||
CreateTestFile("/etc/fstab.required", "test");
|
||||
CreateTestFile("/etc/fstab.required", fstabRequired);
|
||||
}
|
||||
static void PrepareGroupTestCfg()
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ fi
|
||||
echo "Filter out don\'t cared dir"
|
||||
lcov --remove init_ut_tmp.info "*foundation*" "*init/adapter/init_adapter.c*" "*third_party*" \
|
||||
"*device.c*" "*prebuilts*" "*test/unittest/*" "*utils/native/*" "*utils/system/*" \
|
||||
"*init.c*" "*init_signal_handler.c*" "*fstab_mount.c*" "*ueventd.c*" \
|
||||
"*init.c*" "*init_signal_handler.c*" "*ueventd.c*" \
|
||||
"*ueventd_device_handler.c*" "*ueventd_firmware_handler.c*" "*ueventd_socket.c*" -o ${ohos_init}/init_ut.info
|
||||
|
||||
genhtml -o ${HOME}/init_coverage init_ut.info
|
||||
|
Loading…
Reference in New Issue
Block a user