DPDK patches and discussions
 help / color / mirror / Atom feed
From: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
To: dev@dpdk.org, sergio.gonzalez.monroy@intel.com
Cc: santosh.shukla@caviumnetworks.com, anatoly.burakov@intel.com,
	thomas@monjalon.net
Subject: [dpdk-dev] [PATCH] test/memory: fixing line parsing in memory autotest
Date: Thu,  9 Nov 2017 19:14:32 +0100	[thread overview]
Message-ID: <1510251272-32549-1-git-send-email-radoslaw.biernacki@linaro.org> (raw)

This patch fixes three problems in memory autotest:
 - the regex for IOVA
 - missing validation of second and following output lines
 - propagation of error to consecutive tests
 - conversion base for mem size (hex indtead of dec)
First fix is for changes introduced with IOVA, the regex was not
updated which lead to unit test failure.  Patch now also uses loop for
line outputs processing to verify more than just one line. By this we
also satisfy the pexpect() and scan the "Test OK"/"Test Failed" so in
case of error all output lines are consumed and does not break the
consecutive test (error does not propagate).

Fixes: 7ba49d39f14c ("mem: rename segment address from physical to IOVA")
Fixes: b4ce15aa2bc7 ("app/test: fix memory autotest")

Signed-off-by: Radoslaw Biernacki <radoslaw.biernacki@linaro.org>
---
 test/test/autotest_test_funcs.py | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/test/test/autotest_test_funcs.py b/test/test/autotest_test_funcs.py
index 8da8fcd..15fcb7c 100644
--- a/test/test/autotest_test_funcs.py
+++ b/test/test/autotest_test_funcs.py
@@ -62,21 +62,30 @@ def dump_autotest(child, test_name):
 
 
 def memory_autotest(child, test_name):
+    lines = 0
+    error = ''
     child.sendline(test_name)
-    regexp = "phys:0x[0-9a-f]*, len:([0-9]*), virt:0x[0-9a-f]*, " \
-             "socket_id:[0-9]*"
-    index = child.expect([regexp, pexpect.TIMEOUT], timeout=180)
-    if index != 0:
-        return -1, "Fail [Timeout]"
-    size = int(child.match.groups()[0], 16)
-    if size <= 0:
-        return -1, "Fail [Bad size]"
-    index = child.expect(["Test OK", "Test Failed",
-                          pexpect.TIMEOUT], timeout=10)
-    if index == 1:
-        return -1, "Fail"
-    elif index == 2:
-        return -1, "Fail [Timeout]"
+    while True:
+        regexp = "IOVA:0x[0-9a-f]*, len:([0-9]*), virt:0x[0-9a-f]*, " \
+                 "socket_id:[0-9]*"
+        index = child.expect([regexp, "Test OK", "Test Failed",
+                              pexpect.TIMEOUT], timeout=10)
+        if index == 3:
+            return -1, "Fail [Timeout]"
+        elif index == 1:
+            break
+        elif index == 2:
+            return -1, "Fail"
+        else:
+            lines = lines + 1
+            size = int(child.match.groups()[0], 10)
+            if size <= 0:
+                error = 'Bad size'
+
+    if lines <= 0:
+        return -1, "Fail [No entries]"
+    if error != '':
+        return -1, "Fail [{}]".format(error)
     return 0, "Success"
 
 
-- 
2.7.4

             reply	other threads:[~2017-11-09 18:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 18:14 Radoslaw Biernacki [this message]
2017-11-12  2:48 ` Thomas Monjalon

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=1510251272-32549-1-git-send-email-radoslaw.biernacki@linaro.org \
    --to=radoslaw.biernacki@linaro.org \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=santosh.shukla@caviumnetworks.com \
    --cc=sergio.gonzalez.monroy@intel.com \
    --cc=thomas@monjalon.net \
    /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).