[compiler-rt] ea57559 - [sanitizers] Basic realpath test

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 14:32:27 PDT 2021


Author: Vitaly Buka
Date: 2021-08-25T14:32:15-07:00
New Revision: ea575598f5b6c6c0c83ed131bd8ac3316ee32f41

URL: https://github.com/llvm/llvm-project/commit/ea575598f5b6c6c0c83ed131bd8ac3316ee32f41
DIFF: https://github.com/llvm/llvm-project/commit/ea575598f5b6c6c0c83ed131bd8ac3316ee32f41.diff

LOG: [sanitizers] Basic realpath test

Added: 
    compiler-rt/test/sanitizer_common/TestCases/Posix/realpath.cpp

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/realpath.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/realpath.cpp
new file mode 100644
index 000000000000..76b428bccfdf
--- /dev/null
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/realpath.cpp
@@ -0,0 +1,21 @@
+// RUN: %clangxx -O0 %s -o %t && %run %t m1 2>&1 | FileCheck %s
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+char buff[1 << 12];
+int main(int argc, char *argv[]) {
+  printf("REALPATH %s\n", realpath(argv[0], buff));
+  // CHECK: REALPATH /{{.+}}/realpath.cpp
+
+  char *buff2 = realpath(argv[0], nullptr);
+  printf("REALPATH %s\n", buff2);
+  // CHECK: REALPATH /{{.+}}/realpath.cpp
+  free(buff2);
+
+  buff2 = realpath(".", nullptr);
+  printf("REALPATH %s\n", buff2);
+  // CHECK: REALPATH /{{.+}}
+  free(buff2);
+}
\ No newline at end of file


        


More information about the llvm-commits mailing list