From: Joyce Kong <joyce.kong@arm.com>
To: dev@dpdk.org
Cc: nd@arm.com, thomas@monjalon.net, david.marchand@redhat.com,
stephen@networkplumber.org, jerin.jacob@caviumnetworks.com,
konstantin.ananyev@intel.com, honnappa.nagarahalli@arm.com,
gavin.hu@arm.com
Subject: [dpdk-dev] [PATCH v1] test/ticketlock: implement ticketlock autotest
Date: Mon, 15 Apr 2019 17:04:39 +0800 [thread overview]
Message-ID: <1555319079-21542-1-git-send-email-joyce.kong@arm.com> (raw)
Add ticketlock_autotest implementation in python.
Fixes: efbcdaa55b93 ("test/ticketlock: add test cases")
Signed-off-by: Joyce Kong <joyce.kong@arm.com>
---
app/test/autotest_data.py | 2 +-
app/test/autotest_test_funcs.py | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/app/test/autotest_data.py b/app/test/autotest_data.py
index db25274..72c56e5 100644
--- a/app/test/autotest_data.py
+++ b/app/test/autotest_data.py
@@ -175,7 +175,7 @@
"Command": "ticketlock_autotest",
"Func": ticketlock_autotest,
"Report": None,
- }
+ },
{
"Name": "Byte order autotest",
"Command": "byteorder_autotest",
diff --git a/app/test/autotest_test_funcs.py b/app/test/autotest_test_funcs.py
index 65fe335..31cc0f5 100644
--- a/app/test/autotest_test_funcs.py
+++ b/app/test/autotest_test_funcs.py
@@ -131,6 +131,40 @@ def rwlock_autotest(child, test_name):
return 0, "Success"
+def ticketlock_autotest(child, test_name):
+ i = 0
+ ir = 0
+ child.sendline(test_name)
+ while True:
+ index = child.expect(["Test OK",
+ "Test Failed",
+ "Hello from core ([0-9]*) !",
+ "Hello from within recursive locks "
+ "from ([0-9]*) !",
+ pexpect.TIMEOUT], timeout=5)
+ # ok
+ if index == 0:
+ break
+
+ # message, check ordering
+ elif index == 2:
+ if int(child.match.groups()[0]) < i:
+ return -1, "Fail [Bad order]"
+ i = int(child.match.groups()[0])
+ elif index == 3:
+ if int(child.match.groups()[0]) < ir:
+ return -1, "Fail [Bad order]"
+ ir = int(child.match.groups()[0])
+
+ # fail
+ elif index == 4:
+ return -1, "Fail [Timeout]"
+ elif index == 1:
+ return -1, "Fail"
+
+ return 0, "Success"
+
+
def logs_autotest(child, test_name):
child.sendline(test_name)
--
2.7.4
next reply other threads:[~2019-04-15 9:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 9:04 Joyce Kong [this message]
2019-04-15 9:04 ` Joyce Kong
2019-04-15 15:45 ` Phil Yang (Arm Technology China)
2019-04-15 15:45 ` Phil Yang (Arm Technology China)
2019-04-15 20:41 ` Thomas Monjalon
2019-04-15 20:41 ` 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=1555319079-21542-1-git-send-email-joyce.kong@arm.com \
--to=joyce.kong@arm.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=gavin.hu@arm.com \
--cc=honnappa.nagarahalli@arm.com \
--cc=jerin.jacob@caviumnetworks.com \
--cc=konstantin.ananyev@intel.com \
--cc=nd@arm.com \
--cc=stephen@networkplumber.org \
--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).