diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:41 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-16 19:47:41 +0000 |
commit | 022ebf5bbf58ca2dd943d3376cc95a6b206db799 (patch) | |
tree | 4069ef3b75eed2d68683cb6224a627c24cd95b15 /unittests | |
parent | fbe69f787ace06f44b6cb1bd3cd45ac703a16a05 (diff) | |
download | src-022ebf5bbf58ca2dd943d3376cc95a6b206db799.tar.gz src-022ebf5bbf58ca2dd943d3376cc95a6b206db799.zip |
Vendor import of lld trunk r303197:vendor/lld/lld-trunk-r303197
Notes
Notes:
svn path=/vendor/lld/dist/; revision=318376
svn path=/vendor/lld/lld-trunk-r303197/; revision=318377; tag=vendor/lld/lld-trunk-r303197
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | unittests/CoreTests/CMakeLists.txt | 7 | ||||
-rw-r--r-- | unittests/CoreTests/ParallelTest.cpp | 46 |
3 files changed, 0 insertions, 54 deletions
diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 9cd085398c37..84d35d43f4e8 100644 --- a/unittests/CMakeLists.txt +++ b/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/unittests/CoreTests/CMakeLists.txt b/unittests/CoreTests/CMakeLists.txt deleted file mode 100644 index 9f68f56a6c03..000000000000 --- a/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/unittests/CoreTests/ParallelTest.cpp b/unittests/CoreTests/ParallelTest.cpp deleted file mode 100644 index bd8507026a07..000000000000 --- a/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); - - lld::parallel_sort(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); - lld::parallel_for(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); -} |