aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/testing/gbenchmark
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2023-06-08 13:56:44 +0300
committerthegeorg <thegeorg@yandex-team.com>2023-06-08 13:56:44 +0300
commit40479c2d3d1e9bd3eb213aba537570d28d37d8a2 (patch)
tree9a275dff7a8b4b20f6c7f33022a7ef800d7a4063 /library/cpp/testing/gbenchmark
parent74801b5fa21692b9fce51b8096694453568cbf8a (diff)
downloadydb-40479c2d3d1e9bd3eb213aba537570d28d37d8a2.tar.gz
Restrict direct usages of google benchmarking library
Forbid PEERDIR-ing Google Benchmark from modules other than G_BENCHMARK.
Diffstat (limited to 'library/cpp/testing/gbenchmark')
-rw-r--r--library/cpp/testing/gbenchmark/CMakeLists.darwin-x86_64.txt19
-rw-r--r--library/cpp/testing/gbenchmark/CMakeLists.linux-aarch64.txt20
-rw-r--r--library/cpp/testing/gbenchmark/CMakeLists.linux-x86_64.txt20
-rw-r--r--library/cpp/testing/gbenchmark/CMakeLists.txt17
-rw-r--r--library/cpp/testing/gbenchmark/CMakeLists.windows-x86_64.txt19
-rw-r--r--library/cpp/testing/gbenchmark/benchmark.h3
-rw-r--r--library/cpp/testing/gbenchmark/main.cpp16
7 files changed, 114 insertions, 0 deletions
diff --git a/library/cpp/testing/gbenchmark/CMakeLists.darwin-x86_64.txt b/library/cpp/testing/gbenchmark/CMakeLists.darwin-x86_64.txt
new file mode 100644
index 00000000000..6b4fdb826d8
--- /dev/null
+++ b/library/cpp/testing/gbenchmark/CMakeLists.darwin-x86_64.txt
@@ -0,0 +1,19 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(cpp-testing-gbenchmark)
+target_link_libraries(cpp-testing-gbenchmark PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ restricted-google-benchmark
+ cpp-testing-hook
+)
+target_sources(cpp-testing-gbenchmark PRIVATE
+ ${CMAKE_SOURCE_DIR}/library/cpp/testing/gbenchmark/main.cpp
+)
diff --git a/library/cpp/testing/gbenchmark/CMakeLists.linux-aarch64.txt b/library/cpp/testing/gbenchmark/CMakeLists.linux-aarch64.txt
new file mode 100644
index 00000000000..f3cdb5fbc1e
--- /dev/null
+++ b/library/cpp/testing/gbenchmark/CMakeLists.linux-aarch64.txt
@@ -0,0 +1,20 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(cpp-testing-gbenchmark)
+target_link_libraries(cpp-testing-gbenchmark PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ restricted-google-benchmark
+ cpp-testing-hook
+)
+target_sources(cpp-testing-gbenchmark PRIVATE
+ ${CMAKE_SOURCE_DIR}/library/cpp/testing/gbenchmark/main.cpp
+)
diff --git a/library/cpp/testing/gbenchmark/CMakeLists.linux-x86_64.txt b/library/cpp/testing/gbenchmark/CMakeLists.linux-x86_64.txt
new file mode 100644
index 00000000000..f3cdb5fbc1e
--- /dev/null
+++ b/library/cpp/testing/gbenchmark/CMakeLists.linux-x86_64.txt
@@ -0,0 +1,20 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(cpp-testing-gbenchmark)
+target_link_libraries(cpp-testing-gbenchmark PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ restricted-google-benchmark
+ cpp-testing-hook
+)
+target_sources(cpp-testing-gbenchmark PRIVATE
+ ${CMAKE_SOURCE_DIR}/library/cpp/testing/gbenchmark/main.cpp
+)
diff --git a/library/cpp/testing/gbenchmark/CMakeLists.txt b/library/cpp/testing/gbenchmark/CMakeLists.txt
new file mode 100644
index 00000000000..f8b31df0c11
--- /dev/null
+++ b/library/cpp/testing/gbenchmark/CMakeLists.txt
@@ -0,0 +1,17 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-aarch64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ include(CMakeLists.darwin-x86_64.txt)
+elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA)
+ include(CMakeLists.windows-x86_64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-x86_64.txt)
+endif()
diff --git a/library/cpp/testing/gbenchmark/CMakeLists.windows-x86_64.txt b/library/cpp/testing/gbenchmark/CMakeLists.windows-x86_64.txt
new file mode 100644
index 00000000000..6b4fdb826d8
--- /dev/null
+++ b/library/cpp/testing/gbenchmark/CMakeLists.windows-x86_64.txt
@@ -0,0 +1,19 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(cpp-testing-gbenchmark)
+target_link_libraries(cpp-testing-gbenchmark PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ restricted-google-benchmark
+ cpp-testing-hook
+)
+target_sources(cpp-testing-gbenchmark PRIVATE
+ ${CMAKE_SOURCE_DIR}/library/cpp/testing/gbenchmark/main.cpp
+)
diff --git a/library/cpp/testing/gbenchmark/benchmark.h b/library/cpp/testing/gbenchmark/benchmark.h
new file mode 100644
index 00000000000..b7be8ef5336
--- /dev/null
+++ b/library/cpp/testing/gbenchmark/benchmark.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#include <contrib/restricted/google/benchmark/include/benchmark/benchmark.h>
diff --git a/library/cpp/testing/gbenchmark/main.cpp b/library/cpp/testing/gbenchmark/main.cpp
new file mode 100644
index 00000000000..523d18901a0
--- /dev/null
+++ b/library/cpp/testing/gbenchmark/main.cpp
@@ -0,0 +1,16 @@
+#include <benchmark/benchmark.h>
+
+#include <library/cpp/testing/hook/hook.h>
+#include <util/generic/scope.h>
+
+int main(int argc, char** argv) {
+ NTesting::THook::CallBeforeInit();
+ ::benchmark::Initialize(&argc, argv);
+ if (::benchmark::ReportUnrecognizedArguments(argc, argv)) {
+ return 1;
+ }
+ NTesting::THook::CallBeforeRun();
+ Y_DEFER { NTesting::THook::CallAfterRun(); };
+ ::benchmark::RunSpecifiedBenchmarks();
+ return 0;
+}