1 #include <fcntl.h> 2 #include <gtest/gtest.h> 3 #include <stdlib.h> 4 #include <sys/auxv.h> 5 #include <sys/uio.h> 6 #include <unistd.h> 7 8 using namespace testing::ext; 9 10 class UnistdRmdirTest : public testing::Test { SetUp()11 void SetUp() override {} TearDown()12 void TearDown() override {} 13 }; 14 15 /** 16 * @tc.name: rmdir_001 17 * @tc.desc: Test that the function is functioning properly. 18 * @tc.type: FUNC 19 * */ 20 HWTEST_F(UnistdRmdirTest, rmdir_001, TestSize.Level1) 21 { 22 const char* path = "/data/testrmdir"; 23 if (access(path, F_OK) != 0) { 24 EXPECT_EQ(0, mkdir(path, 0777)); 25 EXPECT_EQ(0, rmdir(path)); 26 } else { 27 remove(path); 28 EXPECT_EQ(0, mkdir(path, 0777)); 29 EXPECT_EQ(0, rmdir(path)); 30 } 31 path = nullptr; 32 }