[dts] [PATCH] framework: optimize dpdk package preparation process
Qiu, Michael
michael.qiu at intel.com
Fri Feb 13 08:24:46 CET 2015
On 2/13/2015 11:04 AM, Yong Liu wrote:
> 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 <yong.liu at intel.com>
Acked-by: Michael Qiu <michael.qiu at intel.com>
> ---
> 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,
More information about the dts
mailing list