Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / NetBSD / asysctl.cpp
blobacdfb17f28b55ca197b96096dda6ea1d01b08ade
1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
3 #include <sys/param.h>
4 #include <sys/types.h>
6 #include <sys/sysctl.h>
8 #include <assert.h>
9 #include <stdio.h>
10 #include <stdlib.h>
12 void test_asysctl() {
13 int mib[] = {CTL_KERN, KERN_OSTYPE};
14 size_t len;
15 char *buf = (char *)asysctl(mib, __arraycount(mib), &len);
16 assert(buf);
18 printf("asysctl: '%s' size: '%zu'\n", buf, len);
20 free(buf);
23 void test_asysctlbyname() {
24 size_t len;
25 char *buf = (char *)asysctlbyname("kern.ostype", &len);
26 assert(buf);
28 printf("asysctlbyname: '%s' size: '%zu'\n", buf, len);
30 free(buf);
33 int main(void) {
34 printf("asysctl\n");
36 test_asysctl();
37 test_asysctlbyname();
39 return 0;
41 // CHECK: asysctl
42 // CHECK: asysctl: '{{.*}}' size: '{{.*}}'
43 // CHECK: asysctlbyname: '{{.*}}' size: '{{.*}}'