1 #include <gtest/gtest.h> 2 #include <sys/timerfd.h> 3 4 using namespace testing::ext; 5 6 class LinuxTimerfdcreateTest : public testing::Test { SetUp()7 void SetUp() override {} TearDown()8 void TearDown() override {} 9 }; 10 11 /** 12 * @tc.name: timerfd_create_001 13 * @tc.desc: This test verifies timerfd the create function is using CLOCK During MONOTONIC, the timer file descriptor 14 * can be successfully created and correctly closed. If the creation fails, the corresponding error message 15 * will be output. 16 * @tc.type: FUNC 17 */ 18 HWTEST_F(LinuxTimerfdcreateTest, timerfd_create_001, TestSize.Level1) 19 { 20 int timerfd = timerfd_create(CLOCK_MONOTONIC, 0); 21 EXPECT_GE(timerfd, 0); 22 close(timerfd); 23 }