diff options
author | Yong Liu <yong.liu@intel.com> | 2015-02-09 17:13:10 +0800 |
---|---|---|
committer | Yong Liu <yong.liu@intel.com> | 2015-02-12 09:36:28 +0800 |
commit | 6ed94f583d8163124155d98e61ee22765de6b051 (patch) | |
tree | 595640bd6b170b770590362dead0b46b200cf5b6 | |
parent | 866b52cab7ec4dc80228e9070c562bf8a8c17684 (diff) |
framework: change default running directory to parent directory
Signed-off-by: Marvinliu <yong.liu@intel.com>
-rwxr-xr-x | framework/config.py | 4 | ||||
-rw-r--r-- | framework/dts.py | 13 | ||||
-rwxr-xr-x | framework/main.py | 14 | ||||
-rw-r--r-- | framework/rst.py | 4 | ||||
-rw-r--r-- | framework/settings.py | 8 |
5 files changed, 29 insertions, 14 deletions
diff --git a/framework/config.py b/framework/config.py index af014a8..d2548e8 100755 --- a/framework/config.py +++ b/framework/config.py @@ -37,8 +37,8 @@ import re import ConfigParser # config parse module import argparse # prase arguments module -portconf = "../conf/ports.cfg" -crbconf = "../conf/crbs.cfg" +portconf = "conf/ports.cfg" +crbconf = "conf/crbs.cfg" class UserConf(): diff --git a/framework/dts.py b/framework/dts.py index 9ba23fe..bddbe33 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -42,7 +42,7 @@ import rst # rst file support from crbs import crbs from tester import Tester from dut import Dut -from settings import NICS, DRIVERS +from settings import FOLDERS, NICS, DRIVERS from serializer import Serializer from exception import VerifyFailure from test_case import TestCase @@ -128,7 +128,7 @@ def close_crb_sessions(): dut.close() if tester is not None: tester.close() - log_handler.info("DTF ended") + log_handler.info("DTS ended") def get_nic_driver(pci_id): @@ -401,10 +401,18 @@ def run_all(config_file, pkgName, git, patch, skip_setup, global stats global log_handler + # change operation directory + os.chdir("../") + # prepare the output folder if not os.path.exists(output_dir): os.mkdir(output_dir) + # add python module search path + for folder in FOLDERS.values(): + sys.path.append(folder) + sys.path.append(suite_dir) + # init log_handler handler if verbose is True: logger.set_verbose() @@ -423,7 +431,6 @@ def run_all(config_file, pkgName, git, patch, skip_setup, # register exit action atexit.register(close_crb_sessions) - sys.path.append(suite_dir) os.environ["TERM"] = "dumb" serializer = Serializer() diff --git a/framework/main.py b/framework/main.py index 21815dd..d38aa8a 100755 --- a/framework/main.py +++ b/framework/main.py @@ -47,9 +47,9 @@ def git_build_package(gitLabel, gitPkg, output): gitURL = r"http://dpdk.org/git/dpdk" gitPrefix = r"dpdk/" print "git clone %s %s/%s" % (gitURL, output, gitPrefix) - os.system("git clone %s ../output/%s" % (gitURL, gitPrefix)) - print "git archive --format=tar.gz --prefix=%s %s -o ../%s" % (gitPrefix, gitLabel, gitPkg) - os.system("cd ../output/%s && git archive --format=tar.gz --prefix=%s %s -o ../%s" % (gitPrefix, gitPrefix, gitLabel, gitPkg)) + os.system("git clone %s output/%s" % (gitURL, gitPrefix)) + print "git archive --format=tar.gz --prefix=%s %s -o %s" % (gitPrefix, gitLabel, gitPkg) + os.system("cd output/%s && git archive --format=tar.gz --prefix=%s %s -o %s" % (gitPrefix, gitPrefix, gitLabel, gitPkg)) # # Main program begins here @@ -60,7 +60,7 @@ def git_build_package(gitLabel, gitPkg, output): parser = argparse.ArgumentParser(description='DPDK test framework.') parser.add_argument('--config-file', - default='../execution.cfg', + default='execution.cfg', help='configuration file that describes the test ' + 'cases, DUTs and targets') @@ -72,11 +72,11 @@ parser.add_argument('--patch', help='apply a patch to the package under test') parser.add_argument('--snapshot', - default='../dpdk.tar.gz', + default='dpdk.tar.gz', help='snapshot .tgz file to use as input') parser.add_argument('--output', - default='../output', + default='output', help='Output directory where dts log and result saved') parser.add_argument('-s', '--skip-setup', @@ -95,7 +95,7 @@ parser.add_argument('-p', '--project', help='specify that which project will be tested') parser.add_argument('--suite-dir', - default='../tests', + default='tests', help='Test suite directory where test suites will be imported') parser.add_argument('-t', '--test-cases', diff --git a/framework/rst.py b/framework/rst.py index 8c2d6c5..9b8eb69 100644 --- a/framework/rst.py +++ b/framework/rst.py @@ -52,8 +52,8 @@ Result: Result: PASS """ -path2Plan = '../test_plans' -path2Result = '../output' +path2Plan = 'test_plans' +path2Result = 'output' rstName = "" rstAnnexName = "" diff --git a/framework/settings.py b/framework/settings.py index 40b81fb..e4ca5dd 100644 --- a/framework/settings.py +++ b/framework/settings.py @@ -28,6 +28,14 @@ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +""" +Folders for framework running enviornment. +""" +FOLDERS = { + 'Framework' : 'framework', + 'Testscripts' : 'tests', + 'Configuration' : 'conf', +} """ Nics and its identifiers supported by the framework. |