Skip to content

Commit

Permalink
[pstl] Remove the stdlib headers from the PSTL and move them to the t…
Browse files Browse the repository at this point in the history
…ests

Summary:
PSTL should not provide those headers since they belong to the standard
library. Instead, we define a dummy standard library in the tests that
provides those headers.

Reviewers: rodgert, MikeDvorskiy

Subscribers: mgorny, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 358497
  • Loading branch information
ldionne committed Apr 16, 2019
1 parent 417c889 commit 4d88b17
Show file tree
Hide file tree
Showing 64 changed files with 50 additions and 371 deletions.
7 changes: 5 additions & 2 deletions pstl/test/CMakeLists.txt
Expand Up @@ -18,6 +18,10 @@ add_custom_target(check-pstl
DEPENDS pstl-build-tests
COMMENT "Build and run all the unit tests.")

add_library(test_stdlib INTERFACE)
target_include_directories(test_stdlib INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/support/stdlib")
target_link_libraries(test_stdlib INTERFACE pstl::ParallelSTL)

file(GLOB_RECURSE UNIT_TESTS "*.pass.cpp")
foreach(_file IN LISTS UNIT_TESTS)
file(RELATIVE_PATH _target "${CMAKE_CURRENT_SOURCE_DIR}" "${_file}")
Expand All @@ -27,8 +31,7 @@ foreach(_file IN LISTS UNIT_TESTS)

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)
target_link_libraries(${_target} PRIVATE test_stdlib)
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
5 changes: 0 additions & 5 deletions pstl/test/pstl/header_inclusion_order_algorithm_0.pass.cpp
Expand Up @@ -9,13 +9,8 @@

#include "support/pstl_test_config.h"

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

int32_t
main()
Expand Down
5 changes: 0 additions & 5 deletions pstl/test/pstl/header_inclusion_order_algorithm_1.pass.cpp
Expand Up @@ -9,13 +9,8 @@

#include "support/pstl_test_config.h"

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

int32_t
main()
Expand Down
5 changes: 0 additions & 5 deletions pstl/test/pstl/header_inclusion_order_memory_0.pass.cpp
Expand Up @@ -9,13 +9,8 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/execution"
#include "pstl/memory"
#else
#include <execution>
#include <memory>
#endif // PSTL_STANDALONE_TESTS

int32_t
main()
Expand Down
5 changes: 0 additions & 5 deletions pstl/test/pstl/header_inclusion_order_memory_1.pass.cpp
Expand Up @@ -9,13 +9,8 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/memory"
#include "pstl/execution"
#else
#include <memory>
#include <execution>
#endif // PSTL_STANDALONE_TESTS

int32_t
main()
Expand Down
5 changes: 0 additions & 5 deletions pstl/test/pstl/header_inclusion_order_numeric_0.pass.cpp
Expand Up @@ -9,13 +9,8 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/execution"
#include "pstl/numeric"
#else
#include <execution>
#include <numeric>
#endif // PSTL_STANDALONE_TESTS

int32_t
main()
Expand Down
5 changes: 0 additions & 5 deletions pstl/test/pstl/header_inclusion_order_numeric_1.pass.cpp
Expand Up @@ -9,13 +9,8 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include "pstl/numeric"
#include "pstl/execution"
#else
#include <numeric>
#include <execution>
#endif // PSTL_STANDALONE_TESTS

int32_t
main()
Expand Down
7 changes: 0 additions & 7 deletions pstl/test/std/algorithms/alg.merge/inplace_merge.pass.cpp
Expand Up @@ -9,15 +9,8 @@

#include "support/pstl_test_config.h"

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

#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS

#include "support/utils.h"

Expand Down
9 changes: 1 addition & 8 deletions pstl/test/std/algorithms/alg.merge/merge.pass.cpp
Expand Up @@ -9,16 +9,9 @@

#include "support/pstl_test_config.h"

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

#else
#include <execution>
#include <algorithm>
#endif // PSTL_STANDALONE_TESTS
#include <functional>

#include "support/utils.h"

Expand Down
Expand Up @@ -10,13 +10,8 @@
// Tests for copy_if and remove_copy_if
#include "support/pstl_test_config.h"

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

#include "support/utils.h"

Expand Down
Expand Up @@ -9,13 +9,8 @@

#include "support/pstl_test_config.h"

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

#include "support/utils.h"

Expand Down
Expand Up @@ -10,19 +10,13 @@
// Tests for stable_partition and partition
#include "support/pstl_test_config.h"

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

#include "support/utils.h"

#include <iterator>
#include <type_traits>

#include "support/utils.h"

using namespace TestUtils;

template <typename T>
Expand Down
Expand Up @@ -10,19 +10,13 @@
// Tests for stable_partition and partition_copy
#include "support/pstl_test_config.h"

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

#include "support/utils.h"

#include <cstdlib>
#include <iterator>

#include "support/utils.h"

using namespace TestUtils;

struct test_partition_copy
Expand Down
Expand Up @@ -9,15 +9,9 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <iterator>

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

#include "support/utils.h"

Expand Down
Expand Up @@ -9,15 +9,9 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <iterator>

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

#include "support/utils.h"

Expand Down
Expand Up @@ -11,13 +11,8 @@

#include "support/pstl_test_config.h"

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

#include "support/utils.h"

Expand Down
Expand Up @@ -9,14 +9,8 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS

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

#include "support/utils.h"

Expand Down
Expand Up @@ -9,15 +9,9 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <atomic>

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

#include "support/utils.h"

Expand Down
Expand Up @@ -10,13 +10,8 @@
// Test for remove, remove_if
#include "support/pstl_test_config.h"

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

#include "support/utils.h"

Expand Down
Expand Up @@ -9,14 +9,8 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS

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

#include "support/utils.h"

Expand Down
Expand Up @@ -9,13 +9,8 @@

#include "support/pstl_test_config.h"

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

#include "support/utils.h"

Expand Down
Expand Up @@ -11,13 +11,8 @@

#include "support/pstl_test_config.h"

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

#include "support/utils.h"

Expand Down
Expand Up @@ -9,15 +9,9 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <iterator>

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

#include "support/utils.h"

Expand Down
Expand Up @@ -9,15 +9,9 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <iterator>

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

#include "support/utils.h"

Expand Down
Expand Up @@ -9,15 +9,9 @@

#include "support/pstl_test_config.h"

#ifdef PSTL_STANDALONE_TESTS
#include <iterator>

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

#include "support/utils.h"

Expand Down

0 comments on commit 4d88b17

Please sign in to comment.