Skip to content

[libc++] Move the benchmarks under libcxx/test #99371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Jul 17, 2024

This is an intermediate and fairly mechanical step towards unifying the benchmarks with the rest of the test suite. Moving this around requires a few changes, notably making sure we don't throw a wrench into the discovery process of the normal test suite. This won't be a problem anymore once benchmarks are taken into account by the test setup out of the box.

@ldionne ldionne requested a review from philnik777 July 17, 2024 18:40
@ldionne ldionne requested a review from a team as a code owner July 17, 2024 18:40
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jul 17, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 17, 2024

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

This is an intermediate and fairly mechanical step towards unifying the benchmarks with the rest of the test suite. Moving this around requires a few changes, notably making sure we don't throw a wrench into the discovery process of the normal test suite. This won't be a problem anymore once benchmarks are taken into account by the test setup out of the box.


Patch is 22.29 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/99371.diff

77 Files Affected:

  • (modified) libcxx/CMakeLists.txt (-4)
  • (modified) libcxx/docs/TestingLibcxx.rst (+5-5)
  • (modified) libcxx/test/CMakeLists.txt (+4)
  • (renamed) libcxx/test/benchmarks/CMakeLists.txt (+4-2)
  • (renamed) libcxx/test/benchmarks/CartesianBenchmarks.h ()
  • (renamed) libcxx/test/benchmarks/ContainerBenchmarks.h ()
  • (renamed) libcxx/test/benchmarks/GenerateInput.h ()
  • (renamed) libcxx/test/benchmarks/Utilities.h ()
  • (renamed) libcxx/test/benchmarks/VariantBenchmarks.h ()
  • (renamed) libcxx/test/benchmarks/algorithms.partition_point.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/common.h ()
  • (renamed) libcxx/test/benchmarks/algorithms/count.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/equal.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/fill.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/find.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/for_each.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/lower_bound.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/make_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/min.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/minmax.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/mismatch.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/pstl.stable_sort.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/push_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/ranges_ends_with.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/ranges_make_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/ranges_push_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/ranges_sort.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/ranges_sort_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/ranges_stable_sort.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/sort.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/sort_heap.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/algorithms/stable_sort.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/allocation.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/atomic_wait.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/deque.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/deque_iterator.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/exception_ptr.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/filesystem.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/format.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/format_to.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/format_to_n.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/formatted_size.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/formatter_float.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/formatter_int.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/function.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/join_view.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/libcxxabi/dynamic_cast.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/lit.cfg.py.in (+3-3)
  • (renamed) libcxx/test/benchmarks/lit.site.cfg.py.in (+1-1)
  • (renamed) libcxx/test/benchmarks/map.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/monotonic_buffer.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/numeric/gcd.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/ordered_set.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/random.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/shared_mutex_vs_mutex.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/stop_token.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/string.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/stringstream.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/system_error.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/to_chars.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/unordered_set_operations.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/util_smartptr.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/variant_visit_1.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/variant_visit_2.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/variant_visit_3.bench.cpp ()
  • (renamed) libcxx/test/benchmarks/vector_operations.bench.cpp ()
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 155f81a74a974..e46c65039821e 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -855,10 +855,6 @@ add_subdirectory(src)
 add_subdirectory(utils)
 add_subdirectory(modules)
 
-if (LIBCXX_INCLUDE_BENCHMARKS)
-  add_subdirectory(benchmarks)
-endif()
-
 if (LIBCXX_INCLUDE_TESTS)
   add_subdirectory(test)
   add_subdirectory(lib/abi)
diff --git a/libcxx/docs/TestingLibcxx.rst b/libcxx/docs/TestingLibcxx.rst
index 6d3417cabfd61..96543251ca1cb 100644
--- a/libcxx/docs/TestingLibcxx.rst
+++ b/libcxx/docs/TestingLibcxx.rst
@@ -449,9 +449,9 @@ An example build would look like:
 
   $ ninja -C build cxx-benchmarks
 
-This will build all of the benchmarks under ``<libcxx-src>/benchmarks`` to be
+This will build all of the benchmarks under ``<libcxx>/test/benchmarks`` to be
 built against the just-built libc++. The compiled tests are output into
-``build/projects/libcxx/benchmarks``.
+``build/libcxx/test/benchmarks``.
 
 Also See:
 
@@ -468,9 +468,9 @@ For example:
 
 .. code-block:: bash
 
