From 7bab764b2e06f14c4a0e04282684e58e05e055df Mon Sep 17 00:00:00 2001 From: Vincenzo Eduardo Padulano Date: Wed, 5 Aug 2026 11:31:06 +0200 Subject: [PATCH] [io] Add gtest-based cpp11Containers unordered_map test This is a re-write of the cpp11Containers-unorderedMap test as a compiled C++ program based on gtest. Given the recent intermittent CI failures, the new test could help identify in a more fine-grained way the root cause. It is an addition rather than a substitution because there is no guarantee that the cause of the CI failure is in the test itself. --- .../root/io/cpp11Containers/CMakeLists.txt | 13 + .../cpp11Containers/unorderedMapUnitTests.cxx | 365 ++++++++++++++++++ 2 files changed, 378 insertions(+) create mode 100644 roottest/root/io/cpp11Containers/unorderedMapUnitTests.cxx diff --git a/roottest/root/io/cpp11Containers/CMakeLists.txt b/roottest/root/io/cpp11Containers/CMakeLists.txt index 086779fa44b5a..d3bf41d3c0713 100644 --- a/roottest/root/io/cpp11Containers/CMakeLists.txt +++ b/roottest/root/io/cpp11Containers/CMakeLists.txt @@ -10,6 +10,19 @@ ROOTTEST_ADD_TEST(unorderedMap FIXTURES_SETUP root-io-cpp11Containers-unorderedMap-fixture LABELS longtest) +# Copy of the test above, written as a compiled C++ program based on gtest. Useful for more fine-grained view on +# potential test failures +ROOTTEST_GENERATE_EXECUTABLE( + unorderedMapUnitTests + unorderedMapUnitTests.cxx + LIBRARIES Core RIO Tree TreePlayer Hist GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main ROOT::TestSupport + FIXTURES_REQUIRED root-io-cpp11Containers-unorderedMapDict-fixture + FIXTURES_SETUP root-io-cpp11Containers-unorderedMapUnitTests-fixture) + +ROOTTEST_ADD_TEST(unorderedMapUnitTests + EXEC ${CMAKE_CURRENT_BINARY_DIR}/unorderedMapUnitTests + FIXTURES_REQUIRED root-io-cpp11Containers-unorderedMapUnitTests-fixture) + if(NOT 32BIT AND NOT MSVC) ROOTTEST_GENERATE_REFLEX_DICTIONARY(forwardList forwardList.h diff --git a/roottest/root/io/cpp11Containers/unorderedMapUnitTests.cxx b/roottest/root/io/cpp11Containers/unorderedMapUnitTests.cxx new file mode 100644 index 0000000000000..714f15c7a789f --- /dev/null +++ b/roottest/root/io/cpp11Containers/unorderedMapUnitTests.cxx @@ -0,0 +1,365 @@ +// Test the usage of different instantiations of std::map, std::multimap, std::unordered_map, std::unordered_multimap +// Each container has a dictionary generated via an XML selection file +// We test storage of each container as: +// * A whole object written directly to a TFile +// * An unsplit branch in a TTree +// * A split branch in a TTree + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +// Test fixture based on different container types and key types + +// Wrapper type used to instantiate pairs of concrete types to use in the +// TYPED_TEST_SUITE macro call +template