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 48054A0C3F; Thu, 15 Apr 2021 16:09:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 20C3D161C88; Thu, 15 Apr 2021 16:09:47 +0200 (CEST) Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) by mails.dpdk.org (Postfix) with ESMTP id 2B4EF161C86 for ; Thu, 15 Apr 2021 16:09:45 +0200 (CEST) Received: by mail-qk1-f180.google.com with SMTP id d23so13211793qko.12 for ; Thu, 15 Apr 2021 07:09:45 -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=hgVyo65nRavrfNAcsvwrRm8Fd4JDxqvnK0UpDJwV0FHFv///3paXqbvfAcGvQH9uax Z8kcmIXLl9dG8tAPQ0wY/swWhaUKBfRCe1MCy6avPP7cDSESczU2qP2t6oM6MZD87OVs vzCy9EMShKrWIFrY9u34BpO9r22ucLpfpa0BI= 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=rwTvifFHSaREC89NxKen/IixjOz6rNbscIFBIplHnROrvcVoeUfPa59d84WgCJct0T VBPYofbYXlkOyo5lJCfMAVycDdhnnqlcI7er6dSNkmWqID4EFJ8dlqUzNnjAUCnxvGkY bz8ow7Ky/u60vPgg1XylqRQMlwZPdsiMQ36gU3u8BAMhiOueSNgfbw0jLpQHwd5wp78/ b4zvLkzJAUR/Z4lnn6gz2OMYS/eALG7YkNEwjTOnXrbBRiLuD+/OVTE0Ml/8C+iin9lK KrWGJLU31bE9aCy/qnrj1jAlLz1wu1FNc+tXsr7QBy8OebEx36wPfdxdp1ARynOL2L7b dtuw== X-Gm-Message-State: AOAM532Yro1Zy+y15FT6TeHyiwyp82kLp0WzlkXY+NK6h0WAUjXWVjMS 3uXLLsiy/TPFnv0StJ1mbkO4ZeOh321IP23o0MuCMnZgsHWc8DRqmdvYy82H0R8MJQJ6CSnPGvj xpd6EPpQZW5AIhteM0tmdX5Xe05pzKutZrKVb+W40kLEJE+Xt/MsxbNE= X-Google-Smtp-Source: ABdhPJxPjzrk29vviyTbqtESvwLDtzDqbBLF01GjN2U+j9WqvAE26DL5eijS8iyQKcU8525exYcgQA== X-Received: by 2002:ae9:df82:: with SMTP id t124mr3508359qkf.267.1618495784175; Thu, 15 Apr 2021 07:09:44 -0700 (PDT) Received: from ubuntu.localdomain ([2606:4100:3880:1254::1053]) by smtp.gmail.com with ESMTPSA id n136sm2006331qka.133.2021.04.15.07.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 07:09:43 -0700 (PDT) From: dliu To: dts@dpdk.org Cc: lijuan.tu@intel.com, Owen Hilyard Date: Thu, 15 Apr 2021 10:09:32 -0400 Message-Id: <20210415140933.23185-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