core, tests: Reset default values for every TestCase

This commit is contained in:
Tom Henderson
2023-02-26 18:16:28 -08:00
parent a3c19e5d14
commit ddb530c956
2 changed files with 9 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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.
*/