From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id C7CCA5A0271 for ; Thu, 7 Dec 2023 02:09:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1701911376; bh=YPlhF33S4Vl1sHATjEk59o89hJWicDXGeV/Acs6k4mE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lY/hBK2WuC4jGvMPzCMPa9CAwUEQPXtSdsnRmuyn8YMaNp2FbaEu2WjJSKFxpstFQ QqyMLi0T3QMx9OKyZaHHconzk6tTKl/rcAqDci/1/hgXOesj23FASTj/fEB250vI+V 1tMuQryM1XpvEQsnwkGfMsgFby38mJxLxtjrFps+V/CAwSqzjyT53KFa05XWlQPknQ 9MJuqVWoT+UcLMeWOK2pJmgIS2JCa0ddfFV0M1MuLsRvgIGHgtYejYAnRJSvn4JDHN kiy8JXNVBdKhFH6bsrVRwGq3LYElr57+aOOMAtyzQi27k89rSyInrkKDrt/omRrZ5M EAsLoi/EXx9bg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Slx4w0KLbz4wcJ; Thu, 7 Dec 2023 12:09:36 +1100 (AEDT) Date: Thu, 7 Dec 2023 12:09:26 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] test: Make handling of shell prompts with escapes a little more reliable Message-ID: References: <20231123015253.1692422-1-david@gibson.dropbear.id.au> <20231204105433.2a4df0d2@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="YP+zWmx2awaZLaGV" Content-Disposition: inline In-Reply-To: <20231204105433.2a4df0d2@elisabeth> Message-ID-Hash: DB5MN2FBUMPDSDHJQ6PJZ7JFLAAG3NZN X-Message-ID-Hash: DB5MN2FBUMPDSDHJQ6PJZ7JFLAAG3NZN X-MailFrom: dgibson@gandalf.ozlabs.org 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: --YP+zWmx2awaZLaGV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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: >=20 > > 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 wh= en > > 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. > >=20 > > 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 t= ime. > > 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. > >=20 > > We can do a bit better: instead strip all escape sequences using sed be= fore > > 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. > >=20 > > With this transformation we can simplify the list of patterns we then l= ook > > for as a prompt, removing some redundant variants. > >=20 > > Signed-off-by: David Gibson >=20 > 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. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --YP+zWmx2awaZLaGV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIyBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmVxG0UACgkQzQJF27ox 2GfFmg/3ejF1DxaWVkBq/7787hBNeMcWrVV1BJVyM/jJfE1jlaoNXmeNa1Clg3W2 wvpMS8M/l64Ko927wAE3Fn8zy+FJw5SKhCEXyyC8KD/hAwfcNOhVDsqtG+YXi2Ac R3BBWDUJiqukwbx26HD0TYUmDg+Ef8lIIdkvXX8q5NB/zqWsheoLnkkOM3K5gyVc y+eaBEU/kaE6YysqoxHFTbRpJCQc+jUW+tZ8vAziOZ8pCMh7xla7bo5iH5fF/dXd Z0ZGsGMqcH5VL3IhcIWDRZjbxnK22wqtsrlPOCULTFAKVRQytmf7GcOFtHeJyket iCowl+Lu7CP6lW49e9FRnGtOU0KmnmaLnJQa7UEYkdrj4MXavweI1yDHQvnhqfz1 VbgjxB6HJQRFfthLsqGp8dyHf0Of7klNOMaEn1LUY38guR9c585eq4/FiVrYry6G NWzOtNb9IThyZD/XRt9d1TCuVyu1cq6xMjclHqBkxTMwTmELHSziVd4/dIsgnxwa 1qlIzI1pkjjsQ45oc4bFLHjF13ZafHiMtYOZEuJl8bvQ8NnAzVRv1u0B5t6eIhls 4okOtXI9unFxN7i7Jd6CBKKW+DiE0gJKkA9jRoEebeaHYGcSlKxWNnsH7P2JFIQd d5oW7rULciXtKRR7+CROg3lqFgmh9+ZhjDTC32F8r38bB0h/bA== =IVl0 -----END PGP SIGNATURE----- --YP+zWmx2awaZLaGV--