Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ option(ENABLE_TSAN "Enable Thread Sanitizer" OFF)
option(ENABLE_ASAN "Enable Address Sanitizer" OFF)
option(PHLEX_USE_FORM "Enable experimental integration with FORM" OFF)
option(ENABLE_COVERAGE "Enable code coverage instrumentation" OFF)
option(ENABLE_CLANG_TIDY "Enable clang-tidy checks during build" OFF)

add_compile_options(
-Wall
Expand Down Expand Up @@ -163,22 +162,6 @@ if(ENABLE_COVERAGE)
endif()
endif()

# Configure clang-tidy integration
find_program(CLANG_TIDY_EXECUTABLE NAMES clang-tidy-20 clang-tidy)

if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXECUTABLE)
message(STATUS "Found clang-tidy: ${CLANG_TIDY_EXECUTABLE}")
set(
CMAKE_CXX_CLANG_TIDY
${CLANG_TIDY_EXECUTABLE}
--config-file=${CMAKE_SOURCE_DIR}/.clang-tidy
)
else()
message(WARNING "clang-tidy not found, disabling clang-tidy checks")
endif()
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type" FORCE)
endif()
Expand All @@ -202,10 +185,4 @@ if(BUILD_TESTING)
endif()
endif()

# Report clang-tidy availability
if(CLANG_TIDY_EXECUTABLE)
message(STATUS "Clang-tidy available: ${CLANG_TIDY_EXECUTABLE}")
message(STATUS "Use -DCMAKE_CXX_CLANG_TIDY=clang-tidy to enable automatic checks during build")
endif()

cet_cmake_config()
4 changes: 3 additions & 1 deletion phlex/app/load_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ namespace phlex::experimental {
template <typename creator_t>
std::function<creator_t> plugin_loader(std::string const& spec, std::string const& symbol_name)
{
char const* plugin_path_ptr = std::getenv("PHLEX_PLUGIN_PATH");
// Called during single-threaded graph construction
char const* plugin_path_ptr =
std::getenv("PHLEX_PLUGIN_PATH"); // NOLINT(concurrency-mt-unsafe)
if (!plugin_path_ptr)
throw std::runtime_error("PHLEX_PLUGIN_PATH has not been set.");

Expand Down
4 changes: 2 additions & 2 deletions test/form/toy_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ std::vector<TrackStart> ToyTracker::operator()()
int32_t ToyTracker::generateRandom()
{
//Get a 32-bit random integer with even the lowest allowed precision of rand()
int rand1 = rand() % 32768;
int rand2 = rand() % 32768;
int rand1 = rand() % 32768; // NOLINT(concurrency-mt-unsafe) - Test code, single-threaded
int rand2 = rand() % 32768; // NOLINT(concurrency-mt-unsafe) - Test code, single-threaded
return (rand1 * 32768 + rand2);
}
8 changes: 4 additions & 4 deletions test/form/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ static char const* const seg_id = "[EVENT=%08X;SEG=%08X]";

void generate(std::vector<float>& vrand, int size)
{
int rand1 = rand() % 32768;
int rand2 = rand() % 32768;
int rand1 = rand() % 32768; // NOLINT(concurrency-mt-unsafe) - Single-threaded test
int rand2 = rand() % 32768; // NOLINT(concurrency-mt-unsafe) - Single-threaded test
int npx = (rand1 * 32768 + rand2) % size;
for (int nelement = 0; nelement < npx; ++nelement) {
int rand1 = rand() % 32768;
int rand2 = rand() % 32768;
int rand1 = rand() % 32768; // NOLINT(concurrency-mt-unsafe) - Single-threaded test
int rand2 = rand() % 32768; // NOLINT(concurrency-mt-unsafe) - Single-threaded test
float random = float(rand1 * 32768 + rand2) / (32768 * 32768);
vrand.push_back(random);
}
Expand Down
17 changes: 6 additions & 11 deletions test/hierarchical_nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include "spdlog/spdlog.h"

#include <atomic>
#include <chrono>
#include <cmath>
#include <ctime>
#include <string>

using namespace phlex;
Expand Down Expand Up @@ -64,19 +64,14 @@ namespace {
return std::sqrt(static_cast<double>(data.total) / data.number);
}

std::string strtime(std::time_t tm)
std::string strtime(std::chrono::system_clock::time_point tp)
{
char buffer[32];
std::strncpy(buffer, std::ctime(&tm), 26);
return buffer;
return fmt::format("{:%a %b %d %H:%M:%S %Y}", tp);
}

void print_result(handle<double> result, std::string const& stringized_time)
{
spdlog::debug("{}: {} @ {}",
result.data_cell_index().to_string(),
*result,
stringized_time.substr(0, stringized_time.find('\n')));
spdlog::debug("{}: {} @ {}", result.data_cell_index().to_string(), *result, stringized_time);
}
}

Expand All @@ -89,9 +84,9 @@ TEST_CASE("Hierarchical nodes", "[graph]")
experimental::framework_graph g{driver_for_test(gen)};

g.provide("provide_time",
[](data_cell_index const& index) -> std::time_t {
[](data_cell_index const& index) {
spdlog::info("Providing time for {}", index.to_string());
return std::time(nullptr);
return std::chrono::system_clock::now();
})
.output_product(product_query{.creator = "input"_id, .layer = "run"_id, .suffix = "time"_id});

Expand Down
Loading