From patchwork Thu Nov 9 18:14:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Radoslaw Biernacki X-Patchwork-Id: 118477 Delivered-To: patch@linaro.org Received: by 10.80.225.132 with SMTP id k4csp1233566edl; Thu, 9 Nov 2017 10:15:22 -0800 (PST) X-Google-Smtp-Source: ABhQp+Su1GcJh1pfebYp8SlcS1gnloG2H3ftAT1hi6ZM1N6OPa4Xw/wuJ2ftwu19LEWuUjllmsdB X-Received: by 10.223.132.129 with SMTP id 1mr1149398wrg.136.1510251322383; Thu, 09 Nov 2017 10:15:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510251322; cv=none; d=google.com; s=arc-20160816; b=ytK8NZBM5Mv8DD2JFehOEAS1nBUqXYd9mzXiqVaN/fBEtJX3Sc9qJ6EqdrSB6HL3x/ xD/lB9Q2XP58agFFZ2msIeGVpgMQNBuZEpUyuMB0prZO0YYIBLsd713DrWTIXxXDIB2w WNsO+eq8Ia84eCnwcqS1lfyGdNieFq+hyQxhevcqgxzKnk+rB+soppj0LOzeM27dFAKq OgBqIhGTVbqtba3dK43BfDaPM2BLeOaA50c+t9+jFJe8YlAq5gikTZ8GGIDvOu5YvAAL ANu5Gq911PVc2gvJITp8z8d9LDZwQ1c+L+4lZ1rfLXz1S1lFxOQ9eDYY780HhX3cXFye DdTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:cc:to :from:dkim-signature:arc-authentication-results; bh=WVth3NQ/LenyHtQ0T0G0b5nuWl7/WkT+vuZemCd8oxU=; b=CRoEWQzVzpb3CURjSkzL5U0bCf/FWt0sycLAGdMBlZbwo9H2TU6ugC0+m0ONsOwdyg AEG6+WP9PZdkC+06xorTMFnVX83I2MEIJTw+t3lB7wCamocWbM41ZB7N868shqjchk9V zJurH1Qywiw9ufiO6CWZJBafparm/phhiXoPGJ7AerjyS/YZRWoZMh7tYBNMaDfKkRD3 ts7MRQand2Q22kYjWd9Hg1bOVxunSHIRCi93NnSe9O0CDpCnfPUBKwZywxGWclnLV8Vu vrEvfohiMYLJBGPBgJE894RiSomCHVdm45aTYGZmNYopQe84jX2wLnHwn2bWJEnzZZlH CdJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fhr9Gr7Q; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id o99si7247269wrc.85.2017.11.09.10.15.22; Thu, 09 Nov 2017 10:15:22 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fhr9Gr7Q; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 696571B3BB; Thu, 9 Nov 2017 19:15:21 +0100 (CET) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id 107212BB8 for ; Thu, 9 Nov 2017 19:15:19 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id e102so3972374lfi.3 for ; Thu, 09 Nov 2017 10:15:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=WVth3NQ/LenyHtQ0T0G0b5nuWl7/WkT+vuZemCd8oxU=; b=fhr9Gr7QcWe//T10xAIE+NpjTcOncoktIOWHBsuNpqLglVI3fvZJ2aiVjXgxUaJp7Z geOg0GKv8wSJPKQEGP0fCDdXlseMfLqxA2xlumtde/323Q5Qs69sLoBMN7jyoBeANjht 86tGi3saX4phZEQeHId5LWDSulpM6cPwOSC50= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WVth3NQ/LenyHtQ0T0G0b5nuWl7/WkT+vuZemCd8oxU=; b=bVuh5349OE3H93VV+DJDqgC7lIcyQdSmZ/tQv8oWMVdcEbU4SYLTybc827P+jTegoN xCFOI67uqp5hJc+prts9eUZGvSRKmLLACCZSmkPpGA3zrUq6fM52CK3R2rIO6xeN7RLC wd4a48UsHRZ93B5FMaY+ERLIT645YPa6TLym98Z+uS3frhLDKtll7T8ku6FHR7aLiDTN evXqBsv1byekfUISWum6kxMbi7B9A6cj4qJw7GCRUeY7yXIjVU/0FVMTNCa5uWZkk+Hf AbMoPQSEGq2WrPEN+nfTZbUc0cxkjhDLl2pbvDllHaHt1diaTHWs7SwI3r0SHSLWmrpY GM/w== X-Gm-Message-State: AJaThX6u4Ag86T6Ml1FuysPAb/1XNGQhiHSO9nNsxH5mza/k5cglAIys k1/BXA1XVIPhbAlv4qzRwzA19RQWC2U= X-Received: by 10.25.215.222 with SMTP id q91mr645351lfi.25.1510251319272; Thu, 09 Nov 2017 10:15:19 -0800 (PST) Received: from rad-H81M-S1.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id g192sm1324087lfg.42.2017.11.09.10.15.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Nov 2017 10:15:18 -0800 (PST) From: Radoslaw Biernacki To: dev@dpdk.org, sergio.gonzalez.monroy@intel.com Cc: santosh.shukla@caviumnetworks.com, anatoly.burakov@intel.com, thomas@monjalon.net Date: Thu, 9 Nov 2017 19:14:32 +0100 Message-Id: <1510251272-32549-1-git-send-email-radoslaw.biernacki@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] test/memory: fixing line parsing in memory 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" 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 --- test/test/autotest_test_funcs.py | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) -- 2.7.4 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"