From 64db4bb925f771b053f922fe324a624c5da75ad9 Mon Sep 17 00:00:00 2001 From: "zhifeng.jiang" Date: Fri, 9 Sep 2016 23:46:07 +0800 Subject: Run benchmark test in restful server post api modification: Call ansible async in restful server post api Set the job state 'finished' when finish benchmark test Terminate the next benchmark in restful server delete api job result will be in next commit JIRA:QTIP-97 Change-Id: I252482dddd9b35ba33f992e8ea19037d8919fad6 Signed-off-by: zhifeng.jiang --- func/args_handler.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'func') diff --git a/func/args_handler.py b/func/args_handler.py index 57ecfcbd..90d902b6 100644 --- a/func/args_handler.py +++ b/func/args_handler.py @@ -7,19 +7,23 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## import os +from operator import add +import simplejson as json from func.env_setup import Env_setup from func.spawn_vm import SpawnVM from func.driver import Driver -def get_files_in_test_list(suit_name): - with open('test_list/' + suit_name, 'r') as fin_put: - benchmark_list = fin_put.readlines() - return map(lambda x: x.rstrip(), benchmark_list) +def get_files_in_test_list(suit_name, case_type='all'): + benchmark_list = json.load(file('test_list/{0}'.format(suit_name))) + return reduce(add, benchmark_list.values()) \ + if case_type == 'all' else benchmark_list[case_type] -def get_files_in_test_case(lab, suit_name): - return os.listdir('./test_cases/{0}/{1}'.format(lab, suit_name)) +def get_files_in_test_case(lab, suit_name, case_type='all'): + test_case_all = os.listdir('./test_cases/{0}/{1}'.format(lab, suit_name)) + return test_case_all if case_type == 'all' else \ + filter(lambda x: case_type in x, test_case_all) def get_benchmark_path(lab, suit, benchmark): -- cgit 1.2.3-korg