summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaryam Tahhan <maryam.tahhan@intel.com>2016-05-12 10:55:43 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-05-12 10:55:43 +0000
commit5d109d0f628b9b8d20c550dc27f6814fe064aabe (patch)
tree92d2b5da7ff5f3411a2258bfadd768e3ee11035f
parent0c83887dac13f44e4ee2aea128a04c27f9a0ef2e (diff)
parent3460fd9b5379b288b34c6e2c5984d2e9f67cc3bd (diff)
Merge "testcase: execution time"
-rw-r--r--core/results/results_constants.py2
-rw-r--r--testcases/testcase.py6
2 files changed, 8 insertions, 0 deletions
diff --git a/core/results/results_constants.py b/core/results/results_constants.py
index 1049e89b..b7ab7052 100644
--- a/core/results/results_constants.py
+++ b/core/results/results_constants.py
@@ -59,6 +59,8 @@ class ResultsConstants(object):
SCAL_STREAM_TYPE = 'match_type'
SCAL_PRE_INSTALLED_FLOWS = 'pre-installed_flows'
+ TEST_RUN_TIME = "test_execution_time"
+
@staticmethod
def get_traffic_constants():
"""Method returns all Constants used to store results.
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 5b9ead69..1437aeae 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -45,6 +45,7 @@ class TestCase(object):
values.
:param results_dir: Where the csv formatted results are written.
"""
+ self._testcase_start_time = time.time()
self._hugepages_mounted = False
self._traffic_ctl = None
self._vnf_ctl = None
@@ -56,6 +57,7 @@ class TestCase(object):
self.guest_loopback = []
self._settings_original = {}
self._settings_paths_modified = False
+ self._testcast_run_time = None
self._update_settings('VSWITCH', cfg.get('vSwitch', S.getValue('VSWITCH')))
self._update_settings('VNF', cfg.get('VNF', S.getValue('VNF')))
@@ -284,6 +286,9 @@ class TestCase(object):
# tear down test execution environment and log results
self.run_finalize()
+ self._testcase_run_time = time.strftime("%H:%M:%S",
+ time.gmtime(time.time() - self._testcase_start_time))
+ logging.info("Testcase execution time: " + self._testcase_run_time)
# report test results
self.run_report()
@@ -313,6 +318,7 @@ class TestCase(object):
item[ResultsConstants.ID] = self.name
item[ResultsConstants.DEPLOYMENT] = self.deployment
item[ResultsConstants.TRAFFIC_TYPE] = self._traffic['l3']['proto']
+ item[ResultsConstants.TEST_RUN_TIME] = self._testcase_run_time
if self._traffic['multistream']:
item[ResultsConstants.SCAL_STREAM_COUNT] = self._traffic['multistream']
item[ResultsConstants.SCAL_STREAM_TYPE] = self._traffic['stream_type']