diff --git a/src/core/model/test.cc b/src/core/model/test.cc index 8b992a86f..5c85b16fa 100644 --- a/src/core/model/test.cc +++ b/src/core/model/test.cc @@ -19,6 +19,7 @@ #include "abort.h" #include "assert.h" +#include "config.h" #include "des-metrics.h" #include "log.h" #include "singleton.h" @@ -351,6 +352,7 @@ TestCase::Run(TestRunnerImpl* runner) NS_LOG_FUNCTION(this << runner); m_result = new Result(); m_runner = runner; + Config::Reset(); DoSetup(); m_result->clock.Start(); for (auto i = m_children.begin(); i != m_children.end(); ++i) @@ -366,6 +368,7 @@ TestCase::Run(TestRunnerImpl* runner) out: m_result->clock.End(); DoTeardown(); + Config::Reset(); m_runner = nullptr; } diff --git a/src/core/model/test.h b/src/core/model/test.h index 50e95a22d..380eaf1f9 100644 --- a/src/core/model/test.h +++ b/src/core/model/test.h @@ -1234,7 +1234,12 @@ class TestCase // methods called by TestRunnerImpl /** - * \brief Actually run this TestCase + * \brief Executes DoSetup(), DoRun(), and DoTeardown() for the TestCase + * + * Config::Reset() is called at both the beginning and end of this method + * so that any changes to attribute default values (Config::SetDefault(...)) + * or global values (e.g., RngRun) that are made within the test case's + * DoRun() method do not propagate beyond the scope of running the TestCase. * * \param [in] runner The test runner implementation. */