From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6374FA00E6 for ; Mon, 15 Apr 2019 11:14:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E8881B144; Mon, 15 Apr 2019 11:14:52 +0200 (CEST) Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id DBE1B1B142 for ; Mon, 15 Apr 2019 11:14:49 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 497C7374; Mon, 15 Apr 2019 02:05:03 -0700 (PDT) Received: from net-arm-thunderx2.shanghai.arm.com (net-arm-thunderx2.shanghai.arm.com [10.169.40.39]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AA5463F68F; Mon, 15 Apr 2019 02:05:01 -0700 (PDT) From: Joyce Kong 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 Date: Mon, 15 Apr 2019 17:04:39 +0800 Message-Id: <1555319079-21542-1-git-send-email-joyce.kong@arm.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v1] test/ticketlock: implement ticketlock autotest X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190415090439.zqHNevH6uhrkkgCji2drvKjKS-lL2NSacEoh8aDuNDk@z> Add ticketlock_autotest implementation in python. Fixes: efbcdaa55b93 ("test/ticketlock: add test cases") Signed-off-by: Joyce Kong --- 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