diff options
author | Zachary Turner <zturner@google.com> | 2017-05-11 00:03:52 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-05-11 00:03:52 +0000 |
commit | 39338fe23833f95df8daa58572052dfc6150be28 (patch) | |
tree | 7bfe99600a8e72c8b2af20941c9fd728e2d99ceb /lld/unittests | |
parent | 7b875d9b09fad95c7d444fd1ce5bfb9d9a274089 (diff) |
[Support] Move Parallel algorithms from LLD to LLVM.
Differential Revision: https://reviews.llvm.org/D33024
Diffstat (limited to 'lld/unittests')
-rw-r--r-- | lld/unittests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lld/unittests/CoreTests/CMakeLists.txt | 7 | ||||
-rw-r--r-- | lld/unittests/CoreTests/ParallelTest.cpp | 46 |
3 files changed, 0 insertions, 54 deletions
diff --git a/lld/unittests/CMakeLists.txt b/lld/unittests/CMakeLists.txt index 9cd085398c3..84d35d43f4e 100644 --- a/lld/unittests/CMakeLists.txt +++ b/lld/unittests/CMakeLists.txt @@ -12,6 +12,5 @@ function(add_lld_unittest test_dirname) target_link_libraries(${test_dirname} ${LLVM_COMMON_LIBS}) endfunction() -add_subdirectory(CoreTests) add_subdirectory(DriverTests) add_subdirectory(MachOTests) diff --git a/lld/unittests/CoreTests/CMakeLists.txt b/lld/unittests/CoreTests/CMakeLists.txt deleted file mode 100644 index 9f68f56a6c0..00000000000 --- a/lld/unittests/CoreTests/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_lld_unittest(CoreTests - ParallelTest.cpp - ) - -target_link_libraries(CoreTests - lldCore ${LLVM_PTHREAD_LIB} - ) diff --git a/lld/unittests/CoreTests/ParallelTest.cpp b/lld/unittests/CoreTests/ParallelTest.cpp deleted file mode 100644 index 601a2b0839b..00000000000 --- a/lld/unittests/CoreTests/ParallelTest.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===- lld/unittest/ParallelTest.cpp --------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// \brief Parallel.h unit tests. -/// -//===----------------------------------------------------------------------===// - -#include "gtest/gtest.h" -#include "lld/Core/Parallel.h" -#include <array> -#include <random> - -uint32_t array[1024 * 1024]; - -TEST(Parallel, sort) { - std::mt19937 randEngine; - std::uniform_int_distribution<uint32_t> dist; - - for (auto &i : array) - i = dist(randEngine); - - sort(lld::parallel::par, std::begin(array), std::end(array)); - ASSERT_TRUE(std::is_sorted(std::begin(array), std::end(array))); -} - -TEST(Parallel, parallel_for) { - // We need to test the case with a TaskSize > 1. We are white-box testing - // here. The TaskSize is calculated as (End - Begin) / 1024 at the time of - // writing. - uint32_t range[2050]; - std::fill(range, range + 2050, 1); - for_each_n(lld::parallel::par, 0, 2049, [&range](size_t I) { ++range[I]; }); - - uint32_t expected[2049]; - std::fill(expected, expected + 2049, 2); - ASSERT_TRUE(std::equal(range, range + 2049, expected)); - // Check that we don't write past the end of the requested range. - ASSERT_EQ(range[2049], 1u); -} |