Skip to content

Commit

Permalink
Restructure test suite to follow libc++ standard layout
Browse files Browse the repository at this point in the history
Summary: Subsumes changes requested in https://reviews.llvm.org/D59110

Reviewers: EricWF, ldionne

Subscribers: mgorny, krytarowski, jfb, jdoerfert, libcxx-commits

Differential Revision: https://reviews.llvm.org/D59856

llvm-svn: 357124
  • Loading branch information
ldionne committed Mar 27, 2019
1 parent 4bc38cf commit 3b62047
Show file tree
Hide file tree
Showing 58 changed files with 506 additions and 161 deletions.
4 changes: 3 additions & 1 deletion pstl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ add_library(ParallelSTL INTERFACE)
add_library(pstl::ParallelSTL ALIAS ParallelSTL)

if (PARALLELSTL_USE_PARALLEL_POLICIES)
message(STATUS "Using Parallel Policies")
if (PARALLELSTL_BACKEND STREQUAL "tbb")
find_package(TBB 2018 REQUIRED tbb OPTIONAL_COMPONENTS tbbmalloc)
message(STATUS "Parallel STL uses TBB ${TBB_VERSION} (interface version: ${TBB_INTERFACE_VERSION})")
target_link_libraries(ParallelSTL INTERFACE TBB::tbb)
else()
else()
message(STATUS "Using Parallel Policies, but not tbb")
if (TARGET ${PARALLELSTL_BACKEND})
target_link_libraries(ParallelSTL INTERFACE ${PARALLELSTL_BACKEND})
else()
Expand Down
1 change: 1 addition & 0 deletions pstl/include/pstl/internal/parallel_backend_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <iterator>
#include <utility>
#include <cassert>
#include "utils.h"

namespace __pstl
Expand Down
5 changes: 4 additions & 1 deletion pstl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ add_custom_target(check-pstl
DEPENDS pstl-build-tests
COMMENT "Build and run all the unit tests.")

file(GLOB_RECURSE UNIT_TESTS "test_*.cpp")
file(GLOB_RECURSE UNIT_TESTS "*.pass.cpp")
foreach(_file IN LISTS UNIT_TESTS)
file(RELATIVE_PATH _target "${CMAKE_CURRENT_SOURCE_DIR}" "${_file}")
string(REPLACE ".cpp" "" _target "${_target}")
string(REPLACE "/" "-" _target "${_target}")
set(_target "pstl-${_target}")

add_executable(${_target} EXCLUDE_FROM_ALL "${_file}")
target_include_directories(${_target} PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
target_link_libraries(${_target} PRIVATE pstl::ParallelSTL)
target_compile_definitions(${_target} PRIVATE -DPSTL_STANDALONE_TESTS)
set_target_properties(${_target} PROPERTIES CXX_EXTENSIONS NO
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
add_test(${_target} "${CMAKE_CURRENT_BINARY_DIR}/${_target}")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
// -*- C++ -*-
//===-- test_inplace_merge.cpp --------------------------------------------===//
//===-- inplace_merge.pass.cpp --------------------------------------------===//
//
// 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 "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <algorithm>
#include "pstl/execution"
#include "pstl/algorithm"

#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
// -*- C++ -*-
//===-- test_merge.cpp ----------------------------------------------------===//
//===-- merge.pass.cpp ----------------------------------------------------===//
//
// 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 "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <algorithm>
#include <functional>
#include "pstl/execution"
#include "pstl/algorithm"

#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -*- C++ -*-
//===-- test_copy_if.cpp --------------------------------------------------===//
//===-- copy_if.pass.cpp --------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -8,11 +8,17 @@
//===----------------------------------------------------------------------===//

// Tests for copy_if and remove_copy_if
#include "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
// -*- C++ -*-
//===-- test_is_partitioned.cpp -------------------------------------------===//
//===-- is_partitioned.pass.cpp -------------------------------------------===//
//
// 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 "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -*- C++ -*-
//===-- test_partition.cpp ------------------------------------------------===//
//===-- partition.pass.cpp ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -8,11 +8,17 @@
//===----------------------------------------------------------------------===//

// Tests for stable_partition and partition
#include "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

#include <iterator>
#include <type_traits>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -*- C++ -*-
//===-- test_partition_copy.cpp -------------------------------------------===//
//===-- partition_copy.pass.cpp -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -8,11 +8,17 @@
//===----------------------------------------------------------------------===//

// Tests for stable_partition and partition_copy
#include "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

#include <cstdlib>
#include <iterator>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
// -*- C++ -*-
//===-- test_reverse.cpp --------------------------------------------------===//
//===-- reverse.pass.cpp --------------------------------------------------===//
//
// 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 "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <iterator>

#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
// -*- C++ -*-
//===-- test_reverse_copy.cpp ---------------------------------------------===//
//===-- reverse_copy.pass.cpp ---------------------------------------------===//
//
// 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 "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <iterator>

#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -*- C++ -*-
//===-- test_copy_move.cpp ------------------------------------------------===//
//===-- copy_move.pass.cpp ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -9,11 +9,17 @@

// Tests for copy, move and copy_n

#include "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
// -*- C++ -*-
//===-- test_fill.cpp -----------------------------------------------------===//
//===-- fill.pass.cpp -----------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

// Tests for fill/fill_n
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS

#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
// -*- C++ -*-
//===-- test_generate.cpp -------------------------------------------------===//
//===-- generate.pass.cpp -------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//

// Tests for generate
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <atomic>

#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -*- C++ -*-
//===-- test_remove.cpp ---------------------------------------------------===//
//===-- remove.pass.cpp ---------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
Expand All @@ -8,11 +8,17 @@
//===----------------------------------------------------------------------===//

// Test for remove, remove_if
#include "pstl_test_config.h"
#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/execution"
#include "pstl/algorithm"
#include "utils.h"
#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

using namespace TestUtils;

Expand Down
Loading

0 comments on commit 3b62047

Please sign in to comment.