From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AGs4zMaeWA+BvHde1lZkAAl6HaAxaYQ9/gupreL+vBbRdAiUL48EN+34szcDacA0R0SiekczgoM7BQ== 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: , X-List-Received-Date: Thu, 09 Nov 2017 18:15:20 -0000 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(-) 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