-  $ cd build/projects/libcxx/benchmarks
-  $ ./algorithms.bench.out # Runs all the benchmarks
-  $ ./algorithms.bench.out --benchmark_filter=BM_Sort.* # Only runs the sort benchmarks
+  $ cd build/libcxx/test/benchmarks
+  $ ./find.bench.out # Runs all the benchmarks
+  $ ./find.bench.out --benchmark_filter="bm_ranges_find<std::vector<char>>" # Only runs that specific benchmark
 
 For more information about running benchmarks see `Google Benchmark`_.
 
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index cdd1c2d90fbcf..4ce15c79d005a 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -1,6 +1,10 @@
 include(HandleLitArguments)
 add_subdirectory(tools)
 
+if (LIBCXX_INCLUDE_BENCHMARKS)
+  add_subdirectory(benchmarks)
+endif()
+
 # By default, libcxx and libcxxabi share a library directory.
 if (NOT LIBCXX_CXX_ABI_LIBRARY_PATH)
   set(LIBCXX_CXX_ABI_LIBRARY_PATH "${LIBCXX_LIBRARY_DIR}" CACHE PATH
diff --git a/libcxx/benchmarks/CMakeLists.txt b/libcxx/test/benchmarks/CMakeLists.txt
similarity index 98%
rename from libcxx/benchmarks/CMakeLists.txt
rename to libcxx/test/benchmarks/CMakeLists.txt
index 110672600213a..d9cb7be0f091e 100644
--- a/libcxx/benchmarks/CMakeLists.txt
+++ b/libcxx/test/benchmarks/CMakeLists.txt
@@ -5,8 +5,6 @@ include(CheckCXXCompilerFlag)
 # Build Google Benchmark
 #==============================================================================
 
-set(CMAKE_FOLDER "${CMAKE_FOLDER}/Benchmarks")
-
 set(BENCHMARK_COMPILE_FLAGS
     -Wno-unused-command-line-argument
     -nostdinc++
@@ -190,6 +188,10 @@ endforeach()
 if (LIBCXX_INCLUDE_TESTS)
   include(AddLLVM)
 
+  configure_lit_site_cfg(
+          ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py.in
+          ${CMAKE_CURRENT_BINARY_DIR}/lit.cfg.py)
+
   configure_lit_site_cfg(
           ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
           ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
diff --git a/libcxx/benchmarks/CartesianBenchmarks.h b/libcxx/test/benchmarks/CartesianBenchmarks.h
similarity index 100%
rename from libcxx/benchmarks/CartesianBenchmarks.h
rename to libcxx/test/benchmarks/CartesianBenchmarks.h
diff --git a/libcxx/benchmarks/ContainerBenchmarks.h b/libcxx/test/benchmarks/ContainerBenchmarks.h
similarity index 100%
rename from libcxx/benchmarks/ContainerBenchmarks.h
rename to libcxx/test/benchmarks/ContainerBenchmarks.h
diff --git a/libcxx/benchmarks/GenerateInput.h b/libcxx/test/benchmarks/GenerateInput.h
similarity index 100%
rename from libcxx/benchmarks/GenerateInput.h
rename to libcxx/test/benchmarks/GenerateInput.h
diff --git a/libcxx/benchmarks/Utilities.h b/libcxx/test/benchmarks/Utilities.h
similarity index 100%
rename from libcxx/benchmarks/Utilities.h
rename to libcxx/test/benchmarks/Utilities.h
diff --git a/libcxx/benchmarks/VariantBenchmarks.h b/libcxx/test/benchmarks/VariantBenchmarks.h
similarity index 100%
rename from libcxx/benchmarks/VariantBenchmarks.h
rename to libcxx/test/benchmarks/VariantBenchmarks.h
diff --git a/libcxx/benchmarks/algorithms.partition_point.bench.cpp b/libcxx/test/benchmarks/algorithms.partition_point.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms.partition_point.bench.cpp
rename to libcxx/test/benchmarks/algorithms.partition_point.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/common.h b/libcxx/test/benchmarks/algorithms/common.h
similarity index 100%
rename from libcxx/benchmarks/algorithms/common.h
rename to libcxx/test/benchmarks/algorithms/common.h
diff --git a/libcxx/benchmarks/algorithms/count.bench.cpp b/libcxx/test/benchmarks/algorithms/count.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/count.bench.cpp
rename to libcxx/test/benchmarks/algorithms/count.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/equal.bench.cpp b/libcxx/test/benchmarks/algorithms/equal.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/equal.bench.cpp
rename to libcxx/test/benchmarks/algorithms/equal.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/fill.bench.cpp b/libcxx/test/benchmarks/algorithms/fill.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/fill.bench.cpp
rename to libcxx/test/benchmarks/algorithms/fill.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/find.bench.cpp b/libcxx/test/benchmarks/algorithms/find.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/find.bench.cpp
rename to libcxx/test/benchmarks/algorithms/find.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/for_each.bench.cpp b/libcxx/test/benchmarks/algorithms/for_each.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/for_each.bench.cpp
rename to libcxx/test/benchmarks/algorithms/for_each.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/lower_bound.bench.cpp b/libcxx/test/benchmarks/algorithms/lower_bound.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/lower_bound.bench.cpp
rename to libcxx/test/benchmarks/algorithms/lower_bound.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/make_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/make_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/make_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/make_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/make_heap_then_sort_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/min.bench.cpp b/libcxx/test/benchmarks/algorithms/min.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/min.bench.cpp
rename to libcxx/test/benchmarks/algorithms/min.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/min_max_element.bench.cpp b/libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/min_max_element.bench.cpp
rename to libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/minmax.bench.cpp b/libcxx/test/benchmarks/algorithms/minmax.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/minmax.bench.cpp
rename to libcxx/test/benchmarks/algorithms/minmax.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/mismatch.bench.cpp b/libcxx/test/benchmarks/algorithms/mismatch.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/mismatch.bench.cpp
rename to libcxx/test/benchmarks/algorithms/mismatch.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/pop_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/pop_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp b/libcxx/test/benchmarks/algorithms/pstl.stable_sort.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/pstl.stable_sort.bench.cpp
rename to libcxx/test/benchmarks/algorithms/pstl.stable_sort.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/push_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/push_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/push_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/push_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/ranges_contains.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/ranges_contains.bench.cpp
rename to libcxx/test/benchmarks/algorithms/ranges_contains.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/ranges_ends_with.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_ends_with.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/ranges_ends_with.bench.cpp
rename to libcxx/test/benchmarks/algorithms/ranges_ends_with.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/ranges_make_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_make_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/ranges_make_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/ranges_make_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/ranges_make_heap_then_sort_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/ranges_pop_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/ranges_pop_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/ranges_push_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_push_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/ranges_push_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/ranges_push_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/ranges_sort.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_sort.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/ranges_sort.bench.cpp
rename to libcxx/test/benchmarks/algorithms/ranges_sort.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/ranges_sort_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_sort_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/ranges_sort_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/ranges_sort_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/ranges_stable_sort.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_stable_sort.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/ranges_stable_sort.bench.cpp
rename to libcxx/test/benchmarks/algorithms/ranges_stable_sort.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/sort.bench.cpp b/libcxx/test/benchmarks/algorithms/sort.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/sort.bench.cpp
rename to libcxx/test/benchmarks/algorithms/sort.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/sort_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/sort_heap.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/sort_heap.bench.cpp
rename to libcxx/test/benchmarks/algorithms/sort_heap.bench.cpp
diff --git a/libcxx/benchmarks/algorithms/stable_sort.bench.cpp b/libcxx/test/benchmarks/algorithms/stable_sort.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/algorithms/stable_sort.bench.cpp
rename to libcxx/test/benchmarks/algorithms/stable_sort.bench.cpp
diff --git a/libcxx/benchmarks/allocation.bench.cpp b/libcxx/test/benchmarks/allocation.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/allocation.bench.cpp
rename to libcxx/test/benchmarks/allocation.bench.cpp
diff --git a/libcxx/benchmarks/atomic_wait.bench.cpp b/libcxx/test/benchmarks/atomic_wait.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/atomic_wait.bench.cpp
rename to libcxx/test/benchmarks/atomic_wait.bench.cpp
diff --git a/libcxx/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp b/libcxx/test/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp
rename to libcxx/test/benchmarks/atomic_wait_vs_mutex_lock.bench.cpp
diff --git a/libcxx/benchmarks/deque.bench.cpp b/libcxx/test/benchmarks/deque.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/deque.bench.cpp
rename to libcxx/test/benchmarks/deque.bench.cpp
diff --git a/libcxx/benchmarks/deque_iterator.bench.cpp b/libcxx/test/benchmarks/deque_iterator.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/deque_iterator.bench.cpp
rename to libcxx/test/benchmarks/deque_iterator.bench.cpp
diff --git a/libcxx/benchmarks/exception_ptr.bench.cpp b/libcxx/test/benchmarks/exception_ptr.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/exception_ptr.bench.cpp
rename to libcxx/test/benchmarks/exception_ptr.bench.cpp
diff --git a/libcxx/benchmarks/filesystem.bench.cpp b/libcxx/test/benchmarks/filesystem.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/filesystem.bench.cpp
rename to libcxx/test/benchmarks/filesystem.bench.cpp
diff --git a/libcxx/benchmarks/format.bench.cpp b/libcxx/test/benchmarks/format.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/format.bench.cpp
rename to libcxx/test/benchmarks/format.bench.cpp
diff --git a/libcxx/benchmarks/format_to.bench.cpp b/libcxx/test/benchmarks/format_to.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/format_to.bench.cpp
rename to libcxx/test/benchmarks/format_to.bench.cpp
diff --git a/libcxx/benchmarks/format_to_n.bench.cpp b/libcxx/test/benchmarks/format_to_n.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/format_to_n.bench.cpp
rename to libcxx/test/benchmarks/format_to_n.bench.cpp
diff --git a/libcxx/benchmarks/formatted_size.bench.cpp b/libcxx/test/benchmarks/formatted_size.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/formatted_size.bench.cpp
rename to libcxx/test/benchmarks/formatted_size.bench.cpp
diff --git a/libcxx/benchmarks/formatter_float.bench.cpp b/libcxx/test/benchmarks/formatter_float.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/formatter_float.bench.cpp
rename to libcxx/test/benchmarks/formatter_float.bench.cpp
diff --git a/libcxx/benchmarks/formatter_int.bench.cpp b/libcxx/test/benchmarks/formatter_int.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/formatter_int.bench.cpp
rename to libcxx/test/benchmarks/formatter_int.bench.cpp
diff --git a/libcxx/benchmarks/function.bench.cpp b/libcxx/test/benchmarks/function.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/function.bench.cpp
rename to libcxx/test/benchmarks/function.bench.cpp
diff --git a/libcxx/benchmarks/join_view.bench.cpp b/libcxx/test/benchmarks/join_view.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/join_view.bench.cpp
rename to libcxx/test/benchmarks/join_view.bench.cpp
diff --git a/libcxx/benchmarks/lexicographical_compare_three_way.bench.cpp b/libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/lexicographical_compare_three_way.bench.cpp
rename to libcxx/test/benchmarks/lexicographical_compare_three_way.bench.cpp
diff --git a/libcxx/benchmarks/libcxxabi/dynamic_cast.bench.cpp b/libcxx/test/benchmarks/libcxxabi/dynamic_cast.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/libcxxabi/dynamic_cast.bench.cpp
rename to libcxx/test/benchmarks/libcxxabi/dynamic_cast.bench.cpp
diff --git a/libcxx/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp b/libcxx/test/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp
rename to libcxx/test/benchmarks/libcxxabi/dynamic_cast_old_stress.bench.cpp
diff --git a/libcxx/benchmarks/lit.cfg.py b/libcxx/test/benchmarks/lit.cfg.py.in
similarity index 73%
rename from libcxx/benchmarks/lit.cfg.py
rename to libcxx/test/benchmarks/lit.cfg.py.in
index 0d08966c26cc1..a3ce2477b9a85 100644
--- a/libcxx/benchmarks/lit.cfg.py
+++ b/libcxx/test/benchmarks/lit.cfg.py.in
@@ -3,7 +3,7 @@
 import os
 import site
 
-site.addsitedir(os.path.join(os.path.dirname(os.path.dirname(__file__)), "utils"))
+site.addsitedir(os.path.join("@LIBCXX_SOURCE_DIR@", "utils"))
 from libcxx.test.googlebenchmark import GoogleBenchmark
 
 # Tell pylint that we know config and lit_config exist somewhere.
@@ -15,8 +15,8 @@
 config.name = "libc++ benchmarks"
 config.suffixes = []
 
-config.test_exec_root = os.path.join(config.libcxx_obj_root, "benchmarks")
-config.test_source_root = config.test_exec_root
+config.test_exec_root = "@CMAKE_CURRENT_BINARY_DIR@"
+config.test_source_root = "@CMAKE_CURRENT_BINARY_DIR@"
 
 config.test_format = GoogleBenchmark(
     test_sub_dirs=".", test_suffix=".bench.out", benchmark_args=config.benchmark_args
diff --git a/libcxx/benchmarks/lit.site.cfg.py.in b/libcxx/test/benchmarks/lit.site.cfg.py.in
similarity index 76%
rename from libcxx/benchmarks/lit.site.cfg.py.in
rename to libcxx/test/benchmarks/lit.site.cfg.py.in
index e3ce8b22263e1..6d4b0ca3dae0e 100644
--- a/libcxx/benchmarks/lit.site.cfg.py.in
+++ b/libcxx/test/benchmarks/lit.site.cfg.py.in
@@ -7,4 +7,4 @@ config.libcxx_obj_root = "@LIBCXX_BINARY_DIR@"
 config.benchmark_args = "@LIBCXX_BENCHMARK_TEST_ARGS@".split(';')
 
 # Let the main config do the real work.
-lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/benchmarks/lit.cfg.py")
\ No newline at end of file
+lit_config.load_config(config, "@CMAKE_CURRENT_BINARY_DIR@/lit.cfg.py")
\ No newline at end of file
diff --git a/libcxx/benchmarks/map.bench.cpp b/libcxx/test/benchmarks/map.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/map.bench.cpp
rename to libcxx/test/benchmarks/map.bench.cpp
diff --git a/libcxx/benchmarks/monotonic_buffer.bench.cpp b/libcxx/test/benchmarks/monotonic_buffer.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/monotonic_buffer.bench.cpp
rename to libcxx/test/benchmarks/monotonic_buffer.bench.cpp
diff --git a/libcxx/benchmarks/numeric/gcd.bench.cpp b/libcxx/test/benchmarks/numeric/gcd.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/numeric/gcd.bench.cpp
rename to libcxx/test/benchmarks/numeric/gcd.bench.cpp
diff --git a/libcxx/benchmarks/ordered_set.bench.cpp b/libcxx/test/benchmarks/ordered_set.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/ordered_set.bench.cpp
rename to libcxx/test/benchmarks/ordered_set.bench.cpp
diff --git a/libcxx/benchmarks/random.bench.cpp b/libcxx/test/benchmarks/random.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/random.bench.cpp
rename to libcxx/test/benchmarks/random.bench.cpp
diff --git a/libcxx/benchmarks/shared_mutex_vs_mutex.bench.cpp b/libcxx/test/benchmarks/shared_mutex_vs_mutex.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/shared_mutex_vs_mutex.bench.cpp
rename to libcxx/test/benchmarks/shared_mutex_vs_mutex.bench.cpp
diff --git a/libcxx/benchmarks/std_format_spec_string_unicode.bench.cpp b/libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/std_format_spec_string_unicode.bench.cpp
rename to libcxx/test/benchmarks/std_format_spec_string_unicode.bench.cpp
diff --git a/libcxx/benchmarks/std_format_spec_string_unicode_escape.bench.cpp b/libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
rename to libcxx/test/benchmarks/std_format_spec_string_unicode_escape.bench.cpp
diff --git a/libcxx/benchmarks/stop_token.bench.cpp b/libcxx/test/benchmarks/stop_token.bench.cpp
similarity index 100%
rename from libcxx/benchmarks/stop_token.bench.cpp
rename to libcxx/test/benchmarks/stop_token.bench.cpp
diff --git a/libcxx/benchmarks/string.bench.cpp b/l...
[truncated]

This is an intermediate and fairly mechanical step towards unifying the
benchmarks with the rest of the test suite. Moving this around requires
a few changes, notably making sure we don't throw a wrench into the
discovery process of the normal test suite. This won't be a problem
anymore once benchmarks are taken into account by the test setup out
of the box.
@ldionne ldionne force-pushed the review/benchmarks-2-move-into-test-dir branch from 87e5c90 to 5dc852c Compare July 31, 2024 15:17
@ldionne ldionne merged commit 78b4b5c into llvm:main Jul 31, 2024
10 of 12 checks passed
@ldionne ldionne deleted the review/benchmarks-2-move-into-test-dir branch July 31, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants