1 #include <fcntl.h> 2 #include <gtest/gtest.h> 3 #include <sys/statfs.h> 4 5 using namespace testing::ext; 6 7 class StatFstatfs64Test : public testing::Test { SetUp()8 void SetUp() override {} TearDown()9 void TearDown() override {} 10 }; 11 12 /** 13 * @tc.name: fstatfs64_001 14 * @tc.desc: This test verifies whether the file system information was successfully obtained and the result was 0 when 15 * opening the/proc directory and calling the fstatfs64 function. 16 * @tc.type: FUNC 17 */ 18 HWTEST_F(StatFstatfs64Test, fstatfs64_001, TestSize.Level1) 19 { 20 int fileDescriptor = open("/proc", O_RDONLY); 21 EXPECT_TRUE(fileDescriptor >= 0); 22 struct statfs64 stat; 23 int result = fstatfs64(fileDescriptor, &stat); 24 EXPECT_EQ(0, result); 25 close(fileDescriptor); 26 }