Gromacs  2016.6
 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.
 
virtual const char * programName () const
 Returns the name of the binary as it was invoked without any path. More...
 
virtual const char * displayName () const
 Returns a display name for the program. More...
 
virtual const char * fullBinaryPath () const
 Returns the full path of the running binary. More...
 
virtual InstallationPrefixInfo installationPrefix () const
 Returns the installation prefix for GROMACS. More...
 
virtual const char * commandLine () const
 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

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

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.

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

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.

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

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.

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

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.

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

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: