|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
43 #if defined(NS3_ENABLE_EXAMPLES) && !defined (__win32__)
46 const std::string program,
47 const std::string dataDir,
48 const std::string args )
66 std::string command (
"%s ");
75 std::string command (
"");
91 ss <<
"bash -c './waf --run-no-build " <<
m_program
99 <<
" | grep -v 'Waf:' "
104 <<
"; exit ${PIPESTATUS[0]}'";
106 int status = std::system (ss.str ().c_str ());
108 std::cout <<
"command: " << ss.str () <<
"\n"
109 <<
"status: " << status <<
"\n"
110 <<
"refFile: " << refFile <<
"\n"
111 <<
"testFile: " << testFile <<
"\n"
113 std::cout <<
"testFile contents:" << std::endl;
115 std::ifstream logF (testFile);
117 while (getline (logF, line))
119 std::cout << line <<
"\n";
131 const std::string program,
132 const std::string dataDir,
133 const std::string args ,
134 const TestDuration duration )
135 : TestSuite (name, EXAMPLE)
137 NS_LOG_FUNCTION (
this << name << program << dataDir << args << duration);
138 AddTestCase (
new ExampleAsTestCase (name, program, dataDir, args), duration);
141 #endif // NS3_ENABLE_EXAMPLES && !defined (__win32__)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
ExampleAsTestSuite(const std::string name, const std::string program, const std::string dataDir, const std::string args="", const TestDuration duration=QUICK)
Constructor.
void SetDataDir(std::string directory)
Set the data directory where reference trace files can be found.
#define NS_ASCII_TEST_EXPECT_EQ(gotFilename, expectedFilename)
Test that a pair of new/reference ascii files are equal.
std::string m_dataDir
The source directory for the test.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::string GetName(void) const
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
std::string m_args
Any additional arguments to the program.
virtual ~ExampleAsTestCase(void)
Destructor.
NS_UNUSED and NS_UNUSED_GLOBAL macro definitions.
virtual std::string GetPostProcessingCommand(void) const
Customization point for tests requiring post-processing of stdout.
Enable examples to be run as meaningful tests.
virtual void DoRun(void)
Implementation to actually run this TestCase.
ExampleAsTestCase(const std::string name, const std::string program, const std::string dataDir, const std::string args="")
Constructor.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
std::string m_program
The program to run.
std::string CreateDataDirFilename(std::string filename)
Construct the full path to a file in the data directory.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
virtual std::string GetCommandTemplate(void) const
Customization point for more complicated patterns to invoke the example program.
std::string CreateTempDirFilename(std::string filename)
Construct the full path to a file in a temporary directory.