Gromacs  2026.0-dev-20250716-4416ebe
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions | Variables
gmx::test::anonymous_namespace{refdata.cpp} Namespace Reference

Classes

class  ReferenceDataTestEventListener
 Class that connects GoogleTest success/failure to reference-data handling. More...
 

Typedefs

typedef std::shared_ptr
< internal::TestReferenceDataImpl
TestReferenceDataImplPointer
 Convenience typedef for a smart pointer to TestReferenceDataImpl.
 

Functions

TestReferenceDataImplPointer initReferenceDataInstance (const std::optional< std::filesystem::path > &testNameOverride)
 Returns a reference to the global reference data object.
 
TestReferenceDataImplPointer initReferenceDataInstance (const std::optional< std::filesystem::path > &testNameOverride, const int rank)
 Returns a reference to the global reference data object for MPI rank rank with a custom test name.
 
TestReferenceDataImplPointer initReferenceDataInstance (const int rank)
 Returns a reference to the global reference data object for MPI rank rank.
 
TestReferenceDataImplPointer initReferenceDataInstanceForSelfTest (ReferenceDataMode mode)
 Handles reference data creation for self tests.
 
std::string formatEntryPath (const std::string &prefix, const std::string &id)
 Formats a path to a reference data entry with a non-null id.
 
std::string formatSequenceEntryPath (const std::string &prefix, int seqIndex)
 Formats a path to a reference data entry with a null id.
 
void gatherUnusedEntries (const ReferenceDataEntry &root, const std::string &rootPath, std::vector< std::string > *unusedPaths)
 Finds all entries that have not been checked under a given root.
 
void checkUnusedEntries (const ReferenceDataEntry &root, const std::string &rootPath)
 Produces a GTest assertion of any entries under given root have not been checked.
 

Variables

std::mutex g_referenceDataMutex
 Provide mutual exclusion in thread-MPI build configurations.
 
std::unordered_map< int,
TestReferenceDataImplPointer
g_referenceData
 Global reference data instances, one per MPI rank running the test binary. More...
 
ReferenceDataMode g_referenceDataMode = ReferenceDataMode::Compare
 Global reference data mode set by the -ref-data command-line option.
 

Variable Documentation

std::unordered_map<int, TestReferenceDataImplPointer> gmx::test::anonymous_namespace{refdata.cpp}::g_referenceData

Global reference data instances, one per MPI rank running the test binary.

The instances are created when the test creates a TestReferenceData, and destructed (and other post-processing is done) at the end of each test by ReferenceDataTestEventListener (which is installed as a Google Test test listener).

With thread-MPI (or no MPI), one internal::TestReferenceDataImpl object is created per rank. When using multiple ranks, the expectation is that each rank uses only the reference data that corresponds to itself, but this is not enforced.

With library MPI, only the element corresponding to this rank is populated. Because each rank is a different process, ranks cannot see test reference data corresponding to other ranks.