summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
Diffstat (limited to 'func')
-rw-r--r--func/args_handler.py16
-rw-r--r--func/env_setup.py2
-rw-r--r--func/spawn_vm.py2
3 files changed, 12 insertions, 8 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):
diff --git a/func/env_setup.py b/func/env_setup.py
index cd82f303..f10f8620 100644
--- a/func/env_setup.py
+++ b/func/env_setup.py
@@ -175,7 +175,7 @@ class Env_setup:
def parse(self, config_file_path):
try:
f_name = open(config_file_path, 'r+')
- doc = yaml.load(f_name)
+ doc = yaml.safe_load(f_name)
f_name.close()
if doc['Scenario']['benchmark']:
self.benchmark = doc['Scenario']['benchmark']
diff --git a/func/spawn_vm.py b/func/spawn_vm.py
index 15c26861..5710308b 100644
--- a/func/spawn_vm.py
+++ b/func/spawn_vm.py
@@ -65,7 +65,7 @@ class SpawnVM(Env_setup):
Heat_Dic = {}
try:
with open('./heat/SampleHeat.yaml', 'r+') as H_temp:
- Heat_Dic = yaml.load(H_temp)
+ Heat_Dic = yaml.safe_load(H_temp)
except yaml.YAMLError as exc:
if hasattr(exc, 'problem_mark'):
mark = exc.problem_mark