diff options
author | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2016-09-21 03:24:20 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-09-21 03:24:20 +0000 |
commit | 8664db2de47ca768108e22499302e36e58ac9d6d (patch) | |
tree | 18135d421571d4a6b82b555bdba8d68804bcbd45 /func | |
parent | c806bbde071596f204782e7182a65173798ad3ca (diff) | |
parent | 64db4bb925f771b053f922fe324a624c5da75ad9 (diff) |
Merge "Run benchmark test in restful server post api"
Diffstat (limited to 'func')
-rw-r--r-- | func/args_handler.py | 16 |
1 files changed, 10 insertions, 6 deletions
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): |