Run unit tests as indenpendent WAF tasks
This commit is contained in:
@@ -16,7 +16,7 @@ def configure(conf):
|
||||
"library 'libxml-2.0 >= 2.7' not found")
|
||||
conf.sub_config('stats')
|
||||
|
||||
conf.write_config_header('ns3/contrib-config.h', project_root_relative=True)
|
||||
conf.write_config_header('ns3/contrib-config.h', top=True)
|
||||
|
||||
def build(bld):
|
||||
module = bld.create_ns3_module('contrib', ['simulator', 'common'])
|
||||
|
||||
@@ -55,6 +55,18 @@ TestManager::EnableVerbose (void)
|
||||
{
|
||||
Get ()->m_verbose = true;
|
||||
}
|
||||
|
||||
void
|
||||
TestManager::PrintTestNames (std::ostream &os)
|
||||
{
|
||||
for (TestsCI i = Get ()->m_tests.begin (); i != Get ()->m_tests.end (); i++)
|
||||
{
|
||||
std::string *testName = (*i).second;
|
||||
os << *testName << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::ostream &
|
||||
TestManager::Failure (void)
|
||||
{
|
||||
@@ -95,6 +107,47 @@ TestManager::RealRunTests (void)
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
bool
|
||||
TestManager::RunTest (std::string name)
|
||||
{
|
||||
return Get ()->RealRunTest (name);
|
||||
}
|
||||
bool
|
||||
TestManager::RealRunTest (std::string name)
|
||||
{
|
||||
TestsCI i;
|
||||
|
||||
for (i = m_tests.begin (); i != m_tests.end (); i++)
|
||||
{
|
||||
std::string *testName = (*i).second;
|
||||
if (*testName == name)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == m_tests.end ())
|
||||
{
|
||||
std::cerr << "Test with name " << name << " not found." << std::endl;
|
||||
}
|
||||
|
||||
if (!(*i).first->RunTests ())
|
||||
{
|
||||
if (m_verbose)
|
||||
{
|
||||
std::cerr << "FAIL " << name << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_verbose)
|
||||
{
|
||||
std::cerr << "PASS "<< name << std::endl;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Test::Test (char const *name)
|
||||
{
|
||||
TestManager::Add (this, name);
|
||||
|
||||
@@ -89,12 +89,17 @@ public:
|
||||
*/
|
||||
static bool RunTests (void);
|
||||
|
||||
static bool RunTest (std::string name);
|
||||
|
||||
static void PrintTestNames (std::ostream &os);
|
||||
|
||||
private:
|
||||
friend class Test;
|
||||
static void Add (Test *test, char const *name);
|
||||
static std::ostream &Failure (void);
|
||||
static TestManager *Get (void);
|
||||
bool RealRunTests (void);
|
||||
bool RealRunTest (std::string name);
|
||||
|
||||
TestManager ();
|
||||
~TestManager ();
|
||||
|
||||
@@ -41,7 +41,7 @@ int main ()
|
||||
conf.env['ENABLE_THREADING'],
|
||||
"<pthread.h> include not detected")
|
||||
|
||||
conf.write_config_header('ns3/core-config.h', project_root_relative=True)
|
||||
conf.write_config_header('ns3/core-config.h', top=True)
|
||||
|
||||
def build(bld):
|
||||
core = bld.create_ns3_module('core')
|
||||
|
||||
@@ -31,7 +31,7 @@ def configure(conf):
|
||||
|
||||
conf.check(header_name='sys/inttypes.h', define_name='HAVE_SYS_INT_TYPES_H')
|
||||
|
||||
conf.write_config_header('ns3/simulator-config.h', project_root_relative=True)
|
||||
conf.write_config_header('ns3/simulator-config.h', top=True)
|
||||
|
||||
if not conf.check(lib='rt', uselib='RT', define_name='HAVE_RT'):
|
||||
conf.report_optional_feature("RealTime", "Real Time Simulator",
|
||||
|
||||
Reference in New Issue
Block a user