summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2016-10-10 01:50:57 +0000
committerxudan <xudan16@huawei.com>2016-10-10 01:50:57 +0000
commitc61ca832c89b57908decf2735270b7d6cf7340b0 (patch)
tree79ab6bbe016d71e496e662f6d5ee5ed6d759d62c
parentbee8604246520fc40c1b3187dd2fde1896f64f35 (diff)
Add yardstick crawler and checker for the results of testcase
JIRA: DOVETAIL-18 Change-Id: Idaad0ee4f8e6304f18fa478f1cded6e256cb12fd Signed-off-by: xudan <xudan16@huawei.com>
-rw-r--r--scripts/report.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/scripts/report.py b/scripts/report.py
index 42ec0df0..5dfa5890 100644
--- a/scripts/report.py
+++ b/scripts/report.py
@@ -157,6 +157,30 @@ class YardstickCrawler:
self.type = 'yardstick'
def crawl(self, testcase=None):
+ store_type = dovetail_config[self.type]['result']['store_type']
+ if store_type == 'file':
+ return self.crawl_from_file(testcase)
+
+ if store_type == 'url':
+ return self.crawl_from_url(testcase)
+
+ def crawl_from_file(self, testcase=None):
+ file_path = os.path.join(dovetail_config['result_dir'], testcase+'.out')
+ if not os.path.exists(file_path):
+ logger.info('result file not found: %s' % file_path)
+ return None
+ try:
+ with open(file_path, 'r') as myfile:
+ output = myfile.read()
+ criteria = 'PASS'
+ json_results = {'criteria':criteria}
+ logger.debug('Results: %s' % str(json_results))
+ return json_results
+ except Exception as e:
+ logger.error('Cannot read content from the file: %s, exception: %s' % (file_path, e))
+ return None
+
+ def crawl_from_url(self, testcase=None):
return None
class CheckerFactory:
@@ -208,6 +232,8 @@ class FunctestChecker:
class YardstickChecker:
def check(cls, testcase, result):
- return 'PASS'
-
-
+ if not result:
+ testcase.passed(False)
+ else:
+ testcase.passed(result['criteria'] == 'PASS')
+ return