Filter out program version text from command-line-example output

Updated reflog to reflect change in command-line-example output
This commit is contained in:
Mathew Bielejeski
2020-08-13 17:50:48 -07:00
committed by Tom Henderson
parent 941a67fca7
commit b99295e119
2 changed files with 48 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
command-line-example
command-line-example:
Initial values:
intArg: 1
boolArg: false

View File

@@ -41,6 +41,50 @@ using namespace ns3;
namespace ns3 {
namespace tests {
/**
* \ingroup examples-as-tests
* Run command line example as a test case
*/
class CommandLineExampleTestCase : public ExampleAsTestCase
{
public:
/**
* Default constructor
*/
CommandLineExampleTestCase();
/**
* Destructor
*/
virtual ~CommandLineExampleTestCase();
//Inherited function
virtual std::string GetPostProcessingCommand (void) const;
};
CommandLineExampleTestCase::CommandLineExampleTestCase ()
: ExampleAsTestCase ("core-example-command-line",
"command-line-example",
NS_TEST_SOURCEDIR)
{}
CommandLineExampleTestCase::~CommandLineExampleTestCase ()
{}
/**
* Override this function to filter the version string from
* the command-line-example output.
* Since the version changes each time a commit is made it shouldn't
* be tested as part of the command-line-example output
*/
std::string
CommandLineExampleTestCase::GetPostProcessingCommand (void) const
{
//Delete the line that starts with Program Version:
return std::string(R"__(| sed -e "/^Program Version:.*$/d")__");
}
/**
* \ingroup examples-as-tests
* Run examples as tests, checking stdout for regressions.
@@ -59,7 +103,7 @@ ExamplesAsTestsTestSuite::ExamplesAsTestsTestSuite ()
AddTestCase (new ExampleAsTestCase ("core-example-sample-random-variable", "sample-random-variable", NS_TEST_SOURCEDIR));
AddTestCase (new ExampleAsTestCase ("core-example-command-line", "command-line-example", NS_TEST_SOURCEDIR));
AddTestCase (new CommandLineExampleTestCase ());
}
/**
@@ -76,7 +120,7 @@ static ExamplesAsTestsTestSuite g_examplesAsTestsTestSuite;
* Tests ExampleTestSuite which runs a single example as test suite as specified in constructor arguments.
*/
static ExampleAsTestSuite g_exampleCommandLineTest ("core-example-command-line", "command-line-example", NS_TEST_SOURCEDIR);
static ExampleAsTestSuite g_exampleCommandLineTest ("core-example-simulator", "sample-simulator", NS_TEST_SOURCEDIR);
} // namespace tests