test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] framework: change default running directory to parent directory
@ 2015-02-09  9:15 Yong Liu
  2015-02-09  9:22 ` Yong Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Yong Liu @ 2015-02-09  9:15 UTC (permalink / raw)
  To: dts

---
 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dts] [PATCH] framework: change default running directory to parent directory
  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
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Yong Liu @ 2015-02-09  9:22 UTC (permalink / raw)
  To: dts

Previous default running directory of DTS is under framework. This will cause 
confusion sometimes.

Signed-off-by: Marvinliu <yong.liu@intel.com>
---
 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dts] [PATCH] framework: change default running directory to parent directory
  2015-02-09  9:22 ` Yong Liu
@ 2015-02-09 13:03   ` Qiu, Michael
  2015-02-13  3:03   ` [dts] [PATCH] framework: optimize dpdk package preparation process Yong Liu
  2015-02-15  2:54   ` [dts] [PATCH] framework: change default running directory to parent directory Liu, Yong
  2 siblings, 0 replies; 7+ messages in thread
From: Qiu, Michael @ 2015-02-09 13:03 UTC (permalink / raw)
  To: Liu, Yong, dts

On 2/9/2015 5:25 PM, Yong Liu wrote:
> Previous default running directory of DTS is under framework. This will cause 
> confusion sometimes.
>
> Signed-off-by: Marvinliu <yong.liu@intel.com>
> ---
>  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))

Here better to add error handing(try catch) for those commands may
failed by network issue.

Thanks,
Michael
>  
>  #
>  # 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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dts] [PATCH] framework: optimize dpdk package preparation process
  2015-02-09  9:22 ` Yong Liu
  2015-02-09 13:03   ` Qiu, Michael
@ 2015-02-13  3:03   ` Yong Liu
  2015-02-13  7:24     ` Qiu, Michael
  2015-02-15  2:54   ` [dts] [PATCH] framework: change default running directory to parent directory Liu, Yong
  2 siblings, 1 reply; 7+ messages in thread
From: Yong Liu @ 2015-02-13  3:03 UTC (permalink / raw)
  To: dts

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dts] [PATCH] framework: optimize dpdk package preparation process
  2015-02-13  3:03   ` [dts] [PATCH] framework: optimize dpdk package preparation process Yong Liu
@ 2015-02-13  7:24     ` Qiu, Michael
  2015-02-15  3:02       ` Liu, Yong
  0 siblings, 1 reply; 7+ messages in thread
From: Qiu, Michael @ 2015-02-13  7:24 UTC (permalink / raw)
  To: Liu, Yong, dts

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@intel.com>

Acked-by: Michael Qiu <michael.qiu@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,


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dts] [PATCH] framework: change default running directory to parent directory
  2015-02-09  9:22 ` Yong Liu
  2015-02-09 13:03   ` Qiu, Michael
  2015-02-13  3:03   ` [dts] [PATCH] framework: optimize dpdk package preparation process Yong Liu
@ 2015-02-15  2:54   ` Liu, Yong
  2 siblings, 0 replies; 7+ messages in thread
From: Liu, Yong @ 2015-02-15  2:54 UTC (permalink / raw)
  To: dts

Applied. Thx.

> -----Original Message-----
> From: Liu, Yong
> Sent: Monday, February 09, 2015 5:23 PM
> To: dts@dpdk.org
> Cc: Liu, Yong
> Subject: [PATCH] framework: change default running directory to parent
> directory
> 
> Previous default running directory of DTS is under framework. This will
> cause
> confusion sometimes.
> 
> Signed-off-by: Marvinliu <yong.liu@intel.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dts] [PATCH] framework: optimize dpdk package preparation process
  2015-02-13  7:24     ` Qiu, Michael
@ 2015-02-15  3:02       ` Liu, Yong
  0 siblings, 0 replies; 7+ messages in thread
From: Liu, Yong @ 2015-02-15  3:02 UTC (permalink / raw)
  To: Qiu, Michael, dts

Applied. Thx.

> -----Original Message-----
> From: Qiu, Michael
> Sent: Friday, February 13, 2015 3:25 PM
> To: Liu, Yong; dts@dpdk.org
> Subject: Re: [dts] [PATCH] framework: optimize dpdk package preparation
> process
> 
> 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@intel.com>
> 
> Acked-by: Michael Qiu <michael.qiu@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,

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-02-15  3:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [dts] [PATCH] framework: optimize dpdk package preparation process Yong Liu
2015-02-13  7:24     ` 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

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).