Skip to content

Commit

Permalink
chore(ci): fix compilation for benchmark and fuzz targets (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmehala authored Aug 27, 2024
1 parent 8e11e46 commit 3e0244f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
12 changes: 11 additions & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@ set(BENCHMARK_DOWNLOAD_DEPENDENCIES ON)
set(BENCHMARK_ENABLE_TESTING OFF)
add_subdirectory(google-benchmark)

target_link_libraries(dd_trace_cpp-benchmark benchmark::benchmark dd_trace_cpp-static)
target_include_directories(dd_trace_cpp-benchmark
PRIVATE
${CMAKE_SOURCE_DIR}/src
)

target_link_libraries(dd_trace_cpp-benchmark
PRIVATE
benchmark::benchmark
dd_trace::static
nlohmann_json::nlohmann_json
)
4 changes: 1 addition & 3 deletions benchmark/benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
#include <datadog/logger.h>
#include <datadog/span_data.h>
#include <datadog/tracer.h>
#include <datadog/tracer_config.h>

#include <datadog/json.hpp>
#include <memory>

#include "hasher.h"
Expand Down Expand Up @@ -34,7 +32,7 @@ struct SerializingCollector : public dd::Collector {
}

std::string config() const override {
return nlohmann::json::object({{"type", "SerializingCollector"}}).dump();
return R"({"type": "SerializingCollector"})";
}
};

Expand Down
5 changes: 2 additions & 3 deletions benchmark/hasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "hasher.h"

#include <datadog/span_config.h>
#include <datadog/tags.h>
#include <datadog/tracer.h>
#include <datadog/tracer_config.h>

Expand Down Expand Up @@ -97,8 +96,8 @@ int sha256_traced(Digest &digest, const fs::path &path,
Digest hash;
const fs::path &child = entry;
if (sha256_traced(hash, child, span)) {
span.set_error_message(
"unable to calculate digest of " + child.u8string());
span.set_error_message("unable to calculate digest of " +
child.u8string());
return 1;
}
children.emplace_back(child, hash);
Expand Down
6 changes: 6 additions & 0 deletions fuzz/base64/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
add_executable(base64-fuzz main.cpp)

add_dependencies(base64-fuzz dd_trace_cpp-static)

target_include_directories(base64-fuzz
PRIVATE
${CMAKE_SOURCE_DIR}/src
)

target_link_libraries(base64-fuzz dd_trace_cpp-static)

add_target_to_group(base64-fuzz dd_trace_cpp-fuzzers)
5 changes: 5 additions & 0 deletions fuzz/w3c-propagation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
add_executable(w3c-propagation-fuzz fuzz.cpp)

add_dependencies(w3c-propagation-fuzz dd_trace_cpp-static)

target_include_directories(w3c-propagation-fuzz
PRIVATE
${CMAKE_SOURCE_DIR}/src
)
target_link_libraries(w3c-propagation-fuzz dd_trace_cpp-static)

add_target_to_group(w3c-propagation-fuzz dd_trace_cpp-fuzzers)

0 comments on commit 3e0244f

Please sign in to comment.