test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Liu, Yong" <yong.liu@intel.com>
To: "Qiu, Michael" <michael.qiu@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH 2/2 v2] framework: make option -d to absolute path
Date: Sun, 15 Feb 2015 08:53:29 +0000	[thread overview]
Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E10D7CF3D@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1423989691-11612-1-git-send-email-michael.qiu@intel.com>

Michael, need small fix for pep8 check.

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Michael Qiu
> Sent: Sunday, February 15, 2015 4:42 PM
> To: dts@dpdk.org
> Subject: [dts] [PATCH 2/2 v2] framework: make option -d to absolute path
> 
> Option -d is used for dpdk directory name, which is not suitable.
> 
> Meanwhile, dts need make dpdk location in DUT more flexable.
> 
> Specify the absolute path with -d option to solve the issue.
> 
> Signed-off-by: Michael Qiu <michael.qiu@intel.com>
> ---
>  framework/main.py           | 22 +++++++++++-----------
>  framework/project_dpdk.py   | 36 ++++++++++++++++++++++++++++++------
>  framework/ssh_connection.py |  2 +-
>  3 files changed, 42 insertions(+), 18 deletions(-)
> 
> diff --git a/framework/main.py b/framework/main.py
> index 0223f57..11b7513 100755
> --- a/framework/main.py
> +++ b/framework/main.py
> @@ -43,23 +43,23 @@ import dts
>  os.chdir("../")
> 
> 
> -def git_build_package(gitLabel, gitPkg, output):
> +def git_build_package(gitLabel, pkgName, depot="dep"):
>      """
>      generate package from git, if dpdk existed will pull latest code
>      """
>      gitURL = r"http://dpdk.org/git/dpdk"
>      gitPrefix = r"dpdk/"
> -    if os.path.exists("%s/%s" % (output, gitPrefix)) is True:
> -        ret = os.system("cd %s/%s && git pull --force" % (output,
> gitPrefix))
> +    if os.path.exists("%s/%s" % (depot, gitPrefix)) is True:
> +        ret = os.system("cd %s/%s && git pull --force" % (depot,
> gitPrefix))
>      else:
> -        print "git clone %s %s/%s" % (gitURL, output, gitPrefix)
> -        ret = os.system("git clone %s output/%s" % (gitURL, gitPrefix))
> +        print "git clone %s %s/%s" % (gitURL, depot, gitPrefix)
> +        ret = os.system("git clone %s %s/%s" % (gitURL, depot, 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 %s/%s && git archive --format=tar.gz --
> prefix=%s/ %s -o ../../%s"
> -                    % (output, gitPrefix, gitPrefix, gitLabel, gitPkg))
> +    print "git archive --format=tar.gz --prefix=%s %s -o %s" % (gitPrefix,
> gitLabel, pkgName)
> +    ret = os.system("cd %s/%s && git archive --format=tar.gz --
> prefix=%s/ %s -o ../%s"
> +                    % (depot, gitPrefix, gitPrefix, gitLabel, pkgName))
>      if ret is not 0:
>          raise EnvironmentError
> 
> @@ -79,7 +79,7 @@ parser.add_argument('--patch',
>                      help='apply a patch to the package under test')
> 
>  parser.add_argument('--snapshot',
> -                    default='dpdk.tar.gz',
> +                    default='dep/dpdk.tar.gz',
>                      help='snapshot .tgz file to use as input')
> 
>  parser.add_argument('--output',
> @@ -110,7 +110,7 @@ parser.add_argument('-t', '--test-cases',
>                      help='executes only the followings test cases')
> 
>  parser.add_argument('-d', '--dir',
> -                    default='dpdk',
> +                    default='~/dpdk',
>                      help='Output directory where dpdk package is
> extracted')
> 
>  parser.add_argument('-v', '--verbose',
> @@ -123,7 +123,7 @@ args = parser.parse_args()
>  # 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)
> +        git_build_package(args.git, os.path.split(args.snapshot)[1])
>      except Exception:
>          print "FAILED TO PREPARE DPDK PACKAGE!!!"
>          sys.exit()
> diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
> index 8448a61..18a8853 100644
> --- a/framework/project_dpdk.py
> +++ b/framework/project_dpdk.py
> @@ -198,10 +198,22 @@ class DPDKdut(Dut):
>          if not self.skip_setup:
>              assert (os.path.isfile(pkgName) is True), "Invalid package"
> 
> -            self.session.copy_file_to(pkgName)
> +            p_dir, _ = os.path.split(self.base_dir)
> +            # ToDo: make this configurable
> +            dst_dir = "/tmp/"
> +
> +            out = self.send_expect("ll %s && cd %s" % (dst_dir, p_dir),
> +                                   "#", verify = True)
> +            if out == -1:
> +                raise ValueError("Directiry %s or %s does not exist,"
> +                                 "please check params -d"
> +                                  % (p_dir, dst_dir))
Found pep8 E127 continuation line over-indented for visual indent.
Should remove space before %.

> +            self.session.copy_file_to(pkgName, dst_dir)
> +
> +            # put patches to p_dir/patches/
>              if (patch is not None):
>                  for p in patch:
> -                    self.session.copy_file_to('../' + p)
> +                    self.session.copy_file_to('dep/' + p, dst_dir)
> 
>              self.kill_all()
> 
> @@ -216,13 +228,25 @@ class DPDKdut(Dut):
>              self.send_expect("rm -rf %s" % self.base_dir, "#")
> 
>              # unpack dpdk
> -            out = self.send_expect("tar zxf " + pkgName.split('/')[-1],
> "# ", 20)
> -            assert "Error" not in out
> +            out = self.send_expect("tar zxf %s%s -C %s" %
> +                                   (dst_dir, pkgName.split('/')[-1],
> p_dir),
> +                                   "# ", 20, verify = True)
Pep8 require not space in between parameter key and value. 

> +            if out == -1:
> +                raise ValueError("Extract dpdk package to %s failure,"
> +                                 "please check params -d"
> +                                  % (p_dir))
> +
Found pep8 E127 continuation line over-indented for visual indent.
Should remove space before %.

> +            # check dpdk dir name is expect
> +            out = self.send_expect("ls %s" % self.base_dir,
> +                                   "# ", 20, verify = True)
Pep8 require not space in between parameter key and value.

> +            if out == -1:
> +                raise ValueError("dpdk dir %s mismatch, please check
> params -d"
> +                                  % self.base_dir)
> 
Found pep8 E127 continuation line over-indented for visual indent.
Should remove space before %.

>              if (patch is not None):
>                  for p in patch:
> -                    out = self.send_expect("patch -d %s -p1 < ../%s" %
> -                                           (self.base_dir, p), "# ")
> +                    out = self.send_expect("patch -d %s -p1 < %s" %
> +                                           (self.base_dir, dst_dir + p),
> "# ")
>                      assert "****" not in out
> 
>          self.dut_prerequisites()
> diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py
> index f3debc1..d1075b5 100644
> --- a/framework/ssh_connection.py
> +++ b/framework/ssh_connection.py
> @@ -51,7 +51,7 @@ class SSHConnection(object):
> 
>      def send_expect(self, cmds, expected, timeout=15, verify=False):
>          self.logger.info(cmds)
> -        out = self.session.send_expect(cmds, expected, timeout,
> verify=False)
> +        out = self.session.send_expect(cmds, expected, timeout, verify)
>          self.logger.debug(out)
>          return out
> 
> --
> 1.9.3

      reply	other threads:[~2015-02-15  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-15  6:43 [dts] [PATCH 1/2] framework: Move tgen and tclclient to dep Michael Qiu
2015-02-15  6:43 ` [dts] [PATCH 2/2] framework: make option -d to absolute path Michael Qiu
2015-02-15  8:03   ` Liu, Yong
2015-02-15  7:13 ` [dts] [PATCH 1/2] framework: Move tgen and tclclient to dep Michael Qiu
2015-02-15  8:41 ` [dts] [PATCH 2/2 v2] framework: make option -d to absolute path Michael Qiu
2015-02-15  8:53   ` Liu, Yong [this message]

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=86228AFD5BCD8E4EBFD2B90117B5E81E10D7CF3D@SHSMSX103.ccr.corp.intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    --cc=michael.qiu@intel.com \
    /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).