]> git.saurik.com Git - apple/xnu.git/blame - tests/remote_time.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tests / remote_time.c
CommitLineData
d26ffc64
A
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>
cb323159
A
7
8T_GLOBAL_META(T_META_RUN_CONCURRENTLY(true));
9
d26ffc64
A
10extern uint64_t __mach_bridge_remote_time(uint64_t);
11
12T_DECL(remote_time_syscall, "test mach_bridge_remote_time syscall",
0a7de745 13 T_META_CHECK_LEAKS(false))
d26ffc64
A
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",
0a7de745 20 local_time, remote_time1, remote_time2);
d26ffc64
A
21 T_ASSERT_EQ(remote_time1, remote_time2, "syscall works");
22#else
23 T_SKIP("Skipping test");
24#endif /* TARGET_OS_BRIDGE */
25}