test suite reviews and discussions
 help / color / mirror / Atom feed
From: yufengmx <yufengx.mo@intel.com>
To: dts@dpdk.org, wenjiex.a.li@intel.com
Cc: xueqin.lin@intel.com, yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V1 1/1] tests/flow_classify: fix check condition logic error
Date: Wed, 25 Sep 2019 13:07:41 +0800	[thread overview]
Message-ID: <20190925050741.44855-2-yufengx.mo@intel.com> (raw)
In-Reply-To: <20190925050741.44855-1-yufengx.mo@intel.com>


fix check condition logic error.
missed use local directory check method, change os.path.exists to is_existed_on_crb.

Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
 tests/TestSuite_flow_classify.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/tests/TestSuite_flow_classify.py b/tests/TestSuite_flow_classify.py
index ffa6136..c51b0a2 100644
--- a/tests/TestSuite_flow_classify.py
+++ b/tests/TestSuite_flow_classify.py
@@ -46,6 +46,16 @@ from settings import HEADER_SIZE
 
 class TestFlowClassify(TestCase):
 
+    def is_existed_on_crb(self, check_path, crb='dut'):
+        alt_session = self.dut.alt_session \
+                      if crb == 'dut' else \
+                      self.tester.alt_session
+        alt_session.send_expect("ls %s > /dev/null 2>&1" % check_path, "# ")
+        cmd = "echo $?"
+        output = alt_session.send_expect(cmd, "# ")
+        ret = True if output and output.strip() == "0" else False
+        return ret
+
     def get_cores_mask(self, config='all'):
         sockets = [self.dut.get_numa_id(index) for index in self.dut_ports]
         socket_count = Counter(sockets)
@@ -291,7 +301,7 @@ class TestFlowClassify(TestCase):
                                    'examples',
                                    'flow_classify',
                                    'ipv4_rules_file.txt'])
-        if not os.path.exists(rule_config):
+        if not self.is_existed_on_crb(rule_config):
             raise VerifyFailure("rules file doesn't existed")
         core = "1S/1C/1T"
         option = r" -c {0} -n 4 --file-prefix=test -- --rule_ipv4={1}".format(
@@ -390,7 +400,7 @@ class TestFlowClassify(TestCase):
             elif flow_type == 'single_stream':
                 if rule_priority is None and captured_pkts != 0:
                     msg = "invalid stream hasn't been filtered out"
-                elif rule_priority is None and captured_pkts != total_packets:
+                elif rule_priority and captured_pkts != total_packets:
                     msg = "expect {0} ".format(total_packets) + \
                           "captured {0}".format(captured_pkts)
                 else:
-- 
2.21.0


  reply	other threads:[~2019-09-25  5:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25  5:07 [dts] [PATCH V1 0/1] " yufengmx
2019-09-25  5:07 ` yufengmx [this message]
2019-09-25  5:32   ` [dts] [PATCH V1 1/1] " Li, WenjieX A
2019-09-25  5:47   ` Tu, Lijuan

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=20190925050741.44855-2-yufengx.mo@intel.com \
    --to=yufengx.mo@intel.com \
    --cc=dts@dpdk.org \
    --cc=wenjiex.a.li@intel.com \
    --cc=xueqin.lin@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).