Container for all tests. More...
Public Member Functions | |
TestRunnerImpl () | |
Constructor. More... | |
void | AddTestSuite (TestSuite *testSuite) |
Add a new top-level TestSuite. More... | |
std::string | GetTempDir (void) const |
Get the path to temporary directory. More... | |
std::string | GetTopLevelSourceDir (void) const |
Get the path to the root of the source tree. More... | |
bool | MustAssertOnFailure (void) const |
Check if this run should assert on failure. More... | |
bool | MustContinueOnFailure (void) const |
Check if this run should continue on failure. More... | |
bool | MustUpdateData (void) const |
Check if this run should update the reference data. More... | |
int | Run (int argc, char *argv[]) |
Run the requested suite of tests, according to the given command line arguments. More... | |
Public Member Functions inherited from ns3::Singleton< TestRunnerImpl > | |
Singleton (const Singleton< TestRunnerImpl > &)=delete | |
Singleton< TestRunnerImpl > & | operator= (const Singleton< TestRunnerImpl > &)=delete |
Private Types | |
typedef std::vector< TestSuite * > | TestSuiteVector |
Container type for the test. More... | |
Private Member Functions | |
std::list< TestCase * > | FilterTests (std::string testName, enum TestSuite::Type testType, enum TestCase::TestDuration maximumTestDuration) |
Generate the list of tests matching the constraints. More... | |
bool | IsTopLevelSourceDir (std::string path) const |
Check if this is the root of the source tree. More... | |
void | PrintHelp (const char *programName) const |
Print the help text. More... | |
void | PrintReport (TestCase *test, std::ostream *os, bool xml, int level) |
Print the test report. More... | |
void | PrintTestNameList (std::list< TestCase * >::const_iterator begin, std::list< TestCase * >::const_iterator end, bool printTestType) const |
Print the list of all requested test suites. More... | |
void | PrintTestTypeList (void) const |
Print the list of test types. More... | |
std::string | ReplaceXmlSpecialCharacters (std::string xml) const |
Clean up characters not allowed in XML. More... | |
Private Attributes | |
bool | m_assertOnFailure |
true if we should assert on failure. More... | |
bool | m_continueOnFailure |
true if we should continue on failure. More... | |
TestSuiteVector | m_suites |
The list of tests. More... | |
std::string | m_tempDir |
The temporary directory. More... | |
bool | m_updateData |
true if we should update reference data. More... | |
bool | m_verbose |
Produce verbose output. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from ns3::Singleton< TestRunnerImpl > | |
static TestRunnerImpl * | Get (void) |
Get a pointer to the singleton instance. More... | |
Protected Member Functions inherited from ns3::Singleton< TestRunnerImpl > | |
Singleton () | |
Constructor. More... | |
virtual | ~Singleton () |
Destructor. More... | |
Container for all tests.
|
private |
ns3::TestRunnerImpl::TestRunnerImpl | ( | ) |
void ns3::TestRunnerImpl::AddTestSuite | ( | TestSuite * | testSuite | ) |
Add a new top-level TestSuite.
[in] | testSuite | The new TestSuite. |
Definition at line 514 of file test.cc.
References m_suites, and NS_LOG_FUNCTION.
Referenced by ns3::TestSuite::TestSuite().
|
private |
Generate the list of tests matching the constraints.
Test name and type constraints are or'ed. The duration constraint is and'ed.
[in] | testName | Include a specific test by name. |
[in] | testType | Include all tests of give type. |
[in] | maximumTestDuration | Restrict to tests shorter than this. |
Definition at line 811 of file test.cc.
References m_suites, NS_LOG_FUNCTION, and test-ns3::tests.
Referenced by Run().
std::string ns3::TestRunnerImpl::GetTempDir | ( | void | ) | const |
Get the path to temporary directory.
Definition at line 541 of file test.cc.
References m_tempDir, and NS_LOG_FUNCTION.
Referenced by ns3::TestCase::CreateTempDirFilename().
std::string ns3::TestRunnerImpl::GetTopLevelSourceDir | ( | void | ) | const |
Get the path to the root of the source tree.
The root directory is defined by the presence of two files: "VERSION" and "LICENSE".
Definition at line 575 of file test.cc.
References ns3::SystemPath::FindSelfDirectory(), IsTopLevelSourceDir(), ns3::SystemPath::Join(), NS_FATAL_ERROR, NS_LOG_FUNCTION, and ns3::SystemPath::Split().
Referenced by ns3::TestCase::CreateDataDirFilename().
|
private |
Check if this is the root of the source tree.
[in] | path | The path to test. |
true
if path is the root. Definition at line 547 of file test.cc.
References NS_LOG_FUNCTION, and ns3::SystemPath::ReadFiles().
Referenced by GetTopLevelSourceDir().
bool ns3::TestRunnerImpl::MustAssertOnFailure | ( | void | ) | const |
Check if this run should assert on failure.
true
if we should assert on failure. Definition at line 522 of file test.cc.
References m_assertOnFailure, and NS_LOG_FUNCTION.
Referenced by ns3::TestCase::MustAssertOnFailure().
bool ns3::TestRunnerImpl::MustContinueOnFailure | ( | void | ) | const |
Check if this run should continue on failure.
true
if we should continue on failure. Definition at line 528 of file test.cc.
References m_continueOnFailure, and NS_LOG_FUNCTION.
Referenced by ns3::TestCase::MustContinueOnFailure().
bool ns3::TestRunnerImpl::MustUpdateData | ( | void | ) | const |
Check if this run should update the reference data.
true
if we should update the reference data. Definition at line 535 of file test.cc.
References m_updateData, and NS_LOG_FUNCTION.
Referenced by ns3::TestCase::CreateTempDirFilename().
|
private |
Print the help text.
[in] | programName | The name of the invoking program. |
Definition at line 736 of file test.cc.
References NS_LOG_FUNCTION.
Referenced by Run().
|
private |
|
private |
Print the list of all requested test suites.
[in] | begin | Iterator to the first TestCase to print. |
[in] | end | Iterator to the end of the list. |
[in] | printTestType | Preprend the test type label if true . |
Definition at line 773 of file test.cc.
References ns3::TestSuite::ALL, ns3::TestSuite::EXAMPLE, NS_LOG_FUNCTION, ns3::TestSuite::PERFORMANCE, ns3::TestSuite::SYSTEM, and ns3::TestSuite::UNIT.
Referenced by Run().
|
private |
Print the list of test types.
Definition at line 799 of file test.cc.
References NS_LOG_FUNCTION.
Referenced by Run().
|
private |
Clean up characters not allowed in XML.
XML files have restrictions on certain characters that may be present in data. We need to replace these characters with their alternate representation on the way into the XML file.
Specifically, we make these replacements:
Raw Source | Replacement |
---|---|
'<' | "<" |
'>' | ">" |
'&' | "&" |
'"' | "&39;" |
'\' | """ |
[in] | xml | The raw string. |
Definition at line 599 of file test.cc.
References NS_LOG_FUNCTION, and test-ns3::result.
int ns3::TestRunnerImpl::Run | ( | int | argc, |
char * | argv[] | ||
) |
Run the requested suite of tests, according to the given command line arguments.
[in] | argc | The number of elements in argv |
[in] | argv | The vector of command line arguments |
Definition at line 863 of file test.cc.
References ns3::TestSuite::ALL, ns3::TestSuite::EXAMPLE, ns3::TestCase::EXTENSIVE, FilterTests(), m_assertOnFailure, m_continueOnFailure, m_tempDir, m_updateData, m_verbose, ns3::SystemPath::MakeTemporaryDirectoryName(), NS_LOG_FUNCTION, ns3::TestSuite::PERFORMANCE, PrintHelp(), PrintTestNameList(), PrintTestTypeList(), ns3::TestCase::QUICK, ns3::TestSuite::SYSTEM, ns3::TestCase::TAKES_FOREVER, test-ns3::tests, and ns3::TestSuite::UNIT.
Referenced by ns3::TestRunner::Run().
|
private |
true
if we should assert on failure.
Definition at line 251 of file test.cc.
Referenced by MustAssertOnFailure(), and Run().
|
private |
true
if we should continue on failure.
Definition at line 252 of file test.cc.
Referenced by MustContinueOnFailure(), and Run().
|
private |
The list of tests.
Definition at line 248 of file test.cc.
Referenced by AddTestSuite(), and FilterTests().
|
private |
The temporary directory.
Definition at line 249 of file test.cc.
Referenced by GetTempDir(), and Run().
|
private |
true
if we should update reference data.
Definition at line 253 of file test.cc.
Referenced by MustUpdateData(), and Run().
|
private |