1// RUN: %clangxx -O0 %s -o %t && %run %t m1 2>&1 | FileCheck %s
2
3#include <limits.h>
4#include <stdio.h>
5#include <stdlib.h>
6
7char buff[1 << 12];
8int main(int argc, char *argv[]) {
9 printf(format: "REALPATH %s\n", realpath(name: argv[0], resolved: buff));
10 // CHECK: REALPATH /{{.+}}/realpath.cpp
11
12 char *buff2 = realpath(name: argv[0], resolved: nullptr);
13 printf(format: "REALPATH %s\n", buff2);
14 // CHECK: REALPATH /{{.+}}/realpath.cpp
15 free(ptr: buff2);
16
17 buff2 = realpath(name: ".", resolved: nullptr);
18 printf(format: "REALPATH %s\n", buff2);
19 // CHECK: REALPATH /{{.+}}
20 free(ptr: buff2);
21}
22

source code of compiler-rt/test/sanitizer_common/TestCases/Posix/realpath.cpp