Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / FreeBSD / fdevname.cpp
blob252335e9afb4d647be1916fa232ff81c98fc6aa5
1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
3 #include <assert.h>
4 #include <fcntl.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <unistd.h>
8 #include <sys/stat.h>
10 void test_fdevname() {
11 int fd = open("/dev/null", O_RDONLY);
12 char *name;
14 printf("test_fdevname\n");
15 assert(fd != -1);
16 assert((name = fdevname(fd)));
17 close(fd);
19 printf("%s\n", name);
22 void test_fdevname_r() {
23 int fd = open("/dev/null", O_RDONLY);
24 char *name;
25 char buf[5];
27 printf("test_fdevname_r\n");
28 assert(fd != -1);
29 assert((name = fdevname_r(fd, buf, sizeof(buf))));
30 close(fd);
32 printf("%s\n", name);
35 int main(void) {
36 test_fdevname();
37 test_fdevname_r();
38 // CHECK: test_fdevname
39 // CHECK: null
40 // CHECK: test_fdevname_r
41 // CHECK: null
43 return 0;