From nobody Mon Feb 9 22:39:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612791448; cv=none; d=zohomail.com; s=zohoarc; b=Im9dFuScYiQz46AHT/2AMU7CmxOu3I2y68wWESjpRVDFt2MRa6X2CX1I1Xp/nD/radq/PcGmYy45DCGUDsn3i/Voydn3g3rHyRM5fPPyKa+NrBiWGBCVYjAHQMuT1j8kQAvBep25m0uDxoBw4gOvB18JpvopUQynTlgaQbcBnak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612791448; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=W/983sKCXCSNy2SywL9DvVo0od8KR97/FwleNIFTEaM=; b=Amj4//8DtS4JNK9oz8i5TLsM4GNwEmkjV+I6rj96N8jgGJtq0cb52CnKIGKtnJhnNtD19Ely+qlWQrEz5lulxcesnW4y8Mp3PrrRm0MVAbOIolKUe7uS5XQ5KrC/hX+VLY98+D2ng/SCV6S94M5/RafDaEcYpVaaehtOiyzLrzo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612791448809425.01800098415276; Mon, 8 Feb 2021 05:37:28 -0800 (PST) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-435-ikl5rSh9PEmsWTB1FhbxcA-1; Mon, 08 Feb 2021 08:37:23 -0500 Received: by mail-wr1-f72.google.com with SMTP id x7so12980168wrp.9 for ; Mon, 08 Feb 2021 05:37:23 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id g1sm28113599wrq.30.2021.02.08.05.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 05:37:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612791446; 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=W/983sKCXCSNy2SywL9DvVo0od8KR97/FwleNIFTEaM=; b=FqYIu5h1a9yihQx7emVL/vg8mXjJwD2ifLXBx3auC9ycxljzKGVtaekpXx7f6m3ZUVt5i8 M6FI/gSOicvuLrddYcja7+LyUF0V4O84WrF4YnucHj+j9Xeq25uUrC4CoGr72SJ/KiRqnm B+Y4cD+N1UD6ZJotTDjY1pPai2W2p+k= X-MC-Unique: ikl5rSh9PEmsWTB1FhbxcA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W/983sKCXCSNy2SywL9DvVo0od8KR97/FwleNIFTEaM=; b=k3SbvQYpZaDxoNudOgZ+jXjrgxjE6DOeWQZ392nH9H0THAQIx0IMkMc+8un6yRBHMg jEi9lw/yBQMhG2AOUaiNu0GxDTK+1F9C+AvZpb0LR4bO/hQ1sIBq1iJ3ZjfzpTSCKbx5 ZneIhUuRXIbmY6/3/DmLIWMWdVDDEdo+mKz3+oj91kWIMNj9ZHgKcJU2+O4qMRwBtCmN SQryZ+yFiHbcU90FuGrcW3enB2BnBR2PfbKqc8QsipiTKUjENQHhGtOxI0hxvQfY2oO3 ZsVA+mFr23MIu9LjQhyhgMAgQKM8ujkodaHKz0NG7ak+qELFtJCY7rnBCkib/Oz2kJJj 1IJg== X-Gm-Message-State: AOAM532C53/786C3YN/4Gma9yS4C/uwHfP7WVv0XFmF3PUUHdHAIlLTb 8bYczLxPQcTUTs119OpcKL4QSMSwiaIeIQi9WuCIX53Hf5e+/OFfXMyw+LNVfBTu/WHmM19YKgG Tr0VP3Ems9vr7/Q== X-Received: by 2002:a05:600c:4857:: with SMTP id j23mr3415369wmo.66.1612791440637; Mon, 08 Feb 2021 05:37:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYZ9l0l9dfqa49K8Xmck4MY+gwz7LZQDFFjHnu+9T4zSsfulzysDKTayX86AAgaF/DZMwZog== X-Received: by 2002:a05:600c:4857:: with SMTP id j23mr3415263wmo.66.1612791438521; Mon, 08 Feb 2021 05:37:18 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 01/18] tests/acceptance: Extract tesseract_available() helper in new namespace Date: Mon, 8 Feb 2021 14:36:54 +0100 Message-Id: <20210208133711.2596075-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210208133711.2596075-1-philmd@redhat.com> References: <20210208133711.2596075-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) From: Philippe Mathieu-Daud=C3=A9 We are going to reuse tesseract_available(). Extract it to a new 'tesseract_utils' namespace. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Message-Id: <20201021105035.2477784-4-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/acceptance/machine_m68k_nextcube.py | 25 +++----------------- tests/acceptance/tesseract_utils.py | 28 +++++++++++++++++++++++ 2 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 tests/acceptance/tesseract_utils.py diff --git a/tests/acceptance/machine_m68k_nextcube.py b/tests/acceptance/m= achine_m68k_nextcube.py index 2baba5fdc26..3c7400c43e4 100644 --- a/tests/acceptance/machine_m68k_nextcube.py +++ b/tests/acceptance/machine_m68k_nextcube.py @@ -1,19 +1,19 @@ # Functional test that boots a VM and run OCR on the framebuffer # -# Copyright (c) Philippe Mathieu-Daud=C3=A9 +# Copyright (c) 2019 Philippe Mathieu-Daud=C3=A9 # # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 import os -import re import time import logging =20 from avocado_qemu import Test from avocado import skipUnless from avocado.utils import process -from avocado.utils.path import find_command, CmdNotFoundError + +from tesseract_utils import tesseract_available =20 PIL_AVAILABLE =3D True try: @@ -22,25 +22,6 @@ PIL_AVAILABLE =3D False =20 =20 -def tesseract_available(expected_version): - try: - find_command('tesseract') - except CmdNotFoundError: - return False - res =3D process.run('tesseract --version') - try: - version =3D res.stdout_text.split()[1] - except IndexError: - version =3D res.stderr_text.split()[1] - return int(version.split('.')[0]) =3D=3D expected_version - - match =3D re.match(r'tesseract\s(\d)', res) - if match is None: - return False - # now this is guaranteed to be a digit - return int(match.groups()[0]) =3D=3D expected_version - - class NextCubeMachine(Test): """ :avocado: tags=3Darch:m68k diff --git a/tests/acceptance/tesseract_utils.py b/tests/acceptance/tessera= ct_utils.py new file mode 100644 index 00000000000..acd6e8c2faa --- /dev/null +++ b/tests/acceptance/tesseract_utils.py @@ -0,0 +1,28 @@ +# ... +# +# Copyright (c) 2019 Philippe Mathieu-Daud=C3=A9 +# +# This work is licensed under the terms of the GNU GPL, version 2 or +# later. See the COPYING file in the top-level directory. + +import re + +from avocado.utils.path import find_command, CmdNotFoundError + +def tesseract_available(expected_version): + try: + find_command('tesseract') + except CmdNotFoundError: + return False + res =3D process.run('tesseract --version') + try: + version =3D res.stdout_text.split()[1] + except IndexError: + version =3D res.stderr_text.split()[1] + return int(version.split('.')[0]) =3D=3D expected_version + + match =3D re.match(r'tesseract\s(\d)', res) + if match is None: + return False + # now this is guaranteed to be a digit + return int(match.groups()[0]) =3D=3D expected_version --=20 2.26.2