]>
git.saurik.com Git - apple/xnu.git/blob - tests/sysctl_hw.c
1 #include <darwintest.h>
2 #include <sys/sysctl.h>
4 T_DECL(sysctl_hw_cpu
, "ensure vital product and CPU-related sysctls exist")
7 size_t buffer_size
= sizeof(buffer
);
11 int ret
= sysctlbyname("hw.target", buffer
,
12 &buffer_size
, NULL
, 0);
13 T_ASSERT_POSIX_SUCCESS(ret
, "hw.target sysctl");
14 T_LOG("hw.target = %s", buffer
);
16 buffer_size
= sizeof(buffer
);
18 ret
= sysctlbyname("hw.product", buffer
,
19 &buffer_size
, NULL
, 0);
20 T_ASSERT_POSIX_SUCCESS(ret
, "hw.product sysctl");
21 T_LOG("hw.product = %s", buffer
);
23 buffer_size
= sizeof(buffer
);
25 ret
= sysctlbyname("machdep.cpu.brand_string", buffer
,
26 &buffer_size
, NULL
, 0);
28 T_ASSERT_POSIX_SUCCESS(ret
, "machdep.cpu.brand_string sysctl");
29 T_LOG("machdep.cpu.brand_string = %s", buffer
);
33 ret
= sysctlbyname("hw.cpu64bit_capable", &v
, &v_size
, NULL
, 0);
34 T_ASSERT_POSIX_SUCCESS(ret
, "hw.cpu64bit_capable");
37 T_EXPECT_EQ(v
, 0, "cpu is not 64 bit capable");
39 T_EXPECT_EQ(v
, 1, "cpu is 64 bit capable");