test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Tu, Lijuan" <lijuan.tu@intel.com>
To: "Mo, YufengX" <yufengx.mo@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Mo, YufengX" <yufengx.mo@intel.com>
Subject: Re: [dts] [PATCH V1][tests/metering_and_policing]: fix typo and remove	hard code
Date: Wed, 29 May 2019 02:59:53 +0000	[thread overview]
Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA867B1@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1558922660-37013-2-git-send-email-yufengx.mo@intel.com>

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of yufengmx
> Sent: Monday, May 27, 2019 10:04 AM
> To: dts@dpdk.org
> Cc: Mo, YufengX <yufengx.mo@intel.com>
> Subject: [dts] [PATCH V1][tests/metering_and_policing]: fix typo and remove
> hard code
> 
> 
> *. remove hard code of dpdk source directory to fix a directory error when
> use --dir option.
> *. change Copyright year to 2019
> *. fix typo.
> 
> Signed-off-by: yufengmx <yufengx.mo@intel.com>
> ---
>  tests/TestSuite_metering_and_policing.py | 42 ++++++++++++++++++----------
> ----
>  1 file changed, 24 insertions(+), 18 deletions(-)
> 
> diff --git a/tests/TestSuite_metering_and_policing.py
> b/tests/TestSuite_metering_and_policing.py
> index 38687e6..c4c83d6 100644
> --- a/tests/TestSuite_metering_and_policing.py
> +++ b/tests/TestSuite_metering_and_policing.py
> @@ -1,6 +1,6 @@
>  #BSD LICENSE
>  #
> -# Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
> +# Copyright(c) 2010-2019 Intel Corporation. All rights reserved.
>  # All rights reserved.
>  #
>  # Redistribution and use in source and binary forms, with or without @@ -
> 28,14 +28,12 @@  # 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.
> -
> -
> -
> -
>  """
>  DPDK Test suite.
>  Test metering_and_policing.
>  """
> +
> +import os
>  import utils
>  import string
>  import time
> @@ -55,7 +53,8 @@ class TestMeteringAndPolicing(TestCase):
>          file = 'meter_and_policy_config.tar.gz'
>          src_file = r'./dep/%s' % file
>          dst1 = '/tmp'
> -        dst2 = '/root/dpdk/drivers/net/softnic'
> +        dst2 = os.sep.join([self.target_dir,
> +                            'drivers/net/softnic'])
>          self.dut.session.copy_file_to(src_file, dst1)
>          self.dut.send_expect("tar xf %s/%s -C %s" % (dst1, file, dst2), "#", 30)
> 
> @@ -63,9 +62,12 @@ class TestMeteringAndPolicing(TestCase):
>          """
>          Update firmware.cli.
>          """
> -        self.ori_firmware_cli =
> "/root/dpdk/drivers/net/softnic/meter_and_policing_firmware.cli"
> +        self.ori_firmware_cli = os.sep.join([self.target_dir,
> +
> + 'drivers/net/softnic/meter_and_policing_firmware.cli'])
> +
>          if len(self.dut_ports) == 4:
> -            self.ori_firmware_cli =
> "/root/dpdk/drivers/net/softnic/meter_and_policing_firmware_4ports.cli"
> +            self.ori_firmware_cli = os.sep.join([self.target_dir,
> +
> + "drivers/net/softnic/meter_and_policing_firmware_4ports.cli"])
>          self.new_firmware_cli = "%s-%s" % (self.ori_firmware_cli, caseID)
>          self.dut.send_expect("rm -f %s" % self.new_firmware_cli, "#")
>          self.dut.send_expect("cp %s %s" % (self.ori_firmware_cli,
> self.new_firmware_cli), "#") @@ -102,21 +104,21 @@ class
> TestMeteringAndPolicing(TestCase):
>          else:
>              self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s acl ipv4 offset 270 size
> 4K action AP0/g' %s"
>                                   % (temp, temp, self.new_firmware_cli), "#")
> -
>          # use .sh file as RX table
>          temp = "pipeline RX table 0 dscp"
> +        target_dir = '\/'.join(self.target_dir.split('/'))
>          if caseID == 10:
> -            self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s
> \/root\/dpdk\/drivers\/net\/softnic\/dscp_red.sh/g' %s"
> -                                 % (temp, temp, self.new_firmware_cli), "#")
> +            self.dut.send_expect("sed -i -e
> 's/^.*%s.*$/%s  %s\/drivers\/net\/softnic\/dscp_red.sh/g' %s"
> +                                 % (temp, temp, target_dir,
> + self.new_firmware_cli), "#")
>          elif caseID == 11:
> -            self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s
> \/root\/dpdk\/drivers\/net\/softnic\/dscp_yellow.sh/g' %s"
> -                                 % (temp, temp, self.new_firmware_cli), "#")
> +            self.dut.send_expect("sed -i -e
> 's/^.*%s.*$/%s  %s\/drivers\/net\/softnic\/dscp_yellow.sh/g' %s"
> +                                 % (temp, temp, target_dir,
> + self.new_firmware_cli), "#")
>          elif caseID == 12:
> -            self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s
> \/root\/dpdk\/drivers\/net\/softnic\/dscp_green.sh/g' %s"
> -                                 % (temp, temp, self.new_firmware_cli), "#")
> +            self.dut.send_expect("sed -i -e
> 's/^.*%s.*$/%s  %s\/drivers\/net\/softnic\/dscp_green.sh/g' %s"
> +                                 % (temp, temp, target_dir,
> + self.new_firmware_cli), "#")
>          elif caseID == 13:
> -            self.dut.send_expect("sed -i -e 's/^.*%s.*$/%s
> \/root\/dpdk\/drivers\/net\/softnic\/dscp_default.sh/g' %s"
> -                                 % (temp, temp, self.new_firmware_cli), "#")
> +            self.dut.send_expect("sed -i -e
> 's/^.*%s.*$/%s  %s\/drivers\/net\/softnic\/dscp_default.sh/g' %s"
> +                                 % (temp, temp, target_dir,
> + self.new_firmware_cli), "#")
> 
>          # thread * pipeline RX/TX enable
>          self.dut.send_expect("sed -i -e 's/thread 5 pipeline RX
> enable/thread %d pipeline RX enable/g' %s"
> @@ -257,7 +259,7 @@ class TestMeteringAndPolicing(TestCase):
>              for i in range(0, len(self.dut_ports)):
>                  self.verify(int(tx_packets_port[i]) == 0, "Wrong: the packet is not
> dropped")
>          else:
> -            self.verify(int(tx_packets_port[expect_port]) == 1, "Wrong: can't
> forward package to port %d " % expect_port)
> +            self.verify(int(tx_packets_port[expect_port]) == 1, "Wrong:
> + can't forward packet to port %d " % expect_port)
> 
>      def run_param(self, cbs, pbs, head):
>          """
> @@ -278,6 +280,10 @@ class TestMeteringAndPolicing(TestCase):
>          """
>          Run at the start of each test suite.
>          """
> +        # get absolute directory of target source code
> +        self.target_dir = '/root' + self.dut.base_dir[1:] \
> +                          if self.dut.base_dir.startswith('~') else \
> +                          self.dut.base_dir
>          self.dut_ports = self.dut.get_ports()
>          self.port_nums = 2
>          self.verify(len(self.dut_ports) >= self.port_nums,
> --
> 1.9.3


      parent reply	other threads:[~2019-05-29  3:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-27  2:04 yufengmx
2019-05-27  2:04 ` yufengmx
2019-05-27  2:15   ` Li, WenjieX A
2019-05-27  8:21   ` Li, WenjieX A
2019-05-29  2:59   ` Tu, Lijuan [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=8CE3E05A3F976642AAB0F4675D0AD20E0BA867B1@SHSMSX101.ccr.corp.intel.com \
    --to=lijuan.tu@intel.com \
    --cc=dts@dpdk.org \
    --cc=yufengx.mo@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).