<commit_before># ~~~
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ~~~

include(EnableClangTidy)
include(EnableWerror)
include(GoogleCloudCppSpannerFunctions)

function (spanner_client_define_benchmarks)
    # Find out if the platform supports getrusage(). Note that the Bazel builds
    # do not test for this, and therefore the feature is *not* used for any
    # Bazel-based build.
    include(CheckCXXSymbolExists)
    check_cxx_symbol_exists(getrusage sys/resource.h
                            GOOGLE_CLOUD_CPP_HAVE_GETRUSAGE)
    check_cxx_symbol_exists(RUSAGE_THREAD sys/resource.h
                            GOOGLE_CLOUD_CPP_HAVE_RUSAGE_THREAD)
    add_library(getrusage_flags INTERFACE)
    target_compile_definitions(
        getrusage_flags
        INTERFACE
        GOOGLE_CLOUD_CPP_HAVE_GETRUSAGE=$<BOOL:${GOOGLE_CLOUD_CPP_HAVE_GETRUSAGE}>
        GOOGLE_CLOUD_CPP_HAVE_RUSAGE_THREAD=$<BOOL:${GOOGLE_CLOUD_CPP_HAVE_RUSAGE_THREAD}>
    )

    set(spanner_client_benchmarks
        # cmake-format: sortable
        single_row_throughput_benchmark.cc single_row_cpu_benchmark.cc
        throughput_benchmark.cc)

    # Export the list of unit tests to a .bzl file so we do not need to maintain
    # the list in two places.
    export_list_to_bazel("spanner_client_benchmarks.bzl"
                         "spanner_client_benchmarks")

    # Generate a target for each benchmark.
    foreach (fname ${spanner_client_integration_tests})
        google_cloud_cpp_test_name_to_target(target "${fname}")
        add_executable(${target} ${fname})
        target_link_libraries(
            ${target}
            PRIVATE googleapis-c++::spanner_client
                    getrusage_flags
                    spanner_client_testing
                    google_cloud_cpp_testing
                    GTest::gmock_main
                    GTest::gmock
                    GTest::gtest)
        google_cloud_cpp_add_clang_tidy(${target})<commit_msg>bug: fix list of benchmarks in build (#1044)<commit_after># ~~~
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ~~~

include(EnableClangTidy)
include(EnableWerror)
include(GoogleCloudCppSpannerFunctions)

function (spanner_client_define_benchmarks)
    # Find out if the platform supports getrusage(). Note that the Bazel builds
    # do not test for this, and therefore the feature is *not* used for any
    # Bazel-based build.
    include(CheckCXXSymbolExists)
    check_cxx_symbol_exists(getrusage sys/resource.h
                            GOOGLE_CLOUD_CPP_HAVE_GETRUSAGE)
    check_cxx_symbol_exists(RUSAGE_THREAD sys/resource.h
                            GOOGLE_CLOUD_CPP_HAVE_RUSAGE_THREAD)
    add_library(getrusage_flags INTERFACE)
    target_compile_definitions(
        getrusage_flags
        INTERFACE
        GOOGLE_CLOUD_CPP_HAVE_GETRUSAGE=$<BOOL:${GOOGLE_CLOUD_CPP_HAVE_GETRUSAGE}>
        GOOGLE_CLOUD_CPP_HAVE_RUSAGE_THREAD=$<BOOL:${GOOGLE_CLOUD_CPP_HAVE_RUSAGE_THREAD}>
    )

    set(spanner_client_benchmarks
        # cmake-format: sortable
        single_row_throughput_benchmark.cc single_row_cpu_benchmark.cc
        throughput_benchmark.cc)

    # Export the list of unit tests to a .bzl file so we do not need to maintain
    # the list in two places.
    export_list_to_bazel("spanner_client_benchmarks.bzl"
                         "spanner_client_benchmarks")

    # Generate a target for each benchmark.
    foreach (fname ${spanner_client_benchmarks})
        google_cloud_cpp_test_name_to_target(target "${fname}")
        add_executable(${target} ${fname})
        target_link_libraries(
            ${target}
            PRIVATE googleapis-c++::spanner_client
                    getrusage_flags
                    spanner_client_testing
                    google_cloud_cpp_testing
                    GTest::gmock_main
                    GTest::gmock
                    GTest::gtest)
        google_cloud_cpp_add_clang_tidy(${target})
{'fraction_non_alphanumeric': 0.06460674157303371, 'fraction_numerical': 0.0040128410914927765, 'mean_word_length': 3.0136876006441224, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5003558', 'n_tokens_mistral': 1516, 'n_tokens_neox': 1449, 'n_words': 374}