summaryrefslogtreecommitdiffstats
path: root/scripts/run.py
diff options
context:
space:
mode:
authorxudan2189 <xudanstudy@gmail.com>2016-09-21 04:40:44 -0400
committerxudan <xudan16@huawei.com>2016-09-23 03:25:07 -0400
commitc554b6951f8ee8298d3f8ae8f53ba468dbf4c164 (patch)
tree1c00e69f31fcd3b04d88073700eddf1f1d620b06 /scripts/run.py
parentd8ee3fd2cb9e221466e49703a25e9b7e1343be62 (diff)
Move copyfile to container and remove hard-code
JIRA: DOVETAIL-17 Change-Id: Id4ad126169cf83c6c72a7b599f3309f0f930e461 Signed-off-by: xudan <xudan16@huawei.com>
Diffstat (limited to 'scripts/run.py')
-rwxr-xr-xscripts/run.py25
1 files changed, 8 insertions, 17 deletions
diff --git a/scripts/run.py b/scripts/run.py
index a8ef819c..9b59f76f 100755
--- a/scripts/run.py
+++ b/scripts/run.py
@@ -29,12 +29,6 @@ def load_scenario(scenario):
def load_testcase():
Testcase.load()
-def copy_file(file_dir, container_id, container_dir):
- for root, dirs, files in os.walk(file_dir):
- for file_name in files:
- cmd = 'sudo docker cp %s %s:%s' % (os.path.join(file_dir,file_name), container_id, container_dir)
- dt_utils.exec_cmd(cmd, logger, exit_on_error = False)
-
def run_functest(testcase, container_id):
sub_cmd = dovetail_config[testcase.script_type()]['testcase']['pre_cmd']
Container.exec_cmd(container_id, sub_cmd)
@@ -42,18 +36,15 @@ def run_functest(testcase, container_id):
Container.exec_cmd(container_id, sub_cmd)
def run_yardstick(testcase, container_id):
- copy_file(os.path.join(os.getcwd(),container_config[testcase.script_type()]['shell_dir_name']),\
- container_id,container_config[testcase.script_type()]['shell_dir'])
- if container_config[testcase.script_type()]['has_build_images'] == True:
- cmd = 'sudo docker exec %s %s/run_test.sh %s.yaml %s/%s.out' \
- % (container_id, container_config[testcase.script_type()]['shell_dir'], testcase.script_testcase(),\
- container_config[testcase.script_type()]['result_dir'], testcase.name())
+ type = testcase.script_type()
+ Container.copy_file(os.path.join(os.getcwd(), dovetail_config[type]['shell_dir_name']),\
+ container_id, dovetail_config[type]['shell_dir'])
+ if Container.has_build_images[type] == True:
+ sub_cmd = dovetail_config[type]['testcase']['test_cmd'] % (testcase.script_testcase(), testcase.name())
else:
- container_config[testcase.script_type()]['has_build_images'] = True
- cmd = 'sudo docker exec %s %s/build_run_test.sh %s.yaml %s/%s.out' \
- % (container_id, container_config[testcase.script_type()]['shell_dir'], testcase.script_testcase(),\
- container_config[testcase.script_type()]['result_dir'], testcase.name())
- dt_utils.exec_cmd(cmd,logger,exit_on_error = False)
+ Container.has_build_images[type] = True
+ sub_cmd = dovetail_config[type]['testcase']['build_test_cmd'] % (testcase.script_testcase(), testcase.name())
+ Container.exec_cmd(container_id, sub_cmd)
time.sleep(5)
def run_test(scenario):