Skip to content

Commit 3b62047

Browse files
committed
Restructure test suite to follow libc++ standard layout
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
1 parent 4bc38cf commit 3b62047

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+506
-161
lines changed

pstl/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ add_library(ParallelSTL INTERFACE)
3131
add_library(pstl::ParallelSTL ALIAS ParallelSTL)
3232

3333
if (PARALLELSTL_USE_PARALLEL_POLICIES)
34+
message(STATUS "Using Parallel Policies")
3435
if (PARALLELSTL_BACKEND STREQUAL "tbb")
3536
find_package(TBB 2018 REQUIRED tbb OPTIONAL_COMPONENTS tbbmalloc)
3637
message(STATUS "Parallel STL uses TBB ${TBB_VERSION} (interface version: ${TBB_INTERFACE_VERSION})")
3738
target_link_libraries(ParallelSTL INTERFACE TBB::tbb)
38-
else()
39+
else()
40+
message(STATUS "Using Parallel Policies, but not tbb")
3941
if (TARGET ${PARALLELSTL_BACKEND})
4042
target_link_libraries(ParallelSTL INTERFACE ${PARALLELSTL_BACKEND})
4143
else()

pstl/include/pstl/internal/parallel_backend_utils.h

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <iterator>
1414
#include <utility>
15+
#include <cassert>
1516
#include "utils.h"
1617

1718
namespace __pstl

pstl/test/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ add_custom_target(check-pstl
1818
DEPENDS pstl-build-tests
1919
COMMENT "Build and run all the unit tests.")
2020

21-
file(GLOB_RECURSE UNIT_TESTS "test_*.cpp")
21+
file(GLOB_RECURSE UNIT_TESTS "*.pass.cpp")
2222
foreach(_file IN LISTS UNIT_TESTS)
2323
file(RELATIVE_PATH _target "${CMAKE_CURRENT_SOURCE_DIR}" "${_file}")
2424
string(REPLACE ".cpp" "" _target "${_target}")
25+
string(REPLACE "/" "-" _target "${_target}")
2526
set(_target "pstl-${_target}")
2627

