]> git.saurik.com Git - apple/xnu.git/blob - tests/remote_time.c
xnu-7195.101.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
8 T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true));
9
10 extern uint64_t __mach_bridge_remote_time(uint64_t);
11
12 T_DECL(remote_time_syscall, "test mach_bridge_remote_time syscall",
13 T_META_CHECK_LEAKS(false))
14 {
15 #if TARGET_OS_BRIDGE
16 uint64_t local_time = mach_absolute_time();
17 uint64_t remote_time1 = mach_bridge_remote_time(local_time);
18 uint64_t remote_time2 = __mach_bridge_remote_time(local_time);
19 T_LOG("local_time = %llu, remote_time1 = %llu, remote_time2 = %llu",
20 local_time, remote_time1, remote_time2);
21 T_ASSERT_EQ(remote_time1, remote_time2, "syscall works");
22 #else
23 T_SKIP("Skipping test");
24 #endif /* TARGET_OS_BRIDGE */
25 }