NCBI C++ ToolKit
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
CNcbiTestApplication Class Reference

Search Toolkit Book for CNcbiTestApplication

Application for all unit tests. More...

+ Inheritance diagram for CNcbiTestApplication:
+ Collaboration diagram for CNcbiTestApplication:

Public Member Functions

 CNcbiTestApplication (void)
 
 ~CNcbiTestApplication (void)
 
virtual void Init (void)
 Initialize the application. More...
 
virtual int Run (void)
 Run the application. More...
 
virtual int DryRun (void)
 Test run the application. More...
 
void AddUserFunction (TNcbiTestUserFunction func, ETestUserFuncType func_type)
 Add user function. More...
 
void AddTestDependsOn (but::test_unit *tu, but::test_unit *dep_tu)
 Add dependency for test unit. More...
 
void SetTestDisabled (but::test_unit *tu)
 Set test as disabled by user. More...
 
void SetGloballyDisabled (void)
 Set flag that all tests globally disabled. More...
 
void SetGloballySkipped (void)
 Set flag that all tests globally skipped. More...
 
but::test_suite * InitTestFramework (int argc, char *argv[])
 Initialize this application, main test suite and all test framework. More...
 
CArgDescriptionsGetArgDescrs (void)
 Get object with argument descriptions. More...
 
CExprParserGetIniParser (void)
 Get parser evaluating configuration conditions. More...
 
void CollectTestUnit (but::test_unit *tu)
 Save test unit in the collection of all tests. More...
 
but::test_unit * GetTestUnit (CTempString test_name)
 Get pointer to test case or test suite by its name. More...
 
void InitTestsBeforeRun (void)
 Initialize already prepared test suite before running tests. More...
 
void FiniTestsAfterRun (void)
 Finalize test suite after running tests. More...
 
void ReEnableAllTests (void)
 Enable all necessary tests after execution but before printing report. More...
 
void AdjustTestTimeout (but::test_unit *tu)
 Check the correct setting for unit timeout and check overall test timeout. More...
 
void SetTestTimedOut (but::test_case *tc)
 Mark test case as failed due to hit of the timeout. More...
 
void SetTestErrored (but::test_case *tc)
 Register the fact of test failure. More...
 
bool IsTestToFix (const but::test_unit *tu)
 Check if given test is marked as requiring fixing in the future. More...
 
int GetRanTestsCount (void)
 Get number of actually executed tests. More...
 
int GetToFixTestsCount (void)
 Get number of tests that were failed but are marked to be fixed. More...
 
string GetTestResultString (but::test_unit *tu)
 Get string representation of result of test execution. More...
 
but::test_case * GetDummyTest (void)
 Get pointer to empty test case added to Boost for internal purposes. More...
 
bool IsInitFailed (void)
 Check if user initialization functions failed. More...
 
bool HasTestErrors (void)
 Check if there were any test errors. More...
 
bool HasTestTimeouts (void)
 Check if there were any timeouted tests. More...
 
CNcbiRegistryGetTestRWConfig (void)
 Get the application's cached configuration parameters, accessible to read-write. More...
 
ostream & GetFreeformReportStream (void) const
 
- Public Member Functions inherited from CNcbiApplication
virtual ~CNcbiApplication (void)
 Destructor. More...
 
 CNcbiApplication (const SBuildInfo &build_info=NCBI_SBUILDINFO_DEFAULT())
 Constructor. More...
 
- Public Member Functions inherited from CNcbiApplicationAPI
 CNcbiApplicationAPI (const SBuildInfo &build_info)
 Constructor. More...
 
virtual ~CNcbiApplicationAPI (void)
 Destructor. More...
 
