From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 34A8E5A026D for ; Thu, 7 Dec 2023 07:26:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701930366; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C11iKa3ClabjmeCezKQjtglBIdxUHSh/jz7MZLM8SoE=; b=SAufFySiqN7UJNEw3r9OUTzdWjvysc5jHxApts6aQA9sRxa9ljTVNzP6xhi4npoED7kILJ 2FmwKkvyZaMJugVo8r1wnNWSalDy/kEQE/y1HR4OlhYe70ABONR+mG5y9X6nZdzmHMm8It 9s/RFZ5S9e44Pthjpw4usoP+lOC0Kyg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-313-2zj0FvOqOMewSdpnqJqOMg-1; Thu, 07 Dec 2023 01:26:04 -0500 X-MC-Unique: 2zj0FvOqOMewSdpnqJqOMg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 252E63C02768; Thu, 7 Dec 2023 06:26:04 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 543FA492BE6; Thu, 7 Dec 2023 06:26:03 +0000 (UTC) Date: Thu, 7 Dec 2023 07:26:01 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] test: Make handling of shell prompts with escapes a little more reliable Message-ID: <20231207072601.20443732@elisabeth> In-Reply-To: References: <20231123015253.1692422-1-david@gibson.dropbear.id.au> <20231204105433.2a4df0d2@elisabeth> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: AJDH3EBPC4NSRHPXCJTQOATX4KCQBBM3 X-Message-ID-Hash: AJDH3EBPC4NSRHPXCJTQOATX4KCQBBM3 X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 7 Dec 2023 12:09:26 +1100 David Gibson wrote: > On Mon, Dec 04, 2023 at 10:54:33AM +0100, Stefano Brivio wrote: > > On Thu, 23 Nov 2023 12:52:53 +1100 > > David Gibson wrote: > > > > > When using the old-style "pane" methods of executing commands during the > > > tests, we need to scan the shell output for prompts in order to tell when > > > commands have finished. This is inherently unreliable because commands > > > could output things that look like prompts, and prompts might not look like > > > we expect them to. The only way to really fix this is to use a better way > > > of dispatching commands, like the newer "context" system. > > > > > > However, it's awkward to convert everything to "context" right at the > > > moment, so we're still relying on some tests that do work most of the time. > > > It is, however, particularly sensitive to fancy coloured prompts using > > > escape sequences. Currently we try to handle this by stripping actual > > > ESC characters with tr, then looking for some common variants. > > > > > > We can do a bit better: instead strip all escape sequences using sed before > > > looking for our prompt. Or, at least, any one using [a-zA-Z] as the > > > terminating character. Strictly speaking ANSI escapes can be terminated by > > > any character in 0x40..0x7e, which isn't easily expressed in a regexp. > > > This should capture all common ones, though. > > > > > > With this transformation we can simplify the list of patterns we then look > > > for as a prompt, removing some redundant variants. > > > > > > Signed-off-by: David Gibson > > > > I didn't forget about this one, but I had unrelated test failures which > > I wasn't sure about. This is actually fine though. Applying soon. > > I don't think there's any particular need to make a release for it, > but it would be nice to get this in the main git tree, so I don't have > to keep awkwardly carrying it about to test my other branches. Okay, merged just this one without re-testing. -- Stefano