From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
"Thomas Huth" <huth@tuxfamily.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PULL 03/11] tests/avocado: Allow newer versions of tesseract in the nextcube test
Date: Tue, 7 Nov 2023 19:32:20 +0100 [thread overview]
Message-ID: <20231107183228.276424-4-thuth@redhat.com> (raw)
In-Reply-To: <20231107183228.276424-1-thuth@redhat.com>
From: Thomas Huth <huth@tuxfamily.org>
Current Linux distros ship version 5 of the tesseract OCR software,
so the nextcube screen test is ignored there. Let's make the check
more flexible to allow newer versions, too, and remove the old v3
test since most Linux distros don't ship this version anymore.
Message-ID: <20231101204323.35533-1-huth@tuxfamily.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Thomas Huth <huth@tuxfamily.org>
---
tests/avocado/machine_m68k_nextcube.py | 15 +++------------
tests/avocado/tesseract_utils.py | 4 ++--
2 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/tests/avocado/machine_m68k_nextcube.py b/tests/avocado/machine_m68k_nextcube.py
index f1205d7fc0..1f3c883910 100644
--- a/tests/avocado/machine_m68k_nextcube.py
+++ b/tests/avocado/machine_m68k_nextcube.py
@@ -55,25 +55,16 @@ def test_bootrom_framebuffer_size(self):
self.assertEqual(width, 1120)
self.assertEqual(height, 832)
- @skipUnless(tesseract_available(3), 'tesseract v3 OCR tool not available')
- def test_bootrom_framebuffer_ocr_with_tesseract_v3(self):
- screenshot_path = os.path.join(self.workdir, "dump.ppm")
- self.check_bootrom_framebuffer(screenshot_path)
- lines = tesseract_ocr(screenshot_path, tesseract_version=3)
- text = '\n'.join(lines)
- self.assertIn('Backplane', text)
- self.assertIn('Ethernet address', text)
-
# Tesseract 4 adds a new OCR engine based on LSTM neural networks. The
# new version is faster and more accurate than version 3. The drawback is
# that it is still alpha-level software.
- @skipUnless(tesseract_available(4), 'tesseract v4 OCR tool not available')
- def test_bootrom_framebuffer_ocr_with_tesseract_v4(self):
+ @skipUnless(tesseract_available(4), 'tesseract OCR tool not available')
+ def test_bootrom_framebuffer_ocr_with_tesseract(self):
screenshot_path = os.path.join(self.workdir, "dump.ppm")
self.check_bootrom_framebuffer(screenshot_path)
lines = tesseract_ocr(screenshot_path, tesseract_version=4)
text = '\n'.join(lines)
- self.assertIn('Testing the FPU, SCC', text)
+ self.assertIn('Testing the FPU', text)
self.assertIn('System test failed. Error code', text)
self.assertIn('Boot command', text)
self.assertIn('Next>', text)
diff --git a/tests/avocado/tesseract_utils.py b/tests/avocado/tesseract_utils.py
index 72cd9ab798..476f528147 100644
--- a/tests/avocado/tesseract_utils.py
+++ b/tests/avocado/tesseract_utils.py
@@ -21,13 +21,13 @@ def tesseract_available(expected_version):
version = res.stdout_text.split()[1]
except IndexError:
version = res.stderr_text.split()[1]
- return int(version.split('.')[0]) == expected_version
+ return int(version.split('.')[0]) >= expected_version
match = 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]) == expected_version
+ return int(match.groups()[0]) >= expected_version
def tesseract_ocr(image_path, tesseract_args='', tesseract_version=3):
--
2.41.0
next prev parent reply other threads:[~2023-11-07 18:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 18:32 [PULL 00/11] s390x and MAINTAINERS updates Thomas Huth
2023-11-07 18:32 ` [PULL 01/11] MAINTAINERS: Add the virtio-gpu documentation to the corresponding section Thomas Huth
2023-11-07 18:32 ` [PULL 02/11] MAINTAINERS: Add artist.c to the hppa machine section Thomas Huth
2023-11-07 18:32 ` Thomas Huth [this message]
2023-11-07 18:32 ` [PULL 04/11] s390/sclp: fix SCLP facility map Thomas Huth
2023-11-07 18:32 ` [PULL 05/11] target/s390x/cpu_models: Use 'first_cpu' in s390_get_feat_block() Thomas Huth
2023-11-07 18:32 ` [PULL 06/11] target/s390x: Fix CLC corrupting cc_src Thomas Huth
2023-11-07 18:32 ` [PULL 07/11] tests/tcg/s390x: Test CLC with inaccessible second operand Thomas Huth
2023-11-07 18:32 ` [PULL 08/11] target/s390x: Fix LAALG not updating cc_src Thomas Huth
2023-11-07 18:32 ` [PULL 09/11] tests/tcg/s390x: Test LAALG with negative cc_src Thomas Huth
2023-11-07 18:32 ` [PULL 10/11] tests/tcg/s390x: Test ADD LOGICAL WITH CARRY Thomas Huth
2023-11-07 18:32 ` [PULL 11/11] target/s390x/cpu topology: Fix ordering and creation of TLEs Thomas Huth
2023-11-08 14:19 ` [PULL 00/11] s390x and MAINTAINERS updates Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231107183228.276424-4-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=huth@tuxfamily.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).