int AppMain (int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
 Main function (entry point) for the NCBI application. More...
 
virtual void Exit (void)
 Cleanup on application exit. More...
 
const CNcbiArgumentsGetArguments (void) const
 Get the application's cached unprocessed command-line arguments. More...
 
virtual const CArgsGetArgs (void) const
 Get parsed command line arguments. More...
 
const CNcbiEnvironmentGetEnvironment (void) const
 Get the application's cached environment. More...
 
CNcbiEnvironmentSetEnvironment (void)
 Get a non-const copy of the application's cached environment. More...
 
void SetEnvironment (const string &name, const string &value)
 Set a specified environment variable by name. More...
 
bool HasLoadedConfig (void) const
 Check if the config file has been loaded. More...
 
bool FinishedLoadingConfig (void) const
 Check if the application has finished loading config file (successfully or not). More...
 
const CNcbiRegistryGetConfig (void) const
 Get the application's cached configuration parameters (read-only). More...
 
CNcbiRegistryGetConfig (void)
 
const stringGetConfigPath (void) const
 Get the full path to the configuration file (if any) we ended up using. More...
 
bool ReloadConfig (CMetaRegistry::TFlags flags=CMetaRegistry::fReloadIfChanged, IRegistry::TFlags reg_flags=IRegistry::fWithNcbirc)
 Reload the configuration file. More...
 
SIZE_TYPE FlushDiag (CNcbiOstream *os, bool close_diag=false)
 Flush the in-memory diagnostic stream (for "eDS_ToMemory" case only). More...
 
const stringGetProgramDisplayName (void) const
 Get the application's "display" name. More...
 
const stringGetProgramExecutablePath (EFollowLinks follow_links=eIgnoreLinks) const
 Get the application's executable path. More...
 
CVersionInfo GetVersion (void) const
 Get the program version information. More...
 
const CVersionAPIGetFullVersion (void) const
 Get the program version information. More...
 
bool IsDryRun (void) const
 Check if it is a test run. More...
 
virtual bool SetupDiag_AppSpecific (void)
 Setup application specific diagnostic stream. More...
 
template<class TFunc >
void AddOnExitAction (TFunc func)
 Add callback to be executed from CNcbiApplicationAPI destructor. More...
 

Private Types

enum  ERunMode { fTestList = 0x1 , fDisabled = 0x2 , fInitFailed = 0x4 }
 Mode of running testing application. More...
 
typedef list< TNcbiTestUserFunctionTUserFuncsList
 
typedef unsigned int TRunMode
 

Private Member Functions

void x_SetupBoostReporters (void)
 Setup our own reporter for Boost.Test. More...
 
bool x_CallUserFuncs (ETestUserFuncType func_type)
 Call all user functions. More...
 
void x_EnsureAllDeps (void)
 Ensure that all dependencies stand earlier in tests tree than their dependents. More...
 
void x_ActualizeDeps (void)
 Set up real Boost.Test dependencies based on ones made by AddTestDependsOn(). More...
 
bool x_ReadConfiguration (void)
 Enable / disable tests based on application configuration file. More...
 
int x_GetEnabledTestsCount (void)
 Get number of tests which Boost will execute. More...
 
void x_AddDummyTest (void)
 Add empty test necesary for internal purposes. More...
 
void x_InitCommonParserVars (void)
 Initialize common for all tests parser variables (OS*, COMPILER* and DLL_BUILD) More...
 
string x_GetTrimmedTestName (const string &test_name)
 Apply standard trimmings to test name and return resultant test name which will identify test inside the framework. More...
 
void x_EnableAllTests (bool enable)
 Enable / disable all tests known to application. More...
 
void x_CollectAllTests ()
 Collect names and pointers to all tests existing in master test suite. More...
 
bool x_CalcConfigValue (const string &value)
 Calculate the value from configuration file. More...
 

Private Attributes

bool m_RunCalled
 If Run() was called or not. More...
 
TRunMode m_RunMode
 Mode of running the application. More...
 
TUserFuncsList m_UserFuncs [eTestUserFuncLast - eTestUserFuncFirst+1]
 Lists of all user-defined functions. More...
 
AutoPtr< CArgDescriptionsm_ArgDescrs
 Argument descriptions to be passed to SetArgDescriptions(). More...
 
AutoPtr< CExprParserm_IniParser
 Parser to evaluate expressions in configuration file. More...
 
TStringToUnitMap m_AllTests
 List of all test units mapped to their names. More...
 
TUnitsSet m_DisabledTests
 List of all disabled tests. More...
 
TUnitsSet m_TimedOutTests
 List of all tests which result is a timeout. More...
 
TUnitsSet m_ToFixTests
 List of all tests marked as in need of fixing in the future. More...
 
TUnitToManyMap m_TestDeps
 List of all dependencies for each test having dependencies. More...
 
CNcbiTestsObserver m_Observer
 Observer to make test dependencies and look for unit's timeouts. More...
 
CNcbiBoostReporterm_Reporter
 Boost reporter - must be pointer because Boost.Test calls free() on it. More...
 
CNcbiBoostLoggerm_Logger
 Boost logger - must be pointer because Boost.Test calls free() on it. More...
 
ofstream m_ReportOut
 Output stream for Boost.Test report. More...
 
CNcbiTestsTreeBuilder m_TreeBuilder
 Builder of internal accessible from library tests tree. More...
 
but::test_case * m_DummyTest
 Empty test case added to Boost for internal perposes. More...
 
double m_Timeout
 Timeout for the whole test. More...
 
string m_TimeoutStr
 String representation for whole test timeout (real value taken from CHECK_TIMEOUT in Makefile). More...
 
double m_TimeMult
 Multiplicator for timeouts. More...
 
CStopWatch m_Timer
 Timer measuring elapsed time for the whole test. More...
 
unsigned int m_CurUnitTimeout
 Timeout that was set in currently executing unit before adjustment. More...
 
bool m_HasTestErrors
 Flag showing if there were some test errors. More...
 
bool m_HasTestTimeouts
 Flag showing if there were some timeouted tests. More...
 

Additional Inherited Members

- Public Types inherited from CNcbiApplicationAPI
enum  EAppNameType { eBaseName , eFullName , eRealName }
 
- Static Public Member Functions inherited from CNcbiApplication
static CNcbiApplicationInstance (void)
 Singleton method. More...
 
- Static Public Member Functions inherited from CNcbiApplicationAPI
static CNcbiApplicationAPIInstance (void)
 Singleton method. More...
 
static CNcbiApplicationGuard InstanceGuard (void)
 Singleton method. More...
 
static SSystemMutex & GetInstanceMutex (void)
 Mutex for application singleton object. More...
 
static string GetAppName (EAppNameType name_type=eBaseName, int argc=0, const char *const *argv=NULL)
 
- Protected Types inherited from CNcbiApplicationAPI
enum  EPreparseArgs { ePreparse_Continue , ePreparse_Exit }
 Result of PreparseArgs() More...
 
enum  EDisableArgDesc { fDisableStdArgs = 0x01 }
 Disable argument descriptions. More...
 
enum  EHideStdArgs {
  fHideLogfile = CArgDescriptions::fHideLogfile , fHideConffile = CArgDescriptions::fHideConffile , fHideVersion = CArgDescriptions::fHideVersion , fHideFullVersion = CArgDescriptions::fHideFullVersion ,
  fHideDryRun = CArgDescriptions::fHideDryRun , fHideHelp = CArgDescriptions::fHideHelp , fHideFullHelp = CArgDescriptions::fHideFullHelp , fHideXmlHelp = CArgDescriptions::fHideXmlHelp ,
  fHideAll = CArgDescriptions::fHideAll
}
 Which standard flag's descriptions should not be displayed in the usage message. More...
 
enum  EStdioSetup {
  fNoSyncWithStdio = 0x01 , fDefault_CinBufferSize = 0x02 , fBinaryCin = 0x04 , fBinaryCout = 0x08 ,
  fDefault_SyncWithStdio = 0x00
}
 Flags to adjust standard I/O streams' behaviour. More...
 
enum  EExitMode { eNoExits , eExceptionalExits , eAllExits }
 When to return a user-set exit code. More...
 
enum  EAppFlags { fSkipSafeStaticDestroy = 1 << 0 }
 
typedef int TDisableArgDesc
 Binary OR of "EDisableArgDesc". More...
 
typedef int THideStdArgs
 Binary OR of "EHideStdArgs". More...
 
typedef int TStdioSetupFlags
 Binary OR of "EStdioSetup". More...
 
typedef int TAppFlags
 
- Protected Member Functions inherited from CNcbiApplicationAPI
virtual EPreparseArgs PreparseArgs (int argc, const char *const *argv)
 Check the command line arguments before parsing them. More...
 
void DisableArgDescriptions (TDisableArgDesc disable=fDisableStdArgs)
 
void HideStdArgs (THideStdArgs hide_mask)
 Set the hide mask for the Hide Std Flags. More...
 
void SetStdioFlags (TStdioSetupFlags stdio_flags)
 Adjust the behavior of standard I/O streams. More...
 
void SetVersion (const CVersionInfo &version)
 Set the version number for the program. More...
 
void SetVersion (const CVersionInfo &version, const SBuildInfo &build_info)
 
void SetVersionByBuild (int major)
 
void SetFullVersion (CRef< CVersionAPI > version)
 Set version data for the program. More...
 
virtual void SetupArgDescriptions (CArgDescriptions *arg_desc)
 Setup the command line argument descriptions. More...
 
const CArgDescriptionsGetArgDescriptions (void) const
 Get argument descriptions (set by SetupArgDescriptions) More...
 
bool SetupDiag (EAppDiagStream diag)
 Setup the application diagnostic stream. More...
 
virtual bool LoadConfig (CNcbiRegistry &reg, const string *conf, CNcbiRegistry::TFlags reg_flags)
 Load settings from the configuration file to the registry. More...
 
virtual bool LoadConfig (CNcbiRegistry &reg, const string *conf)
 Load settings from the configuration file to the registry. More...
 
CNcbiRegistryGetRWConfig (void)
 Get the application's cached configuration parameters, accessible for read-write for an application's internal use only. More...
 
void SetProgramDisplayName (const string &app_name)
 Set program's display name. More...
 
virtual void AppStart (void)
 Method to be called before application start. More...
 
virtual void AppStop (int exit_code)
 Method to be called before application exit. More...
 
void SetExitCode (int exit_code, EExitMode when=eExceptionalExits)
 Force the program to return a specific exit code later, either when it exits due to an exception or unconditionally. More...
 
void SetAppFlags (TAppFlags flags)
 
void ExecuteOnExitActions ()
 Should only be called from the destructors of classes derived from CNcbiApplicationAPI - if it is necessary to access their data members and virtual methods; or to dynamic_cast<> from the base app class. More...
 
void SetPhoneHomePolicy (IPhoneHomePolicy *policy, ENcbiOwnership ownership=eNoOwnership)
 Set Phone Home Policy. More...
 
IPhoneHomePolicyGetPhoneHomePolicy () const
 Return pointer to current Phone Home Policy or NULL. More...
 
- Static Protected Member Functions inherited from CNcbiApplicationAPI
static CRWLockGetInstanceLock (void)
 
static string FindProgramExecutablePath (int argc, const char *const *argv, string *real_path=0)
 Find the application's executable file. More...
 

Detailed Description

Application for all unit tests.

Definition at line 466 of file test_boost.cpp.

Member Typedef Documentation

◆ TRunMode

typedef unsigned int CNcbiTestApplication::TRunMode
private

Definition at line 582 of file test_boost.cpp.

◆ TUserFuncsList

Definition at line 540 of file test_boost.cpp.

Member Enumeration Documentation

◆ ERunMode

Mode of running testing application.

Enumerator
fTestList 

Only tests list is requested.

fDisabled 

All tests are disabled in configuration file.

fInitFailed 

Initialization user functions failed.

Definition at line 577 of file test_boost.cpp.

Constructor & Destructor Documentation

◆ CNcbiTestApplication()

CNcbiTestApplication::CNcbiTestApplication ( void  )
inline

Definition at line 938 of file test_boost.cpp.

References eStart, m_Logger, and m_Reporter.

◆ ~CNcbiTestApplication()

CNcbiTestApplication::~CNcbiTestApplication ( void  )

Definition at line 952 of file test_boost.cpp.

References m_ReportOut.

Member Function Documentation

◆ AddTestDependsOn()

void CNcbiTestApplication::AddTestDependsOn ( but::test_unit *  tu,
but::test_unit *  dep_tu 
)
inline

Add dependency for test unit.

Definition at line 1010 of file test_boost.cpp.

References map_checker< Container >::insert(), and m_TestDeps.

◆ AddUserFunction()

void CNcbiTestApplication::AddUserFunction ( TNcbiTestUserFunction  func,
ETestUserFuncType  func_type 
)
inline

Add user function.

Definition at line 1004 of file test_boost.cpp.

References m_UserFuncs.

◆ AdjustTestTimeout()

void CNcbiTestApplication::AdjustTestTimeout ( but::test_unit *  tu)

Check the correct setting for unit timeout and check overall test timeout.

Definition at line 1576 of file test_boost.cpp.

References CStopWatch::Elapsed(), env, int, m_CurUnitTimeout, m_TimeMult, m_Timeout, m_TimeoutStr, and m_Timer.

Referenced by CNcbiTestsObserver::test_unit_start().

◆ CollectTestUnit()

void CNcbiTestApplication::CollectTestUnit ( but::test_unit *  tu)
inline

Save test unit in the collection of all tests.

Definition at line 1066 of file test_boost.cpp.

References ERR_POST_X, Info(), NStr::IntToString(), kDummyTestCaseName, m_AllTests, test_name, and x_GetTrimmedTestName().

Referenced by CNcbiTestsCollector::test_suite_start(), and CNcbiTestsCollector::visit().

◆ DryRun()

int CNcbiTestApplication::DryRun ( void  )
virtual

Test run the application.

It is only supposed to test if the Run() is possible, or makes sense: that is, test all preconditions etc.

Returns
Exit code.

Reimplemented from CNcbiApplicationAPI.

Definition at line 995 of file test_boost.cpp.

References fTestList, m_RunCalled, and m_RunMode.

◆ FiniTestsAfterRun()

void CNcbiTestApplication::FiniTestsAfterRun ( void  )
inline

Finalize test suite after running tests.

Definition at line 1539 of file test_boost.cpp.

References CSafeStaticGuard::Destroy(), CSafeStaticLifeSpan::eLifeLevel_AppMain, eTestUserFuncFini, and x_CallUserFuncs().

Referenced by CNcbiTestsObserver::test_finish().

◆ GetArgDescrs()

CArgDescriptions * CNcbiTestApplication::GetArgDescrs ( void  )
inline

Get object with argument descriptions.

Return NULL if it is not right time to fill in descriptions.

Definition at line 1025 of file test_boost.cpp.

References AutoPtr< X, Del >::get(), and m_ArgDescrs.

◆ GetDummyTest()

but::test_case * CNcbiTestApplication::GetDummyTest ( void  )
inline

Get pointer to empty test case added to Boost for internal purposes.

Definition at line 1037 of file test_boost.cpp.

References m_DummyTest.

◆ GetFreeformReportStream()

ostream & CNcbiTestApplication::GetFreeformReportStream ( void  ) const
inline

Definition at line 1858 of file test_boost.cpp.

References m_ReportOut, and NcbiCerr.

Referenced by main().

◆ GetIniParser()

CExprParser * CNcbiTestApplication::GetIniParser ( void  )
inline

Get parser evaluating configuration conditions.

Return NULL if it is not right time to deal with the parser.

Definition at line 1031 of file test_boost.cpp.

References AutoPtr< X, Del >::get(), and m_IniParser.

◆ GetRanTestsCount()

int CNcbiTestApplication::GetRanTestsCount ( void  )

Get number of actually executed tests.

Definition at line 1630 of file test_boost.cpp.

References GetTestResultString(), ITERATE, kTestResultDisabled, kTestResultSkipped, m_AllTests, result, str(), and TUT_CASE.

◆ GetTestResultString()

string CNcbiTestApplication::GetTestResultString ( but::test_unit *  tu)

◆ GetTestRWConfig()

CNcbiRegistry & CNcbiTestApplication::GetTestRWConfig ( void  )
inline

Get the application's cached configuration parameters, accessible to read-write.

See also
GetConfig, GetRWConfig

Definition at line 1852 of file test_boost.cpp.

References CNcbiApplicationAPI::GetRWConfig().

◆ GetTestUnit()

but::test_unit * CNcbiTestApplication::GetTestUnit ( CTempString  test_name)
inline

Get pointer to test case or test suite by its name.

Definition at line 1738 of file test_boost.cpp.

References map_checker< Container >::end(), map_checker< Container >::find(), m_AllTests, NCBI_THROW, test_name, and x_GetTrimmedTestName().

Referenced by x_ReadConfiguration().

◆ GetToFixTestsCount()

int CNcbiTestApplication::GetToFixTestsCount ( void  )

Get number of tests that were failed but are marked to be fixed.

Definition at line 1647 of file test_boost.cpp.

References ITERATE, m_ToFixTests, and result.

◆ HasTestErrors()

bool CNcbiTestApplication::HasTestErrors ( void  )
inline

Check if there were any test errors.

Definition at line 1840 of file test_boost.cpp.

References m_HasTestErrors.

Referenced by main().

◆ HasTestTimeouts()

bool CNcbiTestApplication::HasTestTimeouts ( void  )
inline

Check if there were any timeouted tests.

Definition at line 1846 of file test_boost.cpp.

References m_HasTestTimeouts.

Referenced by main().

◆ Init()

void CNcbiTestApplication::Init ( void  )
virtual

Initialize the application.

The default behavior of this is "do nothing". If you have special initialization logic that needs to be peformed, then you must override this method with your own logic.

Reimplemented from CNcbiApplicationAPI.

Definition at line 969 of file test_boost.cpp.

References CArgDescriptions::AddFlag(), CArgDescriptions::AddOptionalKey(), ctll::empty(), CArgDescriptions::eString, eTestUserFuncCmdLine, CArgDescriptions::fMandatorySeparator, CNcbiApplicationAPI::GetArguments(), m_ArgDescrs, m_UserFuncs, AutoPtr< X, Del >::release(), CNcbiApplicationAPI::SetupArgDescriptions(), CArgDescriptions::SetUsageContext(), and x_CallUserFuncs().

◆ InitTestFramework()

but::test_suite * CNcbiTestApplication::InitTestFramework ( int  argc,
char *  argv[] 
)

◆ InitTestsBeforeRun()

void CNcbiTestApplication::InitTestsBeforeRun ( void  )
inline

Initialize already prepared test suite before running tests.

Definition at line 1515 of file test_boost.cpp.

References eTestUserFuncInit, fDisabled, fInitFailed, fTestList, m_RunMode, x_ActualizeDeps(), x_AddDummyTest(), x_CallUserFuncs(), x_EnableAllTests(), and x_EnsureAllDeps().

Referenced by main().

◆ IsInitFailed()

bool CNcbiTestApplication::IsInitFailed ( void  )
inline

Check if user initialization functions failed.

Definition at line 1043 of file test_boost.cpp.

References fInitFailed, and m_RunMode.

◆ IsTestToFix()

bool CNcbiTestApplication::IsTestToFix ( const but::test_unit *  tu)
inline

Check if given test is marked as requiring fixing in the future.

Definition at line 1658 of file test_boost.cpp.

References set< Key, Compare >::end(), set< Key, Compare >::find(), and m_ToFixTests.

◆ ReEnableAllTests()

void CNcbiTestApplication::ReEnableAllTests ( void  )
inline

Enable all necessary tests after execution but before printing report.

Definition at line 1546 of file test_boost.cpp.

References ITERATE, m_DisabledTests, s_SetEnabled(), and x_EnableAllTests().

Referenced by CNcbiBoostReporter::results_report_start().

◆ Run()

int CNcbiTestApplication::Run ( void  )
virtual

Run the application.

It is defined as a pure virtual method – so you must(!) supply the Run() method to implement the application-specific logic.

Returns
Exit code.

Implements CNcbiApplicationAPI.

Definition at line 988 of file test_boost.cpp.

References m_RunCalled.

◆ SetGloballyDisabled()

void CNcbiTestApplication::SetGloballyDisabled ( void  )

Set flag that all tests globally disabled.

Definition at line 1377 of file test_boost.cpp.

References fDisabled, m_RunMode, and x_AddDummyTest().

Referenced by InitTestFramework(), and x_ReadConfiguration().

◆ SetGloballySkipped()

void CNcbiTestApplication::SetGloballySkipped ( void  )

Set flag that all tests globally skipped.

Definition at line 1389 of file test_boost.cpp.

References fDisabled, and m_RunMode.

◆ SetTestDisabled()

void CNcbiTestApplication::SetTestDisabled ( but::test_unit *  tu)
inline

Set test as disabled by user.

Definition at line 1016 of file test_boost.cpp.

References CONFIGURED_FILTERS, set< Key, Compare >::insert(), m_DisabledTests, and s_SetEnabled().

Referenced by x_ReadConfiguration().

◆ SetTestErrored()

void CNcbiTestApplication::SetTestErrored ( but::test_case *  tc)
inline

◆ SetTestTimedOut()

void CNcbiTestApplication::SetTestTimedOut ( but::test_case *  tc)
inline

Mark test case as failed due to hit of the timeout.

Definition at line 1558 of file test_boost.cpp.

References set< Key, Compare >::insert(), m_CurUnitTimeout, m_HasTestTimeouts, and m_TimedOutTests.

Referenced by CNcbiTestsObserver::exception_caught().

◆ x_ActualizeDeps()

void CNcbiTestApplication::x_ActualizeDeps ( void  )
inlineprivate

Set up real Boost.Test dependencies based on ones made by AddTestDependsOn().

See also
AddTestDependsOn()

Definition at line 1105 of file test_boost.cpp.

References ITERATE, m_DisabledTests, m_TestDeps, s_IsEnabled(), and test.

Referenced by InitTestsBeforeRun().

◆ x_AddDummyTest()

void CNcbiTestApplication::x_AddDummyTest ( void  )
inlineprivate

Add empty test necesary for internal purposes.

Definition at line 1400 of file test_boost.cpp.

References DUMMY_TEST_FUNCTION_NAME, and m_DummyTest.

Referenced by InitTestFramework(), InitTestsBeforeRun(), and SetGloballyDisabled().

◆ x_CalcConfigValue()

bool CNcbiTestApplication::x_CalcConfigValue ( const string value)
inlineprivate

Calculate the value from configuration file.

Definition at line 1356 of file test_boost.cpp.

References CExprValue::eBOOL, CExprValue::GetBool(), CExprParser::GetResult(), CExprValue::GetType(), m_IniParser, CExprParser::Parse(), and rapidjson::value.

Referenced by x_ReadConfiguration().

◆ x_CallUserFuncs()

bool CNcbiTestApplication::x_CallUserFuncs ( ETestUserFuncType  func_type)
private

Call all user functions.

Return TRUE if functions execution is successful and FALSE if come function thrown exception.

Definition at line 1717 of file test_boost.cpp.

References ERR_POST_X, ITERATE, m_UserFuncs, s_GetUserFuncName(), and CException::what().

Referenced by FiniTestsAfterRun(), Init(), InitTestFramework(), InitTestsBeforeRun(), and x_ReadConfiguration().

◆ x_CollectAllTests()

void CNcbiTestApplication::x_CollectAllTests ( void  )
inlineprivate

Collect names and pointers to all tests existing in master test suite.

Definition at line 1749 of file test_boost.cpp.

References map_checker< Container >::clear(), IGNORE_STATUS, and m_AllTests.

Referenced by InitTestFramework().

◆ x_EnableAllTests()

void CNcbiTestApplication::x_EnableAllTests ( bool  enable)
private

Enable / disable all tests known to application.

Definition at line 1494 of file test_boost.cpp.

References ITERATE, m_AllTests, s_SetEnabled(), and TUT_CASE.

Referenced by InitTestFramework(), InitTestsBeforeRun(), and ReEnableAllTests().

◆ x_EnsureAllDeps()

void CNcbiTestApplication::x_EnsureAllDeps ( void  )
inlineprivate

Ensure that all dependencies stand earlier in tests tree than their dependents.

Definition at line 1092 of file test_boost.cpp.

References CNcbiTestsTreeBuilder::EnsureDep(), CNcbiTestsTreeBuilder::FixUnitsOrder(), ITERATE, m_TestDeps, m_TreeBuilder, and test.

Referenced by InitTestsBeforeRun().

◆ x_GetEnabledTestsCount()

int CNcbiTestApplication::x_GetEnabledTestsCount ( void  )
inlineprivate

Get number of tests which Boost will execute.

Definition at line 1757 of file test_boost.cpp.

References IGNORE_STATUS.

Referenced by InitTestFramework().

◆ x_GetTrimmedTestName()

string CNcbiTestApplication::x_GetTrimmedTestName ( const string test_name)
private

Apply standard trimmings to test name and return resultant test name which will identify test inside the framework.

Definition at line 1049 of file test_boost.cpp.

References NStr::eCase, NStr::eNocase, NStr::eReverseSearch, NStr::Find(), NPOS, NStr::StartsWith(), and test_name.

Referenced by CollectTestUnit(), and GetTestUnit().

◆ x_InitCommonParserVars()

void CNcbiTestApplication::x_InitCommonParserVars ( void  )
inlineprivate

◆ x_ReadConfiguration()

bool CNcbiTestApplication::x_ReadConfiguration ( void  )
inlineprivate

◆ x_SetupBoostReporters()

void CNcbiTestApplication::x_SetupBoostReporters ( void  )
inlineprivate

Member Data Documentation

◆ m_AllTests

TStringToUnitMap CNcbiTestApplication::m_AllTests
private

List of all test units mapped to their names.

Definition at line 600 of file test_boost.cpp.

Referenced by CollectTestUnit(), GetRanTestsCount(), GetTestUnit(), x_CollectAllTests(), and x_EnableAllTests().

◆ m_ArgDescrs

AutoPtr<CArgDescriptions> CNcbiTestApplication::m_ArgDescrs
private

Argument descriptions to be passed to SetArgDescriptions().

Value is not null only during NCBITEST_INIT_CMDLINE() function

Definition at line 595 of file test_boost.cpp.

Referenced by GetArgDescrs(), and Init().

◆ m_CurUnitTimeout

unsigned int CNcbiTestApplication::m_CurUnitTimeout
private

Timeout that was set in currently executing unit before adjustment.

See also
AdjustTestTimeout()

Definition at line 633 of file test_boost.cpp.

Referenced by AdjustTestTimeout(), and SetTestTimedOut().

◆ m_DisabledTests

TUnitsSet CNcbiTestApplication::m_DisabledTests
private

List of all disabled tests.

Definition at line 602 of file test_boost.cpp.

Referenced by GetTestResultString(), ReEnableAllTests(), SetTestDisabled(), and x_ActualizeDeps().

◆ m_DummyTest

but::test_case* CNcbiTestApplication::m_DummyTest
private

Empty test case added to Boost for internal perposes.

Definition at line 620 of file test_boost.cpp.

Referenced by GetDummyTest(), and x_AddDummyTest().

◆ m_HasTestErrors

bool CNcbiTestApplication::m_HasTestErrors
private

Flag showing if there were some test errors.

Definition at line 635 of file test_boost.cpp.

Referenced by HasTestErrors(), and SetTestErrored().

◆ m_HasTestTimeouts

bool CNcbiTestApplication::m_HasTestTimeouts
private

Flag showing if there were some timeouted tests.

Definition at line 637 of file test_boost.cpp.

Referenced by HasTestTimeouts(), and SetTestTimedOut().

◆ m_IniParser

AutoPtr<CExprParser> CNcbiTestApplication::m_IniParser
private

Parser to evaluate expressions in configuration file.

Value is not null only during NCBITEST_INIT_VARIABLES() function

Definition at line 598 of file test_boost.cpp.

Referenced by GetIniParser(), x_CalcConfigValue(), x_InitCommonParserVars(), and x_ReadConfiguration().

◆ m_Logger

CNcbiBoostLogger* CNcbiTestApplication::m_Logger
private

Boost logger - must be pointer because Boost.Test calls free() on it.

Definition at line 614 of file test_boost.cpp.

Referenced by CNcbiTestApplication(), and x_SetupBoostReporters().

◆ m_Observer

CNcbiTestsObserver CNcbiTestApplication::m_Observer
private

Observer to make test dependencies and look for unit's timeouts.

Definition at line 610 of file test_boost.cpp.

Referenced by InitTestFramework().

◆ m_Reporter

CNcbiBoostReporter* CNcbiTestApplication::m_Reporter
private

Boost reporter - must be pointer because Boost.Test calls free() on it.

Definition at line 612 of file test_boost.cpp.

Referenced by CNcbiTestApplication(), and x_SetupBoostReporters().

◆ m_ReportOut

ofstream CNcbiTestApplication::m_ReportOut
private

Output stream for Boost.Test report.

Definition at line 616 of file test_boost.cpp.

Referenced by GetFreeformReportStream(), x_SetupBoostReporters(), and ~CNcbiTestApplication().

◆ m_RunCalled

bool CNcbiTestApplication::m_RunCalled
private

If Run() was called or not.

See also
Run()

Definition at line 587 of file test_boost.cpp.

Referenced by DryRun(), InitTestFramework(), and Run().

◆ m_RunMode

TRunMode CNcbiTestApplication::m_RunMode
private

Mode of running the application.

Definition at line 589 of file test_boost.cpp.

Referenced by DryRun(), GetTestResultString(), InitTestFramework(), InitTestsBeforeRun(), IsInitFailed(), SetGloballyDisabled(), and SetGloballySkipped().

◆ m_TestDeps

TUnitToManyMap CNcbiTestApplication::m_TestDeps
private

List of all dependencies for each test having dependencies.

Definition at line 608 of file test_boost.cpp.

Referenced by AddTestDependsOn(), x_ActualizeDeps(), and x_EnsureAllDeps().

◆ m_TimedOutTests

TUnitsSet CNcbiTestApplication::m_TimedOutTests
private

List of all tests which result is a timeout.

Definition at line 604 of file test_boost.cpp.

Referenced by GetTestResultString(), SetTestErrored(), and SetTestTimedOut().

◆ m_TimeMult

double CNcbiTestApplication::m_TimeMult
private

Multiplicator for timeouts.

Definition at line 627 of file test_boost.cpp.

Referenced by AdjustTestTimeout(), and InitTestFramework().

◆ m_Timeout

double CNcbiTestApplication::m_Timeout
private

Timeout for the whole test.

Definition at line 622 of file test_boost.cpp.

Referenced by AdjustTestTimeout(), and InitTestFramework().

◆ m_TimeoutStr

string CNcbiTestApplication::m_TimeoutStr
private

String representation for whole test timeout (real value taken from CHECK_TIMEOUT in Makefile).

Definition at line 625 of file test_boost.cpp.

Referenced by AdjustTestTimeout(), and InitTestFramework().

◆ m_Timer

CStopWatch CNcbiTestApplication::m_Timer
private

Timer measuring elapsed time for the whole test.

Definition at line 629 of file test_boost.cpp.

Referenced by AdjustTestTimeout(), and InitTestFramework().

◆ m_ToFixTests

TUnitsSet CNcbiTestApplication::m_ToFixTests
private

List of all tests marked as in need of fixing in the future.

Definition at line 606 of file test_boost.cpp.

Referenced by GetTestResultString(), GetToFixTestsCount(), IsTestToFix(), and x_ReadConfiguration().

◆ m_TreeBuilder

CNcbiTestsTreeBuilder CNcbiTestApplication::m_TreeBuilder
private

Builder of internal accessible from library tests tree.

Definition at line 618 of file test_boost.cpp.

Referenced by InitTestFramework(), and x_EnsureAllDeps().

◆ m_UserFuncs

TUserFuncsList CNcbiTestApplication::m_UserFuncs[eTestUserFuncLast - eTestUserFuncFirst+1]
private

Lists of all user-defined functions.

Definition at line 591 of file test_boost.cpp.

Referenced by AddUserFunction(), Init(), and x_CallUserFuncs().


The documentation for this class was generated from the following file:
Modified on Tue May 21 11:00:31 2024 by modify_doxy.py rev. 669887