File tree Expand file tree Collapse file tree 2 files changed +2
-32
lines changed Expand file tree Collapse file tree 2 files changed +2
-32
lines changed Original file line number Diff line number Diff line change @@ -56,16 +56,9 @@ add_libc_unittest(
56
56
libc_time_unittests
57
57
SRCS
58
58
gettimeofday_test.cpp
59
- HDRS
60
- TmHelper.h
61
- TmMatcher.h
62
- CXX_STANDARD
63
- 20
64
59
DEPENDS
65
60
libc.include.time
66
61
libc.src.time.gettimeofday
67
- libc.src.time.nanosleep
68
- libc.src.errno.errno
69
62
)
70
63
71
64
add_libc_unittest (
Original file line number Diff line number Diff line change 9
9
#include < time.h>
10
10
11
11
#include " src/time/gettimeofday.h"
12
- #include " src/time/nanosleep.h"
13
- #include " test/UnitTest/ErrnoSetterMatcher.h"
14
12
#include " test/UnitTest/Test.h"
15
13
16
- namespace cpp = LIBC_NAMESPACE::cpp;
17
-
18
14
TEST (LlvmLibcGettimeofday, SmokeTest) {
19
- using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
20
- void *tz = nullptr ;
21
15
timeval tv;
22
-
23
- suseconds_t sleep_times[2 ] = {200 , 1000 };
24
- for (int i = 0 ; i < 2 ; i++) {
25
- int ret = LIBC_NAMESPACE::gettimeofday (&tv, tz);
26
- ASSERT_EQ (ret, 0 );
27
-
28
- suseconds_t sleep_time = sleep_times[i];
29
- // Sleep for {sleep_time} microsceconds.
30
- timespec tim = {0 , sleep_time * 1000 };
31
- timespec tim2 = {0 , 0 };
32
- ret = LIBC_NAMESPACE::nanosleep (&tim, &tim2);
33
-
34
- // Call gettimeofday again and verify that it is more {sleep_time}
35
- // microscecods.
36
- timeval tv1;
37
- ret = LIBC_NAMESPACE::gettimeofday (&tv1, tz);
38
- ASSERT_EQ (ret, 0 );
39
- ASSERT_GE (tv1.tv_usec - tv.tv_usec , sleep_time);
40
- }
16
+ int ret = LIBC_NAMESPACE::gettimeofday (&tv, nullptr );
17
+ ASSERT_EQ (ret, 0 );
41
18
}
You can’t perform that action at this time.
0 commit comments