From e33fdf6c67a95589cb217db9b5672d3c6205126e Mon Sep 17 00:00:00 2001 From: Jon Zarling Date: Tue, 30 Sep 2025 11:18:38 -0500 Subject: [PATCH] Fix C++ test's output directory, now github CI should work again --- CMakeLists.txt | 2 +- README.md | 2 +- src/test/cpp/EvioTestHelper.h | 2 +- src/test/cpp/EvioWriteAndReadBack_builder.cpp | 10 ++++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ab9347f0..d17285ce4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,7 +294,7 @@ install( ) # Unit testing setup -add_test(NAME EvioWriteAndReadBack_builder COMMAND bin/EvioWriteAndReadBack_builder 10) +add_test(NAME EvioWriteAndReadBack_builder COMMAND bin/EvioWriteAndReadBack_builder 10 ${CMAKE_CURRENT_SOURCE_DIR}/etc/test_files) # Uninstall target # Removed for now, not yet compatible with building disruptor-cpp internally diff --git a/README.md b/README.md index 325837497..6a1a2fbba 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The C and C++ libraries are build using `cmake`. To build C/C++ code from this r git clone https://github.com/JeffersonLab/evio/ cd evio; mkdir build - cmake -S . -B build + cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build --target install --parallel Note that during the cmake configure step (first of two `cmake` commands above), one can also include the following special flags: diff --git a/src/test/cpp/EvioTestHelper.h b/src/test/cpp/EvioTestHelper.h index 347938eae..488e4c4f6 100644 --- a/src/test/cpp/EvioTestHelper.h +++ b/src/test/cpp/EvioTestHelper.h @@ -125,7 +125,7 @@ using namespace evio; std::string baseNameV4 = "testEventsV4_cppAPI.evio"; // base name of file to be created. If split > 1, this is the base name of all files created. If split < 1, this is the name of the only file created. std::string baseNameV6 = "testEventsV6_cppAPI.evio"; // base name of file to be created. If split > 1, this is the base name of all files created. If split < 1, this is the name of the only file created. std::string baseNameHIPO = "testEventsHIPO_cppAPI.hipo"; // base name of file to be created. If split > 1, this is the base name of all files created. If split < 1, this is the name of the only file created. - std::string directory = "etc/test_files"; // directory in which file is to be placed + std::string directory = ""; // directory in which file is to be placed private: diff --git a/src/test/cpp/EvioWriteAndReadBack_builder.cpp b/src/test/cpp/EvioWriteAndReadBack_builder.cpp index ae1f34341..9d0de0277 100644 --- a/src/test/cpp/EvioWriteAndReadBack_builder.cpp +++ b/src/test/cpp/EvioWriteAndReadBack_builder.cpp @@ -8,18 +8,20 @@ void evioReadStep(std::string filename); int main(int argc, char* argv[]) { // Boilerplate - if (argc != 2) { + if (argc != 2 && argc != 3) { std::cerr << "Usage: " << argv[0] << " \n"; return 1; } int nEvents = std::stoi(argv[1]); - std::cout << "Writing " << nEvents << " events to files..." << std::endl; EvioTestHelper* evioHelperObj = new EvioTestHelper(); - + if (argc == 3) evioHelperObj->directory = argv[2]; + // std::shared_ptr writerV4 = evioHelperObj->defaultEventWriterV4(); std::shared_ptr writerV6 = evioHelperObj->defaultEventWriter(); // std::shared_ptr writerHipo = evioHelperObj->defaultEventWriterHIPO(); - + + std::cout << "Writing " << nEvents << " events to files..." << std::endl; + for (int i = 0; i < nEvents; ++i) { // Build a new event (top-level bank) with tag=1, type=BANK, num=1