From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id DDC585A55 for ; Mon, 9 Feb 2015 10:16:03 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 09 Feb 2015 01:16:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="451892843" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 09 Feb 2015 01:01:31 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t199FxPO008453; Mon, 9 Feb 2015 17:15:59 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t199FwRd002402; Mon, 9 Feb 2015 17:16:00 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t199FvoO002398; Mon, 9 Feb 2015 17:15:57 +0800 From: Yong Liu To: dts@dpdk.org Date: Mon, 9 Feb 2015 17:15:56 +0800 Message-Id: <1423473356-2366-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH] framework: change default running directory to parent directory X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2015 09:16:04 -0000 --- framework/config.py | 4 ++-- framework/dts.py | 13 ++++++++++--- framework/main.py | 14 +++++++------- framework/rst.py | 4 ++-- 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. -- 1.9.3