From patchwork Sat Jun 29 15:00:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11024069 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7133B1398 for ; Sat, 29 Jun 2019 15:02:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FF96287FF for ; Sat, 29 Jun 2019 15:02:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5447728801; Sat, 29 Jun 2019 15:02:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DCB8D287FF for ; Sat, 29 Jun 2019 15:02:41 +0000 (UTC) Received: from localhost ([::1]:40918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhEsD-0004np-6y for patchwork-qemu-devel@patchwork.kernel.org; Sat, 29 Jun 2019 11:02:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37897) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hhEqj-00037C-0B for qemu-devel@nongnu.org; Sat, 29 Jun 2019 11:01:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hhEqh-0007G4-BO for qemu-devel@nongnu.org; Sat, 29 Jun 2019 11:01:08 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:52719) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hhEqf-0007Bd-Ai for qemu-devel@nongnu.org; Sat, 29 Jun 2019 11:01:06 -0400 Received: by mail-wm1-x342.google.com with SMTP id s3so11744905wms.2 for ; Sat, 29 Jun 2019 08:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gpp9Udz/jFQYQuXUbwF4OjuIMxDQuVUIk0bf5J+Kovs=; b=uPkDFMNnvQ0vTqQ1RZRMBzvZ5kKa1wW8Mn3zLS4odmbsJaRJ9mXweXTNQ1eK01dP8q s9atfzAe8hrA9odLutk8w5YcSrBeOzZQyXJFS0vaW3h+A5kqT5LMQGEWBo2HSHD6cUR9 GrYDrW2SUBFM8tcZ2EldgWEw5gK717Wd1BYGXASNS7lQR1fTWzMvecxaXWDa173AKBcb dnX0D+SsEy4cFORSh8iRe7VvHrsw+snPbVe2ZzVSHbG7iKU05hqQpQlMKjIM7PwgTrIF oCDm2R0Uuv2E1f+C9uOJhP0QAOzsMBTteAJoP9FsC00C0RnkswTstD492WiOxME0UhWs +XKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gpp9Udz/jFQYQuXUbwF4OjuIMxDQuVUIk0bf5J+Kovs=; b=cE9uEgXhOUUn2nnop7vB9fbQyyJEvcvRQKx2OMnjC/73JplyKCiohIurjV5/2FJdt6 beqgl8b7TZ+74vVJESGhGvH92FRzP7lweTB9+EHIVGTEUCT+ePSVLYGXGTsUoKEbXU7c XDTY9ZUXJU07Z5oLSzcCuezJ8bvQ2ONVPBU70fGWW/LGRmtESK2BvR2QgDYLwwHo5ZYU OHQq9awpO9CFRn1dkm17L6VVPuiF4PrGbCAimDEMYOGcOxFzaCEhljMdw7IHL8AUykuE NQI6WMWHd+X/IRDz9Yqrdg2d4/GD5aLT1GQb4hfMo2/V+Ksk98XAFO6/dS25pVp4+hVo k0+Q== X-Gm-Message-State: APjAAAWEdpL5WKuisD0GhM0xxXdkWuMZtsWGuzVSel005n1/OWgWvd4H Gptrb1WUIN4nOgINDnrO2WZWr5DU X-Google-Smtp-Source: APXvYqypS6qIcngmcEQnpZSo5b0wbCVexxm1XyKXUQVqbAlGsZFXijy3GzVf+Jjcj3SUjVfg2c4lvw== X-Received: by 2002:a1c:b6d4:: with SMTP id g203mr10892189wmf.19.1561820460058; Sat, 29 Jun 2019 08:01:00 -0700 (PDT) Received: from x1.local (183.red-88-21-202.staticip.rima-tde.net. [88.21.202.183]) by smtp.gmail.com with ESMTPSA id h19sm5146231wrb.81.2019.06.29.08.00.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 29 Jun 2019 08:00:59 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Sat, 29 Jun 2019 17:00:55 +0200 Message-Id: <20190629150056.9071-2-f4bug@amsat.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190629150056.9071-1-f4bug@amsat.org> References: <20190629150056.9071-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 Subject: [Qemu-devel] [PATCH 1/2] tests/acceptance: Add test of NeXTcube framebuffer using OCR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Eduardo Habkost , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Gerd Hoffmann , Cleber Rosa , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add a test of the NeXTcube framebuffer using the Tesseract OCR engine on a screenshot of the framebuffer device. The test is very quick: $ avocado --show=app,ocr run tests/acceptance/machine_m68k_nextcube.py JOB ID : f7d3c27976047036dc568183baf64c04863d9985 JOB LOG : ~/avocado/job-results/job-2019-06-29T16.18-f7d3c27/job.log (1/1) tests/acceptance/machine_m68k_nextcube.py:NextCubeMachine.test_bootrom_framebuffer: |ocr: ue r pun Honl'flx ; 5‘ 55‘ avg ncaaaaa 25 MHZ, memary jag m Backplane slat «a Ethernet address a a r a r3 2 Memgry sackets aea canflqured far 16MB Darlly page made stMs but have 16MB page made stMs )nstalled Memgry sackets a and 1 canflqured far 16MB Darlly page made stMs but have 16MB page made stMs )nstalled [...] Yestlnq the rpu, 5:: system test raneg Errar egge 51 Egg: cammand Default pggc devlce nut fauna NEXY>I PASS (3.59 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 3.97 s Documentation on how to install tesseract: https://github.com/tesseract-ocr/tesseract/wiki#installation Signed-off-by: Philippe Mathieu-Daudé --- tests/acceptance/machine_m68k_nextcube.py | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/acceptance/machine_m68k_nextcube.py diff --git a/tests/acceptance/machine_m68k_nextcube.py b/tests/acceptance/machine_m68k_nextcube.py new file mode 100644 index 0000000000..cf061292a7 --- /dev/null +++ b/tests/acceptance/machine_m68k_nextcube.py @@ -0,0 +1,50 @@ +# Functional test that boots a VM and run OCR on the framebuffer +# +# Copyright (c) Philippe Mathieu-Daudé +# +# 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 logging +import time +import distutils.spawn + +from avocado import skipUnless +from avocado_qemu import Test +from avocado.utils import process + + +class NextCubeMachine(Test): + + timeout = 15 + + @skipUnless(distutils.spawn.find_executable('tesseract'), + 'tesseract OCR tool not installed') + def test_bootrom_framebuffer(self): + """ + :avocado: tags=arch:m68k + :avocado: tags=machine:next-cube + :avocado: tags=device:framebuffer + """ + rom_url = ('http://www.nextcomputers.org/NeXTfiles/Software/ROM_Files/' + '68040_Non-Turbo_Chipset/Rev_2.5_v66.BIN') + rom_hash = 'b3534796abae238a0111299fc406a9349f7fee24' + rom_path = self.fetch_asset(rom_url, asset_hash=rom_hash) + + self.vm.set_machine('next-cube') + self.vm.add_args('-bios', rom_path) + self.vm.launch() + + self.log.info('VM launched, waiting for display') + # FIXME how to catch the 'displaysurface_create 1120x832' trace-event? + time.sleep(2) + + screenshot_path = self.workdir + "dump" + self.vm.command('human-monitor-command', + command_line='screendump %s' % screenshot_path) + + console_logger = logging.getLogger('ocr') + proc = process.run("tesseract %s stdout" % screenshot_path) + console_logger.debug(proc.stdout_text) + self.assertIn('Backplane', proc.stdout_text) + self.assertIn('Ethernet address', proc.stdout_text)