From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 85F07ADA1 for ; Fri, 13 Feb 2015 04:03:52 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 12 Feb 2015 18:56:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,568,1418112000"; d="scan'208";a="454009339" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 12 Feb 2015 18:49:06 -0800 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t1D33mgA021975; Fri, 13 Feb 2015 11:03:48 +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 t1D33jsQ014925; Fri, 13 Feb 2015 11:03:47 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t1D33jmm014921; Fri, 13 Feb 2015 11:03:45 +0800 From: Yong Liu To: dts@dpdk.org Date: Fri, 13 Feb 2015 11:03:43 +0800 Message-Id: <1423796623-14889-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1423473775-2841-1-git-send-email-yong.liu@intel.com> References: <1423473775-2841-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH] framework: optimize dpdk package preparation process 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: Fri, 13 Feb 2015 03:03:53 -0000 If output/dpdk existed, only need pull latest code. If output/dpdk not existed, will clone from dpdk.org. When failure happened, DTS will exit. Signed-off-by: Marvinliu --- framework/dts.py | 3 --- framework/main.py | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/framework/dts.py b/framework/dts.py index 871380b..3c73596 100644 --- a/framework/dts.py +++ b/framework/dts.py @@ -399,9 +399,6 @@ 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) diff --git a/framework/main.py b/framework/main.py index 3b2f484..0223f57 100755 --- a/framework/main.py +++ b/framework/main.py @@ -39,28 +39,30 @@ import sys import argparse import dts +# change operation directory +os.chdir("../") + def git_build_package(gitLabel, gitPkg, output): """ - generate package from git - run bash shell + generate package from git, if dpdk existed will pull latest code """ gitURL = r"http://dpdk.org/git/dpdk" gitPrefix = r"dpdk/" - print "git clone %s %s/%s" % (gitURL, output, gitPrefix) - ret = os.system("git clone %s output/%s" % (gitURL, gitPrefix)) + if os.path.exists("%s/%s" % (output, gitPrefix)) is True: + ret = os.system("cd %s/%s && git pull --force" % (output, gitPrefix)) + else: + print "git clone %s %s/%s" % (gitURL, output, gitPrefix) + ret = os.system("git clone %s output/%s" % (gitURL, gitPrefix)) if ret is not 0: raise EnvironmentError + print "git archive --format=tar.gz --prefix=%s %s -o %s" % (gitPrefix, gitLabel, gitPkg) - ret = os.system("cd output/%s && git archive --format=tar.gz --prefix=%s %s -o %s" % (gitPrefix, gitPrefix, gitLabel, gitPkg)) + ret = os.system("cd %s/%s && git archive --format=tar.gz --prefix=%s/ %s -o ../../%s" + % (output, gitPrefix, gitPrefix, gitLabel, gitPkg)) if ret is not 0: raise EnvironmentError -# -# Main program begins here -# - - # Read cmd-line args parser = argparse.ArgumentParser(description='DPDK test framework.') @@ -118,7 +120,7 @@ parser.add_argument('-v', '--verbose', args = parser.parse_args() -# prepare DPDK source test package +# prepare DPDK source test package, DTS will exited when failed. if args.git is not None: try: git_build_package(args.git, args.snapshot, args.output) @@ -126,6 +128,7 @@ if args.git is not None: print "FAILED TO PREPARE DPDK PACKAGE!!!" sys.exit() +# Main program begins here dts.run_all(args.config_file, args.snapshot, args.git, args.patch, args.skip_setup, args.read_cache, args.project, args.suite_dir, args.test_cases, -- 1.9.3