Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / NetBSD / sysctlgetmibinfo.cpp
blobd81c1567fc4492c83d152daff4151189a6f0b5df
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_sysctlgetmibinfo() {
13 int mib[CTL_MAXNAME];
14 unsigned int mib_len = __arraycount(mib);
15 int rv = sysctlgetmibinfo("kern.ostype", &mib[0], &mib_len, NULL, NULL, NULL,
16 SYSCTL_VERSION);
17 assert(!rv);
19 char buf[100];
20 size_t len = sizeof(buf);
21 rv = sysctl(mib, mib_len, buf, &len, NULL, 0);
22 assert(!rv);
24 printf("sysctlgetmibinfo: '%s' size: '%zu'\n", buf, len);
27 int main(void) {
28 printf("sysctlgetmibinfo\n");
30 test_sysctlgetmibinfo();
32 return 0;
34 // CHECK: sysctlgetmibinfo
35 // CHECK: sysctlgetmibinfo: '{{.*}}' size: '{{.*}}'