summaryrefslogtreecommitdiff
path: root/test/sanitizer_common
diff options
context:
space:
mode:
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r--test/sanitizer_common/TestCases/Linux/mmap64_test.c13
-rw-r--r--test/sanitizer_common/TestCases/Posix/mmap_test.c11
2 files changed, 24 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/Linux/mmap64_test.c b/test/sanitizer_common/TestCases/Linux/mmap64_test.c
new file mode 100644
index 000000000..f4c009d84
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Linux/mmap64_test.c
@@ -0,0 +1,13 @@
+// RUN: %clang %s -o %t && %run %t
+
+#define _LARGEFILE64_SOURCE 1
+
+#include <assert.h>
+#include <sys/mman.h>
+
+int main() {
+ char *buf = (char *)mmap64(0, 100000, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ assert(buf);
+ munmap(buf, 100000);
+}
diff --git a/test/sanitizer_common/TestCases/Posix/mmap_test.c b/test/sanitizer_common/TestCases/Posix/mmap_test.c
new file mode 100644
index 000000000..3c272f95a
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Posix/mmap_test.c
@@ -0,0 +1,11 @@
+// RUN: %clang %s -o %t && %run %t
+
+#include <assert.h>
+#include <sys/mman.h>
+
+int main() {
+ char *buf = (char *)mmap(0, 100000, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ assert(buf);
+ munmap(buf, 100000);
+}