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.133.124]) by passt.top (Postfix) with ESMTP id B02125A027F for ; Mon, 4 Dec 2023 10:54:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701683679; 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=h0PGVJCdGiGT3CsFUaudrcN+9cdG4NX3WuVqaHZTOq4=; b=GaBuhNV+BL+9nq8oDEjPgpCEXhDjGcJVCQpKn+YPBjPhUWMs69T3p+VtiiI6dOTMXIJNSa In0zzb4fVfgkIKZnekylQrFSoxRiwP0RMDQ30QabIcD3XKIMR9Z+WfQbWq+mKqirff94N9 3GjCmRRgsFgTMRkuKQrpbb1rSWX+SVY= 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-472-gvwZZBc0OkCMFUWcNl36XQ-1; Mon, 04 Dec 2023 04:54:37 -0500 X-MC-Unique: gvwZZBc0OkCMFUWcNl36XQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (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 F192B3C025D1; Mon, 4 Dec 2023 09:54:36 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D38140C6EB9; Mon, 4 Dec 2023 09:54:35 +0000 (UTC) Date: Mon, 4 Dec 2023 10:54:33 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] test: Make handling of shell prompts with escapes a little more reliable Message-ID: <20231204105433.2a4df0d2@elisabeth> In-Reply-To: <20231123015253.1692422-1-david@gibson.dropbear.id.au> References: <20231123015253.1692422-1-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 4WLKJZ2NNV63RD4WSQ6HII26JUO3ATRB X-Message-ID-Hash: 4WLKJZ2NNV63RD4WSQ6HII26JUO3ATRB 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, 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. -- Stefano