1 #include <errno.h> 2 #include <gtest/gtest.h> 3 #include <sys/mount.h> 4 using namespace testing::ext; 5 6 class LinuxUmount2Test : public testing::Test { SetUp()7 void SetUp() override {} TearDown()8 void TearDown() override {} 9 }; 10 11 /** 12 * @tc.name: umount2_001 13 * @tc.desc: Validate the behavior of the umount2() function under specific conditions, including error handling 14 * and the functionality of forced unmounting. 15 * @tc.type: FUNC 16 **/ 17 HWTEST_F(LinuxUmount2Test, umount2_001, TestSize.Level1) 18 { 19 const char* target = nullptr; 20 errno = 0; 21 int result = umount2(target, MNT_FORCE); 22 EXPECT_EQ(-1, result); 23 EXPECT_EQ(EFAULT, errno); 24 }