summaryrefslogtreecommitdiffstats
path: root/dovetail/utils/dovetail_utils.py
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2017-04-06 03:31:30 +0000
committerxudan <xudan16@huawei.com>2017-04-12 08:29:26 +0000
commit4d98856b87edbf784b12b375b5d30ab9f401d525 (patch)
tree883335d3ab11c52b45cda97b021f7bed2993f544 /dovetail/utils/dovetail_utils.py
parentac766b065a8032e4aa90dafef2130292364a2483 (diff)
dovetail tool: bugfix: test cases are erroneously judged
JIRA: DOVETAIL-375 JIRA: DOVETAIL-390 1. defcore test cases are erroneously judged because of: a) defcore results json data lack some keys b) some sub-testcases' names are the same as the prefix of another sub-testcases. 2. this patch removes the extra keys and judge sub-testcases accurately. 3. remove "store_type" in functest_config.yml and yardstick_config.yml. 4. change some log levels from info to debug. Change-Id: I5f126e70309409cac66ef9a0909f1573d325098b Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'dovetail/utils/dovetail_utils.py')
-rw-r--r--dovetail/utils/dovetail_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/dovetail/utils/dovetail_utils.py b/dovetail/utils/dovetail_utils.py
index 766bb646..fa99e004 100644
--- a/dovetail/utils/dovetail_utils.py
+++ b/dovetail/utils/dovetail_utils.py
@@ -16,6 +16,7 @@ import subprocess
from collections import Mapping, Set, Sequence
import json
import urllib2
+from datetime import datetime
def exec_log(verbose, logger, msg, level, flush=False):
@@ -144,6 +145,19 @@ def check_db_results(db_url, build_tag, testcase, logger):
return False
+def get_duration(start_date, stop_date, logger):
+ fmt = '%Y-%m-%d %H:%M:%S'
+ try:
+ datetime_start = datetime.strptime(start_date, fmt)
+ datetime_stop = datetime.strptime(stop_date, fmt)
+ delta = (datetime_stop - datetime_start).seconds
+ res = "%sm%ss" % (delta / 60, delta % 60)
+ return res
+ except ValueError as e:
+ logger.error("ValueError: %s", e)
+ return None
+
+
def show_progress_bar(length):
max_len = 50
length %= max_len