Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::test::anonymous_namespace{testinit.cpp}::TestProgramContext Class Reference
+ Inheritance diagram for gmx::test::anonymous_namespace{testinit.cpp}::TestProgramContext:
+ Collaboration diagram for gmx::test::anonymous_namespace{testinit.cpp}::TestProgramContext:

Description

Custom program context for test binaries.

This context overrides the installationPrefix() implementation to always load data files from the source directory, as the test binaries are never installed. It also support overriding the directory through a command-line option to the test binary.

Public Member Functions

 TestProgramContext (const IProgramContext &context)
 Initializes a test program context. More...
 
void overrideSourceRoot (const std::string &sourceRoot)
 Sets the source directory root from which to look for data files.
 
const char * programName () const override
 Returns the name of the binary as it was invoked without any path. More...
 
const char * displayName () const override
 Returns a display name for the program. More...
 
const char * fullBinaryPath () const override
 Returns the full path of the running binary. More...
 
InstallationPrefixInfo installationPrefix () const override
 Returns the installation prefix for GROMACS. More...
 
const char * commandLine () const override
 Returns the full command line used to invoke the binary. More...
 

Constructor & Destructor Documentation

gmx::test::anonymous_namespace{testinit.cpp}::TestProgramContext::TestProgramContext ( const IProgramContext context)
inlineexplicit

Initializes a test program context.

Parameters
[in]contextCurrent GROMACS program context.

Member Function Documentation

const char* gmx::test::anonymous_namespace{testinit.cpp}::TestProgramContext::commandLine ( ) const
inlineoverridevirtual

Returns the full command line used to invoke the binary.

The implementation can provide an empty string if no command line is available.

Implements gmx::IProgramContext.

const char* gmx::test::anonymous_namespace{testinit.cpp}::TestProgramContext::displayName ( ) const
inlineoverridevirtual

Returns a display name for the program.

For simple programs, this can equal programName(). For the GROMACS gmx wrapper binary, this includes the name of the module (e.g., gmx angle). This is used only for informational purposes, and there are no constraints on contents, except that it should not be NULL.

Implements gmx::IProgramContext.

const char* gmx::test::anonymous_namespace{testinit.cpp}::TestProgramContext::fullBinaryPath ( ) const
inlineoverridevirtual

Returns the full path of the running binary.

This is mainly used for informational purposes. There are no constraints on contents, except that it should not be NULL. Currently, this is also used for sanity checks in checkpointing.

The implementation can provide an empty string if the path to the binary is not available. In such a case, the information is not shown.

Implements gmx::IProgramContext.

InstallationPrefixInfo gmx::test::anonymous_namespace{testinit.cpp}::TestProgramContext::installationPrefix ( ) const
inlineoverridevirtual

Returns the installation prefix for GROMACS.

This path is used to locate the data files that are in share/top/ in the source directory. The implementation can provide an empty string if the path is not available; in such a case, functions that require data files may fail.

The returned structure also contains a flag to indicate whether the prefix actually points to the source tree. This is used for tests and to support running binaries directly from the build tree.

Implements gmx::IProgramContext.

const char* gmx::test::anonymous_namespace{testinit.cpp}::TestProgramContext::programName ( ) const
inlineoverridevirtual

Returns the name of the binary as it was invoked without any path.

This is typically argv[0] with any leading directory stripped. Currently, this should be a valid file name.

Implements gmx::IProgramContext.


The documentation for this class was generated from the following file: