]> git.saurik.com Git - apple/xnu.git/blob - tests/remote_time.c
xnu-4903.241.1.tar.gz
[apple/xnu.git] / tests / remote_time.c
1 #include <darwintest.h>
2 #include <System/kern/remote_time.h>
3 #include <mach/mach_time.h>
4 #include <stdint.h>
5 #include <sys/sysctl.h>
6 #include <TargetConditionals.h>
7 extern uint64_t __mach_bridge_remote_time(uint64_t);
8
9 T_DECL(remote_time_syscall, "test mach_bridge_remote_time syscall",
10 T_META_CHECK_LEAKS(false))
11 {
12 #if TARGET_OS_BRIDGE
13 uint64_t local_time = mach_absolute_time();
14 uint64_t remote_time1 = mach_bridge_remote_time(local_time);
15 uint64_t remote_time2 = __mach_bridge_remote_time(local_time);
16 T_LOG("local_time = %llu, remote_time1 = %llu, remote_time2 = %llu",
17 local_time, remote_time1, remote_time2);
18 T_ASSERT_EQ(remote_time1, remote_time2, "syscall works");
19 #else
20 T_SKIP("Skipping test");
21 #endif /* TARGET_OS_BRIDGE */
22 }