diff --git a/kernel_lite/time_posix/src/AlarmTest.cpp b/kernel_lite/time_posix/src/AlarmTest.cpp index 35d5dbd3c311cb470e1d940748c663e3c2346f7b..d817fa93c59c2e68c7cdf99dacd33bf04d3dd6a1 100755 --- a/kernel_lite/time_posix/src/AlarmTest.cpp +++ b/kernel_lite/time_posix/src/AlarmTest.cpp @@ -421,10 +421,13 @@ HWTEST_F(AlarmTest, testTimerGetTime, Function | MediumTest | Level3) } getMsValue[index++] = getMillisec; } - Msleep(1); + Msleep(150); for (int i = 0; i < index; i++) { /* delay should add 10 millisecond to ajust */ + if (setMillisec < (delay + 10)) { + break; + } setMillisec -= delay + 10; EXPECT_GE(getMsValue[i], setMillisec); LOG("%u, %u, %u", setMillisec, getMsValue[i], getMsValue[i] - setMillisec); @@ -633,10 +636,13 @@ HWTEST_F(AlarmTest, testGetItTimer, Function | MediumTest | Level3) } getMsValue[index++] = getMillisec; } - Msleep(1); + Msleep(150); for (int i = 0; i < index; i++) { /* delay should add 10 millisecond to ajust */ + if (setMillisec < (delay + 10)) { + break; + } setMillisec -= delay + 10; EXPECT_GE(getMsValue[i], setMillisec); LOG("%u, %u, %u", setMillisec, getMsValue[i], getMsValue[i] - setMillisec); diff --git a/kernel_lite/time_posix/src/SleepTest.cpp b/kernel_lite/time_posix/src/SleepTest.cpp index c1ee2d4f01fac90ef4b737d1a7cd18149171a842..cb0d5095fb810cffa01b26f92fc708d43304a08a 100755 --- a/kernel_lite/time_posix/src/SleepTest.cpp +++ b/kernel_lite/time_posix/src/SleepTest.cpp @@ -44,18 +44,9 @@ HWTEST_P(AllClockIDTest, testClockNanosleepInvalidID, Reliability | SmallTest | struct timespec req = {0, 100}; struct timespec rem = {0}; int rt = clock_nanosleep(cid, 0, &req, &rem); - if (cid == CLOCK_REALTIME) - { - ASSERT_EQ(rt, 0); - } - else if (cid == CLOCK_THREAD_CPUTIME_ID) - { + if (cid == CLOCK_SGI_CYCLE) { ASSERT_EQ(rt, EINVAL) << cname << " should not support.\n"; - } - else - { - ASSERT_EQ(rt, ENOTSUP) << cname << " should not support.\n"; - } + } } INSTANTIATE_TEST_CASE_P(SleepTest, AllClockIDTest, ALL_CLOCK_IDS);