aboutsummaryrefslogtreecommitdiff
path: root/tests/acceptance/machine_m68k_nextcube.py
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2021-02-08 20:22:54 +0000
committerPeter Maydell <peter.maydell@linaro.org>2021-02-08 20:22:54 +0000
commit34b7d4193e450d0799be4ca58323d0dcbb0075cc (patch)
tree3acb4559bac4dcc7027af64cbacb15c840d73287 /tests/acceptance/machine_m68k_nextcube.py
parent2436651b26584c8ebe91db5df67ee054509a0949 (diff)
parent86b7cb6660bfec139f293c246572f77b53389699 (diff)
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/integration-testing-20210208' into staging
Integration testing patches Tests added: - Armbian 20.08 on Orange Pi PC (Philippe) - MPC8544ds machine (Thomas) - Virtex-ml507 ppc machine (Thomas) - Re-enable the microblaze test (Thomas) Various fixes and documentation improvements from Cleber. # gpg: Signature made Mon 08 Feb 2021 20:19:12 GMT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * remotes/philmd-gitlab/tags/integration-testing-20210208: Acceptance Tests: remove unnecessary tag from documentation example Acceptance tests: clarify ssh connection failure reason tests/acceptance/virtiofs_submounts: required space between IP and port tests/acceptance/virtiofs_submounts: standardize port as integer tests/acceptance/virtiofs_submounts: use a virtio-net device instead tests/acceptance/virtiofs_submounts: do not ask for ssh key password tests/acceptance/virtiofs_submounts: use workdir property tests/acceptance/boot_linux: rename misleading cloudinit method tests/acceptance/boot_linux: fix typo on cloudinit error message tests/acceptance: Re-enable the microblaze test tests/acceptance: Add a test for the virtex-ml507 ppc machine tests/acceptance: Test the mpc8544ds machine tests/acceptance: Move the pseries test to a separate file tests/acceptance: Test U-Boot/Linux from Armbian 20.08 on Orange Pi PC tests/acceptance: Extract do_test_arm_orangepi_armbian_uboot() method tests/acceptance: Introduce tesseract_ocr() helper tests/acceptance: Extract tesseract_available() helper in new namespace Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/acceptance/machine_m68k_nextcube.py')
-rw-r--r--tests/acceptance/machine_m68k_nextcube.py44
1 files changed, 7 insertions, 37 deletions
diff --git a/tests/acceptance/machine_m68k_nextcube.py b/tests/acceptance/machine_m68k_nextcube.py
index 2baba5fdc2..09e2745cc5 100644
--- a/tests/acceptance/machine_m68k_nextcube.py
+++ b/tests/acceptance/machine_m68k_nextcube.py
@@ -1,19 +1,17 @@
# Functional test that boots a VM and run OCR on the framebuffer
#
-# Copyright (c) Philippe Mathieu-Daudé <f4bug@amsat.org>
+# Copyright (c) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
#
# 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 os
-import re
import time
-import logging
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, tesseract_ocr
PIL_AVAILABLE = True
try:
@@ -22,25 +20,6 @@ except ImportError:
PIL_AVAILABLE = False
-def tesseract_available(expected_version):
- try:
- find_command('tesseract')
- except CmdNotFoundError:
- return False
- res = process.run('tesseract --version')
- try:
- version = res.stdout_text.split()[1]
- except IndexError:
- version = res.stderr_text.split()[1]
- 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
-
-
class NextCubeMachine(Test):
"""
:avocado: tags=arch:m68k
@@ -80,12 +59,8 @@ class NextCubeMachine(Test):
def test_bootrom_framebuffer_ocr_with_tesseract_v3(self):
screenshot_path = os.path.join(self.workdir, "dump.ppm")
self.check_bootrom_framebuffer(screenshot_path)
-
- console_logger = logging.getLogger('console')
- text = process.run("tesseract %s stdout" % screenshot_path).stdout_text
- for line in text.split('\n'):
- if len(line):
- console_logger.debug(line)
+ lines = tesseract_ocr(screenshot_path, tesseract_version=3)
+ text = '\n'.join(lines)
self.assertIn('Backplane', text)
self.assertIn('Ethernet address', text)
@@ -96,13 +71,8 @@ class NextCubeMachine(Test):
def test_bootrom_framebuffer_ocr_with_tesseract_v4(self):
screenshot_path = os.path.join(self.workdir, "dump.ppm")
self.check_bootrom_framebuffer(screenshot_path)
-
- console_logger = logging.getLogger('console')
- proc = process.run("tesseract --oem 1 %s stdout" % screenshot_path)
- text = proc.stdout_text
- for line in text.split('\n'):
- if len(line):
- console_logger.debug(line)
+ lines = tesseract_ocr(screenshot_path, tesseract_version=4)
+ text = '\n'.join(lines)
self.assertIn('Testing the FPU, SCC', text)
self.assertIn('System test failed. Error code', text)
self.assertIn('Boot command', text)