From 102555d5887bcd21b0b9a9ca40f33736e396ab98 Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Mon, 5 Jun 2017 15:49:54 +0100 Subject: ci: Fix VPP back2back TCs There was a generic issue with restoration of original environment after execution of testcase. Thus in case that multiple tests were executed, their settings could be corrupted. This issue was detected after VPP testcases were added into VSPERF DAILY CI job. There were two issues: * setttings.load_from_dict() method was used to restore original configuration values; However this method updates dict content with supplied values. If TC has introduced new dict item, then it was not removed from settings after TC execution and modified settings was applied also for next test(s). * test configuration passed to testcase constructor is used for initialization of TC members, which are later updated; As python does shallow copy on dict members by default, modification of such testcase members led to corruption of configuration of other testcases. Thus deepcopy of testcase configuration was introduced into vsperf constructor to avoid TC configuration corruption. JIRA: VSPERF-511 Change-Id: I45fb49d48743015353652de12db4692333043733 Signed-off-by: Martin Klozik Reviewed-by: Al Morton Reviewed-by: Christian Trautman Reviewed-by: Sridhar Rao Reviewed-by: Trevor Cooper --- testcases/testcase.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'testcases') diff --git a/testcases/testcase.py b/testcases/testcase.py index 75ed1a5c..3a86f77c 100644 --- a/testcases/testcase.py +++ b/testcases/testcase.py @@ -45,14 +45,18 @@ class TestCase(object): In this basic form runs RFC2544 throughput test """ # pylint: disable=too-many-statements - def __init__(self, cfg): + def __init__(self, test_cfg): """Pull out fields from test config - :param cfg: A dictionary of string-value pairs describing the test + :param test_cfg: A dictionary of string-value pairs describing the test configuration. Both the key and values strings use well-known values. :param results_dir: Where the csv formatted results are written. """ + # make a local copy of test configuration to avoid modification of + # original content used in vsperf main script + cfg = copy.deepcopy(test_cfg) + self._testcase_start_time = time.time() self._hugepages_mounted = False self._traffic_ctl = None @@ -336,7 +340,8 @@ class TestCase(object): self.run_report() # restore original settings - S.load_from_dict(self._settings_original) + for key in self._settings_original: + S.setValue(key, self._settings_original[key]) def _update_settings(self, param, value): """ Check value of given configuration parameter -- cgit 1.2.3-korg