summaryrefslogtreecommitdiffstats
path: root/libc/src/sys/mman
diff options
context:
space:
mode:
authorSiva Chandra Reddy <sivachandra@google.com>2020-01-03 12:00:45 -0800
committerSiva Chandra Reddy <sivachandra@google.com>2020-01-06 10:14:43 -0800
commit5b24c088171d3bd7a8ff559c82926e5d4b04f032 (patch)
tree54ac5d666fef87a0e6337e388f6f5087c18e9ef9 /libc/src/sys/mman
parent0239526cccf8aa708e29eeb7e49de8f6dc6c1a5f (diff)
downloadbcm5719-llvm-5b24c088171d3bd7a8ff559c82926e5d4b04f032.tar.gz
bcm5719-llvm-5b24c088171d3bd7a8ff559c82926e5d4b04f032.zip
[libc] Move all tests to a top level `test` directory.
A toplevel target, `check-libc` has also been added. Reviewers: abrachet, phosek Tags: #libc-project Differential Revision: https://reviews.llvm.org/D72177
Diffstat (limited to 'libc/src/sys/mman')
-rw-r--r--libc/src/sys/mman/CMakeLists.txt14
-rw-r--r--libc/src/sys/mman/mmap_test.cpp48
2 files changed, 0 insertions, 62 deletions
diff --git a/libc/src/sys/mman/CMakeLists.txt b/libc/src/sys/mman/CMakeLists.txt
index f2d98a45518..9b8cc66299a 100644
--- a/libc/src/sys/mman/CMakeLists.txt
+++ b/libc/src/sys/mman/CMakeLists.txt
@@ -25,17 +25,3 @@ add_entrypoint_object(
syscall_impl_h
__errno_location
)
-
-add_custom_target(libc_sys_mman_unittests)
-
-add_libc_unittest(
- mmap_test
- SUITE
- libc_sys_mman_unittests
- SRCS
- mmap_test.cpp
- DEPENDS
- mmap
- munmap
- __errno_location
-)
diff --git a/libc/src/sys/mman/mmap_test.cpp b/libc/src/sys/mman/mmap_test.cpp
deleted file mode 100644
index ab2e6ceb4a9..00000000000
--- a/libc/src/sys/mman/mmap_test.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-//===------------------ Unittests for mmap and munmap ---------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "src/errno/llvmlibc_errno.h"
-#include "src/sys/mman/mmap.h"
-#include "src/sys/mman/munmap.h"
-
-#include "gtest/gtest.h"
-
-#include "errno.h"
-#include "sys/mman.h"
-
-TEST(MMapTest, NoError) {
- size_t alloc_size = 128;
- llvmlibc_errno = 0;
- void *addr = __llvm_libc::mmap(nullptr, alloc_size, PROT_READ,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
- EXPECT_EQ(0, llvmlibc_errno);
- EXPECT_NE(addr, MAP_FAILED);
-
- int *array = reinterpret_cast<int *>(addr);
- // Reading from the memory should not crash the test.
- // Since we used the MAP_ANONYMOUS flag, the contents of the newly
- // allocated memory should be initialized to zero.
- EXPECT_EQ(array[0], 0);
-
- int ret_val = __llvm_libc::munmap(addr, alloc_size);
- EXPECT_EQ(0, ret_val);
- EXPECT_EQ(0, llvmlibc_errno);
-}
-
-TEST(MMapTest, Error_InvalidSize) {
- llvmlibc_errno = 0;
- void *addr = __llvm_libc::mmap(nullptr, 0, PROT_READ,
- MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
- EXPECT_EQ(EINVAL, llvmlibc_errno);
- EXPECT_EQ(addr, MAP_FAILED);
-
- llvmlibc_errno = 0;
- int ret_val = __llvm_libc::munmap(0, 0);
- EXPECT_EQ(-1, ret_val);
- EXPECT_EQ(EINVAL, llvmlibc_errno);
-}
OpenPOWER on IntegriCloud