test suite reviews and discussions
 help / color / mirror / Atom feed
From: Herbert Guan <Herbert.Guan@arm.com>
To: "Liu, Yong" <yong.liu@intel.com>
Cc: "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH] framework: enhance the tcpdump direction option parsing Some tcpdump versions (such as 4.9.0-5.el7) is providing help message about direction option with both '-P' and '-Q': "		[ -Q|-P in|out|inout ]". This format cause option parse fail. This
Date: Mon, 6 Nov 2017 07:59:57 +0000	[thread overview]
Message-ID: <HE1PR08MB280987CA847BF07B58EFFE1286500@HE1PR08MB2809.eurprd08.prod.outlook.com> (raw)

Sorry, this message has problems with subject.  I've corrected it and sent out another mail.

Please ignore this one.


Thanks,
Herbert

-----Original Message-----
From: Herbert Guan [mailto:herbert.guan@arm.com]
Sent: Monday, November 6, 2017 15:55
To: dts@dpdk.org
Cc: Herbert Guan <Herbert.Guan@arm.com>
Subject: [PATCH] framework: enhance the tcpdump direction option parsing Some tcpdump versions (such as 4.9.0-5.el7) is providing help message about direction option with both '-P' and '-Q': " [ -Q|-P in|out|inout ]". This format cause option parse fail. This ...

Signed-off-by: Herbert Guan <herbert.guan@arm.com>
---
 framework/packet.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/framework/packet.py b/framework/packet.py index 1907612..4ee51dd 100755
--- a/framework/packet.py
+++ b/framework/packet.py
@@ -787,14 +787,20 @@ def sniff_packets(intf, count=0, timeout=5, filters=[]):
     sniff all packets for certain port in certain seconds
     """
     param = ""
-    direct_param = r"(\s+)\[ -(\w) in\|out\|inout \]"
+    direct_param = r"(\s+)\[ (\S+) in\|out\|inout \]"
     tcpdump_help = subprocess.check_output("tcpdump -h; echo 0",
                                            stderr=subprocess.STDOUT,
                                            shell=True)
     for line in tcpdump_help.split('\n'):
         m = re.match(direct_param, line)
         if m:
-            param = "-" + m.group(2) + " in"
+            opt = re.search("-Q", m.group(2));
+            if opt:
+                param = "-Q" + " in"
+            else:
+                opt = re.search("-P", m.group(2));
+                if opt:
+                    param = "-P" + " in"

     if len(param) == 0:
         print "tcpdump not support direction chioce!!!"
--
1.8.3.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

                 reply	other threads:[~2017-11-06  7:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=HE1PR08MB280987CA847BF07B58EFFE1286500@HE1PR08MB2809.eurprd08.prod.outlook.com \
    --to=herbert.guan@arm.com \
    --cc=dts@dpdk.org \
    --cc=yong.liu@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).