From patchwork Sat Aug 13 06:54:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 41600 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C066527BBEA; Sat, 13 Aug 2022 07:57:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 8073027BBE9 for ; Sat, 13 Aug 2022 07:57:26 +0100 (BST) Received: from localhost ([::1]:44962 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMl5J-0006Ha-Kz for patchwork@mira.cbaines.net; Sat, 13 Aug 2022 02:57:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMl40-0004ld-TI for guix-patches@gnu.org; Sat, 13 Aug 2022 02:56:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41554) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMl40-0006XN-KA for guix-patches@gnu.org; Sat, 13 Aug 2022 02:56:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oMl40-0006s9-Gv for guix-patches@gnu.org; Sat, 13 Aug 2022 02:56:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57168] [PATCH 12/14] marionette: Improve the error message of 'wait-for-screen-text'. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 13 Aug 2022 06:56:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57168 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57168@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 57168-submit@debbugs.gnu.org id=B57168.166037370726292 (code B ref 57168); Sat, 13 Aug 2022 06:56:04 +0000 Received: (at 57168) by debbugs.gnu.org; 13 Aug 2022 06:55:07 +0000 Received: from localhost ([127.0.0.1]:59525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMl34-0006pu-Ar for submit@debbugs.gnu.org; Sat, 13 Aug 2022 02:55:07 -0400 Received: from mail-qt1-f173.google.com ([209.85.160.173]:37428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMl2t-0006me-Ji for 57168@debbugs.gnu.org; Sat, 13 Aug 2022 02:54:56 -0400 Received: by mail-qt1-f173.google.com with SMTP id l5so2290475qtv.4 for <57168@debbugs.gnu.org>; Fri, 12 Aug 2022 23:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=lYIPm5H8inivgn+bMnETzC0DXbRlDUBED5e7T2NHB64=; b=jtG0Abm32F/YEJEvGuEoAzt3oguXQuFvQ/06JAuB+RqZpsLHQJ++vFL00MBwFoL0WK XxtMcOpS/4/ugumMLqZJhVtRLSiAz4gkRIpoNoLEbjFOYlh8CUSHgsm3jbJ9cspPNczh acc4BMWp35KjXgR8ciIpOPFHpUO9JOEt/k99gX2xPXwL7KfaA0jXqD+Rg7UxFYX01tP1 KUq5S4pf5Q1WfoAZ2ABX9bnOX+1+FQQXOm2SGEHK5NtZ2JaVPVTRjzBvpgLA8tR1ebyU YdLslmlvNG7SRjfV4ugZwCu7boRRArgxcTeUVwD14Eu8oxR7Io5F85dxQTSaXrUGDGUl xV7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=lYIPm5H8inivgn+bMnETzC0DXbRlDUBED5e7T2NHB64=; b=707IemnSCbN4Q421neN+e9XEnHH8V2kK2wlAMcDW2tH0InCbRIcHHNTVNuM1Q368fJ UUqHPnDIS5SfNpHRpdX4V+zhEd9tP0JKYnFDjyRqKmcQBsy166c3yTMITR1446ZnvnSQ 3mYcQxgMfclpUPdoD12w+hxqSbHLXCyrKKOzrL8DDptJ4Z50L9GUjgl964i8LU4deEzA NUntNM8I0BPVsXWBMYb7fwjddvATE8FrKi4gbzq4LKcO54WBi8leXhmv073HVgoZeabW r90h//63ysqT+227UZifCw9SVgY3L6+QsjPuVtJ1gx5m9GIIMTPmp52+MRhxfgCKh9x3 6Xxw== X-Gm-Message-State: ACgBeo0cq71394cUKtSdB/kOm2ZMuphzfcMn1F/VxQJIG3MjcIQ2C8kp /6xmXMKBLfLZ/RItYR+mzMcJ2b+QNT4= X-Google-Smtp-Source: AA6agR4YWDXlWxZT54Z/jCA6+ouU2/KQM1w1w1aQokyq1COrNcVdlU/U9n+wFO+lZ2rMNkMWJG+Ikg== X-Received: by 2002:a05:622a:1701:b0:343:74dd:5d1e with SMTP id h1-20020a05622a170100b0034374dd5d1emr4976196qtk.6.1660373690043; Fri, 12 Aug 2022 23:54:50 -0700 (PDT) Received: from localhost.localdomain (dsl-205-233-125-72.b2b2c.ca. [205.233.125.72]) by smtp.gmail.com with ESMTPSA id s12-20020a05620a29cc00b006b6757a11fcsm3734441qkp.36.2022.08.12.23.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Aug 2022 23:54:49 -0700 (PDT) From: Maxim Cournoyer Date: Sat, 13 Aug 2022 02:54:31 -0400 Message-Id: <20220813065433.27319-12-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220813065433.27319-1-maxim.cournoyer@gmail.com> References: <20220813065433.27319-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/build/marionette.scm (wait-for-screen-text): Return the last OCR'd text when the predicate fails to match instead of the not useful predicate object. --- gnu/build/marionette.scm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm index 4f409166db..24170bbd30 100644 --- a/gnu/build/marionette.scm +++ b/gnu/build/marionette.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016-2022 Ludovic Courtès ;;; Copyright © 2018 Chris Marusich +;;; Copyright © 2022 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -308,13 +309,14 @@ (define start (define end (+ start timeout)) - (let loop () + (let loop ((last-text #f)) (if (> (car (gettimeofday)) end) - (error "'wait-for-screen-text' timeout" predicate) - (or (predicate (marionette-screen-text marionette #:ocrad ocrad)) - (begin - (sleep 1) - (loop)))))) + (error "'wait-for-screen-text' timeout" 'ocr-text: last-text) + (let ((text (marionette-screen-text marionette #:ocrad ocrad))) + (or (predicate text) + (begin + (sleep 1) + (loop text))))))) (define %qwerty-us-keystrokes ;; Maps "special" characters to their keystrokes.