test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH] framework: optimize dpdk package preparation process
Date: Fri, 13 Feb 2015 11:03:43 +0800	[thread overview]
Message-ID: <1423796623-14889-1-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1423473775-2841-1-git-send-email-yong.liu@intel.com>

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@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,
-- 
1.9.3

  parent reply	other threads:[~2015-02-13  3:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09  9:15 [dts] [PATCH] framework: change default running directory to parent directory Yong Liu
2015-02-09  9:22 ` Yong Liu
2015-02-09 13:03   ` Qiu, Michael
2015-02-13  3:03   ` Yong Liu [this message]
2015-02-13  7:24     ` [dts] [PATCH] framework: optimize dpdk package preparation process Qiu, Michael
2015-02-15  3:02       ` Liu, Yong
2015-02-15  2:54   ` [dts] [PATCH] framework: change default running directory to parent directory Liu, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423796623-14889-1-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).