diff options
author | hongbo tian <hongbo.tianhongbo@huawei.com> | 2016-11-30 03:03:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-11-30 03:03:09 +0000 |
commit | 41835d3fdeb7249198b4352fafc30515f9e0ec55 (patch) | |
tree | 24f89fe16121acc971454318e2592ba5c9784a3e | |
parent | 16b897a7a9473511a201ec43ab253e21a869fed2 (diff) | |
parent | a83c0cfc5b1410ada3d8c54b32d3904adf3ab8f8 (diff) |
Merge "dovetail tool: run.py execution always wipes of results files"
-rwxr-xr-x | dovetail/run.py | 20 | ||||
-rw-r--r-- | dovetail/utils/dovetail_logger.py | 10 |
2 files changed, 16 insertions, 14 deletions
diff --git a/dovetail/run.py b/dovetail/run.py index e908f3ab..b9194c39 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -10,18 +10,18 @@ import click import sys +import os import utils.dovetail_logger as dt_logger +import utils.dovetail_utils as dt_utils from parser import Parser from container import Container from testcase import Testcase from testcase import Testsuite from report import Report -from report import FunctestCrawler -from report import YardstickCrawler -from report import FunctestChecker -from report import YardstickChecker +from report import FunctestCrawler, YardstickCrawler +from report import FunctestChecker, YardstickChecker from conf.dovetail_config import DovetailConfig as dt_config @@ -120,8 +120,20 @@ def create_logs(): Testsuite.create_log() +def clean_results_dir(): + result_path = dt_config.dovetail_config['result_dir'] + if os.path.exists(result_path): + if os.path.isdir(result_path): + cmd = 'sudo rm -rf %s/*' % (result_path) + dt_utils.exec_cmd(cmd, exit_on_error=False) + else: + print "result_dir in dovetail_config.yml is not a directory." + sys.exit(-1) + + def main(*args, **kwargs): """Dovetail compliance test entry!""" + clean_results_dir() create_logs() logger = dt_logger.Logger('run').getLogger() logger.info('================================================') diff --git a/dovetail/utils/dovetail_logger.py b/dovetail/utils/dovetail_logger.py index e725e612..8afa08a1 100644 --- a/dovetail/utils/dovetail_logger.py +++ b/dovetail/utils/dovetail_logger.py @@ -25,16 +25,6 @@ import logging import os from conf.dovetail_config import DovetailConfig as dt_config -import dovetail_utils as dt_utils - - -def clean_results_dir(): - result_path = dt_config.dovetail_config['result_dir'] - if os.path.exists(result_path): - cmd = 'sudo rm -rf %s/*' % (result_path) - dt_utils.exec_cmd(cmd, exit_on_error=False) - -clean_results_dir() class Logger: |