2728
add_executable(${_target} EXCLUDE_FROM_ALL "${_file}")
29+
target_include_directories(${_target} PRIVATE "${CMAKE_CURRENT_LIST_DIR}")
2830
target_link_libraries(${_target} PRIVATE pstl::ParallelSTL)
31+
target_compile_definitions(${_target} PRIVATE -DPSTL_STANDALONE_TESTS)
2932
set_target_properties(${_target} PROPERTIES CXX_EXTENSIONS NO
3033
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
3134
add_test(${_target} "${CMAKE_CURRENT_BINARY_DIR}/${_target}")

pstl/test/test_inplace_merge.cpp renamed to pstl/test/std/algorithms/alg.merge/inplace_merge.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
// -*- C++ -*-
2-
//===-- test_inplace_merge.cpp --------------------------------------------===//
2+
//===-- inplace_merge.pass.cpp --------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
66
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#include "pstl_test_config.h"
10+
#include "support/pstl_test_config.h"
1111

12+
#ifdef PSTL_STANDALONE_TESTS
1213
#include <algorithm>
1314
#include "pstl/execution"
1415
#include "pstl/algorithm"
1516

16-
#include "utils.h"
17+
#else
18+
#include <execution>
19+
#include <algorithm>
20+
#endif // PSTL_STANDALONE_TESTS
21+
22+
#include "support/utils.h"
1723

1824
using namespace TestUtils;
1925

pstl/test/test_merge.cpp renamed to pstl/test/std/algorithms/alg.merge/merge.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
// -*- C++ -*-
2-
//===-- test_merge.cpp ----------------------------------------------------===//
2+
//===-- merge.pass.cpp ----------------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
66
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#include "pstl_test_config.h"
10+
#include "support/pstl_test_config.h"
1111

12+
#ifdef PSTL_STANDALONE_TESTS
1213
#include <algorithm>
1314
#include <functional>
1415
#include "pstl/execution"
1516
#include "pstl/algorithm"
1617

17-
#include "utils.h"
18+
#else
19+
#include <execution>
20+
#include <algorithm>
21+
#endif // PSTL_STANDALONE_TESTS
22+
23+
#include "support/utils.h"
1824

1925
using namespace TestUtils;
2026

pstl/test/test_copy_if.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/alg.copy/copy_if.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// -*- C++ -*-
2-
//===-- test_copy_if.cpp --------------------------------------------------===//
2+
//===-- copy_if.pass.cpp --------------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,11 +8,17 @@
88
//===----------------------------------------------------------------------===//
99

1010
// Tests for copy_if and remove_copy_if
11-
#include "pstl_test_config.h"
11+
#include "support/pstl_test_config.h"
1212

13+
#ifdef PSTL_STANDALONE_TESTS
1314
#include "pstl/execution"
1415
#include "pstl/algorithm"
15-
#include "utils.h"
16+
#else
17+
#include <execution>
18+
#include <algorithm>
19+
#endif // PSTL_STANDALONE_TESTS
20+
21+
#include "support/utils.h"
1622

1723
using namespace TestUtils;
1824

pstl/test/test_is_partitioned.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/alg.partitions/is_partitioned.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
// -*- C++ -*-
2-
//===-- test_is_partitioned.cpp -------------------------------------------===//
2+
//===-- is_partitioned.pass.cpp -------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
66
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#include "pstl_test_config.h"
10+
#include "support/pstl_test_config.h"
1111

12+
#ifdef PSTL_STANDALONE_TESTS
1213
#include "pstl/execution"
1314
#include "pstl/algorithm"
14-
#include "utils.h"
15+
#else
16+
#include <execution>
17+
#include <algorithm>
18+
#endif // PSTL_STANDALONE_TESTS
19+
20+
#include "support/utils.h"
1521

1622
using namespace TestUtils;
1723

pstl/test/test_partition.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/alg.partitions/partition.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// -*- C++ -*-
2-
//===-- test_partition.cpp ------------------------------------------------===//
2+
//===-- partition.pass.cpp ------------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,11 +8,17 @@
88
//===----------------------------------------------------------------------===//
99

1010
// Tests for stable_partition and partition
11-
#include "pstl_test_config.h"
11+
#include "support/pstl_test_config.h"
1212

13+
#ifdef PSTL_STANDALONE_TESTS
1314
#include "pstl/execution"
1415
#include "pstl/algorithm"
15-
#include "utils.h"
16+
#else
17+
#include <execution>
18+
#include <algorithm>
19+
#endif // PSTL_STANDALONE_TESTS
20+
21+
#include "support/utils.h"
1622

1723
#include <iterator>
1824
#include <type_traits>

pstl/test/test_partition_copy.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/alg.partitions/partition_copy.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// -*- C++ -*-
2-
//===-- test_partition_copy.cpp -------------------------------------------===//
2+
//===-- partition_copy.pass.cpp -------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,11 +8,17 @@
88
//===----------------------------------------------------------------------===//
99

1010
// Tests for stable_partition and partition_copy
11-
#include "pstl_test_config.h"
11+
#include "support/pstl_test_config.h"
1212

13+
#ifdef PSTL_STANDALONE_TESTS
1314
#include "pstl/execution"
1415
#include "pstl/algorithm"
15-
#include "utils.h"
16+
#else
17+
#include <execution>
18+
#include <algorithm>
19+
#endif // PSTL_STANDALONE_TESTS
20+
21+
#include "support/utils.h"
1622

1723
#include <cstdlib>
1824
#include <iterator>

pstl/test/test_reverse.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
// -*- C++ -*-
2-
//===-- test_reverse.cpp --------------------------------------------------===//
2+
//===-- reverse.pass.cpp --------------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
66
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#include "pstl_test_config.h"
10+
#include "support/pstl_test_config.h"
1111

12+
#ifdef PSTL_STANDALONE_TESTS
1213
#include <iterator>
1314

1415
#include "pstl/execution"
1516
#include "pstl/algorithm"
16-
#include "utils.h"
17+
#else
18+
#include <execution>
19+
#include <algorithm>
20+
#endif // PSTL_STANDALONE_TESTS
21+
22+
#include "support/utils.h"
1723

1824
using namespace TestUtils;
1925

pstl/test/test_reverse_copy.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/alg.reverse/reverse_copy.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
// -*- C++ -*-
2-
//===-- test_reverse_copy.cpp ---------------------------------------------===//
2+
//===-- reverse_copy.pass.cpp ---------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
66
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
//
88
//===----------------------------------------------------------------------===//
99

10-
#include "pstl_test_config.h"
10+
#include "support/pstl_test_config.h"
1111

12+
#ifdef PSTL_STANDALONE_TESTS
1213
#include <iterator>
1314

1415
#include "pstl/execution"
1516
#include "pstl/algorithm"
16-
#include "utils.h"
17+
#else
18+
#include <execution>
19+
#include <algorithm>
20+
#endif // PSTL_STANDALONE_TESTS
21+
22+
#include "support/utils.h"
1723

1824
using namespace TestUtils;
1925

pstl/test/test_copy_move.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/copy_move.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// -*- C++ -*-
2-
//===-- test_copy_move.cpp ------------------------------------------------===//
2+
//===-- copy_move.pass.cpp ------------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
@@ -9,11 +9,17 @@
99

1010
// Tests for copy, move and copy_n
1111

12-
#include "pstl_test_config.h"
12+
#include "support/pstl_test_config.h"
1313

14+
#ifdef PSTL_STANDALONE_TESTS
1415
#include "pstl/execution"
1516
#include "pstl/algorithm"
16-
#include "utils.h"
17+
#else
18+
#include <execution>
19+
#include <algorithm>
20+
#endif // PSTL_STANDALONE_TESTS
21+
22+
#include "support/utils.h"
1723

1824
using namespace TestUtils;
1925

pstl/test/test_fill.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/fill.pass.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
// -*- C++ -*-
2-
//===-- test_fill.cpp -----------------------------------------------------===//
2+
//===-- fill.pass.cpp -----------------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
66
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
//
88
//===----------------------------------------------------------------------===//
99

10-
// Tests for fill/fill_n
10+
#include "support/pstl_test_config.h"
11+
12+
#ifdef PSTL_STANDALONE_TESTS
1113

1214
#include "pstl/execution"
1315
#include "pstl/algorithm"
14-
#include "utils.h"
16+
#else
17+
#include <execution>
18+
#include <algorithm>
19+
#endif // PSTL_STANDALONE_TESTS
20+
21+
#include "support/utils.h"
1522

1623
using namespace TestUtils;
1724

pstl/test/test_generate.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/generate.pass.cpp

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
// -*- C++ -*-
2-
//===-- test_generate.cpp -------------------------------------------------===//
2+
//===-- generate.pass.cpp -------------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
66
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
//
88
//===----------------------------------------------------------------------===//
99

10-
// Tests for generate
10+
#include "support/pstl_test_config.h"
11+
12+
#ifdef PSTL_STANDALONE_TESTS
1113
#include <atomic>
1214

1315
#include "pstl/execution"
1416
#include "pstl/algorithm"
15-
#include "utils.h"
17+
#else
18+
#include <execution>
19+
#include <algorithm>
20+
#endif // PSTL_STANDALONE_TESTS
21+
22+
#include "support/utils.h"
1623

1724
using namespace TestUtils;
1825

pstl/test/test_remove.cpp renamed to pstl/test/std/algorithms/alg.modifying.operations/remove.pass.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// -*- C++ -*-
2-
//===-- test_remove.cpp ---------------------------------------------------===//
2+
//===-- remove.pass.cpp ---------------------------------------------------===//
33
//
44
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
55
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,11 +8,17 @@
88
//===----------------------------------------------------------------------===//
99

1010
// Test for remove, remove_if
11-
#include "pstl_test_config.h"
11+
#include "support/pstl_test_config.h"
1212

13+
#ifdef PSTL_STANDALONE_TESTS
1314
#include "pstl/execution"
1415
#include "pstl/algorithm"
15-
#include "utils.h"
16+
#else
17+
#include <execution>
18+
#include <algorithm>
19+
#endif // PSTL_STANDALONE_TESTS
20+
21+
#include "support/utils.h"
1622

1723
using namespace TestUtils;
1824

0 commit comments

Comments
 (0)