From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 8DKRD1c+LWMKRgEAbAwnHQ (envelope-from ) for ; Fri, 23 Sep 2022 07:04:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id +FqYD1c+LWMmzAAA9RJhRA (envelope-from ) for ; Fri, 23 Sep 2022 07:04:23 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0C1543B94F for ; Fri, 23 Sep 2022 07:04:23 +0200 (CEST) Received: from localhost ([::1]:45952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obarO-0004E0-0o for larch@yhetil.org; Fri, 23 Sep 2022 01:04:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obapC-0003W2-J3 for guix-patches@gnu.org; Fri, 23 Sep 2022 01:02:09 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39963) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obapC-00027v-Bd for guix-patches@gnu.org; Fri, 23 Sep 2022 01:02:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1obapC-00055a-6U for guix-patches@gnu.org; Fri, 23 Sep 2022 01:02:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#58014] [PATCH 11/15] marionette: Add a callback arguments to wait-for-screen-text. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 23 Sep 2022 05:02:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58014 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 58014@debbugs.gnu.org Cc: Maxim Cournoyer Received: via spool by 58014-submit@debbugs.gnu.org id=B58014.166390930819441 (code B ref 58014); Fri, 23 Sep 2022 05:02:06 +0000 Received: (at 58014) by debbugs.gnu.org; 23 Sep 2022 05:01:48 +0000 Received: from localhost ([127.0.0.1]:39025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obaou-00053V-Cu for submit@debbugs.gnu.org; Fri, 23 Sep 2022 01:01:48 -0400 Received: from mail-qv1-f48.google.com ([209.85.219.48]:45859) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1obaos-00051T-L7 for 58014@debbugs.gnu.org; Fri, 23 Sep 2022 01:01:46 -0400 Received: by mail-qv1-f48.google.com with SMTP id mi14so8253264qvb.12 for <58014@debbugs.gnu.org>; Thu, 22 Sep 2022 22:01:46 -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:subject:date; bh=Au9ibFtg5LHvs398x3Sz0OKX1319Qsp45Mew591e/zY=; b=Q3UTHMAtyKZvJ1zK/LxJVdKS0UXQwCkNYbZNBHZ67z2xEunMfqUi7YnFxi8wEpXNWN ktndJcmj+qAT5NgPatWoi0pwxH7s9qf0y6xostoyLYidl98MVoWCCRMvttlUp20gLys1 Szrd4w71PTXNBjKtgSmPJBSVnHTKuXQAsdf13aEdTZs3b4U4ISayqXxN2zN5C1eDIFJs 5Z2WNs04dI2L0TvKHL4wadZPcuxM8Y1tqc1neKIYwZGw6xCy1gA7IedzywpOp2gIqQ5Y c6YbhmqeCb9/bb+VcdFrcEbTz26O2K07JgrRBhtlGLnE8PIBJ4R0YhIOdHDJZrjoPKcF h4bw== 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 :subject:date; bh=Au9ibFtg5LHvs398x3Sz0OKX1319Qsp45Mew591e/zY=; b=Pcg+20wMR62czOImlTEA3C+rYVw6t7tiZ5s45D/oBt40xccanCsNLnjdjGrVca4nzV Z0Qx0Je303VlhZV87IuGt5ZYQvWU21ZnVIDvRzULWehkOW5MYKpy0R+44Lom2dz6smG1 /KT86VyjQhdyZyRW/Obxw39/yCbd2FVh5SEp3X8WReOQfBiE+LtlNqWW64IBPA0clXmq X0gTRTVPC6ELETE4Ovpo6DP0E4btWSC+jiRatWVuvI6c5G67uxfOfVS+FvnC5IF39eNw REBLKGhaPYtsjiSTygqB+gLZGQTp38XfmuA0nWuWaFjtR2Ck8Oqsm3/kokanqCuAZrRa V3MQ== X-Gm-Message-State: ACrzQf2Y7yb2l9i8Ga+joqxCI2Wvy2hQFP7TBBRItQPOa8xtOkQc6f6J WTouphG7bVeajWqpvwfsuwAGDpeP2WI= X-Google-Smtp-Source: AMsMyM7krg5N2kUZTWXn3lu/iWEx7E7mUPJ6/ofTO1AjcfV+inovwWBfHGSpXInm6VuJBw9XbbL8vw== X-Received: by 2002:a05:6214:c2a:b0:4ac:c5b7:e5cc with SMTP id a10-20020a0562140c2a00b004acc5b7e5ccmr5544530qvd.55.1663909306198; Thu, 22 Sep 2022 22:01:46 -0700 (PDT) Received: from localhost.localdomain ([2607:fad8:4:3::1001]) by smtp.gmail.com with ESMTPSA id de4-20020a05620a370400b006bbb07ebd83sm5263534qkb.108.2022.09.22.22.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 22:01:45 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 23 Sep 2022 01:00:38 -0400 Message-Id: <20220923050042.29893-11-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220923050042.29893-1-maxim.cournoyer@gmail.com> References: <20220923050042.29893-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1663909463; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Au9ibFtg5LHvs398x3Sz0OKX1319Qsp45Mew591e/zY=; b=hfoUfIzJN+7/rN7Z0YzyThXDC5wYViACQ+McvpgXn/RUDx3fk5eqzv99zbyeSIxRPKaLjy tIyL3yp1a68MPz8tEszLp2lEM9cExCHyVFuU+tpS5qZmJgBdfcF5WF5cBFgTLLTSG/DWd1 QTnyHtasm2yMHJgLHwk8OrGCGZ++yKMc7ZDgZ2NX6B8P73svqO7Cs6HvEgE34ZutXHZmtZ nCg6gu9+8V4shW+eRdS4p8GAc+hkYAVUaJJa23uvoKdlDfQUq8dUUW8uHFb1IpJ6ocLcpo 14XqZrypKvlh5MUEKgeV8OFm5RoVwYc1innnBq9Sa0aMi7+ia4TFifxyoawqew== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1663909463; a=rsa-sha256; cv=none; b=t3/NzrfzrvczrVWd1/h8yA9kJvjs3natm2e2KYFMrGcp9u06PJGLb4gpvRALK3BkEQlrNa L6Lp43+blJH1mblV+2JvcMOTM8CZVI6aMJ0cBoe24m3TgiuP+yLnxTuy8XCKlcGc3ImkPR ezOXR2sO01hSvc7ggt6J84u1nqNb0owspjuumXzzE9WeWY9jyW1HYtyr2TLaHlwZHHilde roiZdLuj7/gA1Dgp6CKwfj8/exqF9bunC2PhQBBRQqY7fsU3fCNWYi61ah90QuJ6A3h/Yv H8OlmbeS3r9sPnAD/NVZ3q/ImusJb6DR1zdcZc7VWcwgNfj1gnUHS7CDN9EcJQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Q3UTHMAt; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 8.15 X-Spam: Yes Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Q3UTHMAt; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 0C1543B94F X-Spam-Score: 8.15 X-Migadu-Spam: Yes X-Migadu-Scanner: scn1.migadu.com X-TUID: pXagKHcsZ9uL * gnu/build/marionette.scm (wait-for-screen-text): New 'pre-action' and 'post-action' arguments. Update doc. Call the procedures before and after the OCR occurs, respectively. --- gnu/build/marionette.scm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm index 6f373f87b6..f4b219e842 100644 --- a/gnu/build/marionette.scm +++ b/gnu/build/marionette.scm @@ -331,11 +331,15 @@ (define image (string-append (tmpnam) ".ppm")) (define* (wait-for-screen-text marionette predicate #:key (ocr "ocrad") - (timeout 30)) + (timeout 30) + pre-action + post-action) "Wait for TIMEOUT seconds or until the screen text on MARIONETTE matches PREDICATE, whichever comes first. Raise an error when TIMEOUT is exceeded. The error contains the recognized text along the preserved file name of the -screen dump, which is relative to the current working directory." +screen dump, which is relative to the current working directory. If +PRE-ACTION is provided, it should be a thunk to call before each OCR attempt. +Likewise for POST-ACTION, except it runs at the end of a successful OCR." (define start (car (gettimeofday))) @@ -353,7 +357,9 @@ (define end (error "'wait-for-screen-text' timeout" 'ocr-text: last-text 'screendump: screendump-backup)) - (let* ((text screendump (marionette-screen-text marionette #:ocr ocr)) + (let* ((_ (and (procedure? pre-action) (pre-action))) + (text screendump (marionette-screen-text marionette #:ocr ocr)) + (_ (and (procedure? post-action) (post-action))) (result (predicate text))) (cond (result (delete-file screendump) -- 2.37.3