]> git.saurik.com Git - apple/xnu.git/blame_incremental - tests/test_utils.c
xnu-7195.101.1.tar.gz
[apple/xnu.git] / tests / test_utils.c
... / ...
CommitLineData
1#include <sys/kern_sysctl.h>
2#include <sys/sysctl.h>
3#include <dispatch/dispatch.h>
4#include <darwintest.h>
5
6#include "test_utils.h"
7
8bool
9is_development_kernel()
10{
11 static dispatch_once_t is_development_once;
12 static bool is_development;
13
14 dispatch_once(&is_development_once, ^{
15 int dev;
16 size_t dev_size = sizeof(dev);
17
18 T_QUIET;
19 T_ASSERT_POSIX_SUCCESS(sysctlbyname("kern.development", &dev,
20 &dev_size, NULL, 0), NULL);
21 is_development = (dev != 0);
22 });
23
24 return is_development;
25}