From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A4E3FA0C3F; Thu, 15 Apr 2021 16:03:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82C5D162298; Thu, 15 Apr 2021 16:03:28 +0200 (CEST) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by mails.dpdk.org (Postfix) with ESMTP id 118C8162296 for ; Thu, 15 Apr 2021 16:03:27 +0200 (CEST) Received: by mail-qk1-f173.google.com with SMTP id d15so12259836qkc.9 for ; Thu, 15 Apr 2021 07:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4iXM0ZDkKtpWYei5bBrPuUh6dLt/tGM6oRBGS+MTYa8=; b=cUFmS9epHEJg8wmteR/EnIzcfmakbsH1R/anMEHrsVnsd1C99bvh7g+z5Jd+MTYMKi KjyIzDuNkcONjod4RjOzI0y+1rhL3v0qiPVySHhbMiCPRqjMnhjqn+6bC+iHHxb6Ae0a rs+VZa6H7UkEMG2Vma6e+wbOCxDZPKHMR8xhA= 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:mime-version :content-transfer-encoding; bh=4iXM0ZDkKtpWYei5bBrPuUh6dLt/tGM6oRBGS+MTYa8=; b=lTIJfiyEXU2ltr4HJ/HeTwF1L7BnPTPqGVt5f3nkoGzp1L61LYEMAAC5jmR0LiTUy3 oSm1WaaO+b8Td7nK5BHUqHYmk8Gi16po7KclHc9WFm3RQdVqYyjUoPAZYfXwLC1oHpD2 Ryv+ImuXeE22cbOwgMNeK+SMTrXs3N2W7Xc6ujvS7cLxFOcDbkaWNOJsFoJSQpudsVoy q8FFPyvM7FBIeGTvh2pCQn9dSx59qs+jIsYhnRZO99WaOOazzixKrfKNPWqLFzIQAUWz FhKMqZ0aloPXlkvX00Ldb8Q1y3lBaE7cpdn+zOHl6VnrCL2ycQbdKYsEIdE6z9VHVipp G6qA== X-Gm-Message-State: AOAM53160L9slSOffFOe3psyDRbZsOVzyHsrWBc1jlhZZSsfh9tofRpO Q98+vNFuWby78Id/BYI+cfqicpDXhViH2rUy6Mf0E5kYUUyoXvhI/vFQOL2vStrx2HxjQ/zOs3t pkkNXvopT9yX0uQDkbVH+S+7VA4OttYtFJnac4Rx7oL8n/KsJQTIn40E= X-Google-Smtp-Source: ABdhPJxv6qkGJ09JHYDJ+kXxpoMIL744nlNQGfjsX9DldZlD1jfjmmmljtg3nd9rUbxhP1Qyuhmkbw== X-Received: by 2002:a37:2e87:: with SMTP id u129mr3651172qkh.316.1618495404535; Thu, 15 Apr 2021 07:03:24 -0700 (PDT) Received: from ubuntu.localdomain ([2606:4100:3880:1254::1053]) by smtp.gmail.com with ESMTPSA id v11sm1799892qtx.79.2021.04.15.07.03.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 07:03:24 -0700 (PDT) From: dliu To: dts@dpdk.org Cc: Owen Hilyard Date: Thu, 15 Apr 2021 10:03:02 -0400 Message-Id: <20210415140303.22620-1-dliu@iol.unh.edu> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dts] [PATCH] Strip prompt by default in send_expect X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" From: Owen Hilyard During investigation of timeout exceptions during performance testing, the community lab found that trailing whitespace in run commands was the cause of some of the timeouts. This patch makes the Crb version of send_expect strip whitespace from the expected string by default. It is possible to disable this behavior should it be needed, but we expect that the majority of use-cases are matching non-whitespace characters. Signed-off-by: Owen Hilyard --- framework/crb.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/framework/crb.py b/framework/crb.py index e7c1cc1c..3964e213 100644 --- a/framework/crb.py +++ b/framework/crb.py @@ -79,12 +79,19 @@ class Crb(object): self.alt_session = None def send_expect(self, cmds, expected, timeout=TIMEOUT, - alt_session=False, verify=False): + alt_session=False, verify=False, trim_whitespace=True): """ Send commands to crb and return string before expected string. If there's no expected string found before timeout, TimeoutException will be raised. + + By default, it will trim the whitespace from the expected string. This + behavior can be turned off via the trim_whitespace argument. """ + + if trim_whitespace: + expected = expected.strip() + # sometimes there will be no alt_session like VM dut if alt_session and self.alt_session: return self.alt_session.session.send_expect(cmds, expected, -- 2.27.0