From nobody Fri Dec 19 04:33:46 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1582909760; cv=none; d=zohomail.com; s=zohoarc; b=WwTPLO0XxT32i5aUlyCTkTYWxtdRWO6NbGwjlL3+rLb8DGQYh09P7N7tfnHhjFxihOwfPhYOgZdfnUN0RMKdhUHAw8E17sSrCaYzDTqT9p8MaA07u6bewZMD1Thl4gZqPjQ1P7C4hrTrO62rOt9BK6nAdIbhCAWQwll2A/hZIeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582909760; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hTbY0nJfRg44cC4x/jkt29PNMvHIJImu3BmtAxBXRUA=; b=GyKPBf3i6xuga+FoTfuz3JQ8h6Y3zK9e8G3PtsE8Byyyiuh7yzLMmxMCbOtDFz++t/GGwetOtFhfZyTl5I7ZcFC369XBj42bW4t3seXwURD4t59GA+0BbUAGTg4e9LWYzHY36EIA++YTl4/s8UvJnyAg+3lKSsWvxp01/nmkh3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582909760069425.7754876899452; Fri, 28 Feb 2020 09:09:20 -0800 (PST) Received: from localhost ([::1]:50980 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7j8Y-0000HW-Jh for importer@patchew.org; Fri, 28 Feb 2020 12:09:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56738) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j7ifV-0008DU-Lw for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:39:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j7ifU-00025Y-8u for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:39:17 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:55450) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j7ifU-000256-2D for qemu-devel@nongnu.org; Fri, 28 Feb 2020 11:39:16 -0500 Received: by mail-wm1-x334.google.com with SMTP id q9so3813450wmj.5 for ; Fri, 28 Feb 2020 08:39:15 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c9sm13335214wrq.44.2020.02.28.08.39.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 08:39:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hTbY0nJfRg44cC4x/jkt29PNMvHIJImu3BmtAxBXRUA=; b=aeG0pYb/ggqslbXgJm/hF6BjCA4tRiDrvAm8kOn4xhxTdW1suW+X2lH1a0PaqaHj+d 1edvoZTMikv1vWDxLLgIchq6KuDR8FRp7SmJw/1B8yV+eCjTiskTX6ZinMqAtw6GNZD3 /oyGAqTKDhGBLgjFm4Qel2zIHkxdHkQ8BChUAYCZNJClB0tPdtP4PD55zlKsIr3RukoA Ir8St7AVjk5DH5AqAQnSKJnhsvXPdz5nl6zhyrETGRfSapUyDsy/wx1+sPagwX9PURzs B50ts03pxKt5ZACVJUcT2IDMYQM7KCD7p+REHsQ6zIpHFrW0mnBTdON60VHALvcexw+R e2nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hTbY0nJfRg44cC4x/jkt29PNMvHIJImu3BmtAxBXRUA=; b=fA0KA2X27xejjFaIagtxcZpdAY7Ra08T1TollTKDqFYDFH6WsVp4PYDwGiP8zkZ4lq gOkDeWh99eQKmMQwS51pPKWXrLTKMxPYqwYAjjll7KgoNOzimy3jgRTVawgvRSe0QbE7 CJZxfjEJDpJnPXh7OgnDtU8UmeXlhz1/SRB1LlhpS9jgurLLSLF79BFwvQV4mh265EwD RKI+HB+iwSXQJE17dWQX7oQUyf2hXzenX7WUO9hfww/GY7n32Owp2diP5m6ddDfVpyfm vJLDVEPL/Q7eirnBBm2Xif1gsYkXsrFzFai3uxmTlKhE54wP38gEbJ3ovyel1O5SNKlt epNw== X-Gm-Message-State: APjAAAUrtkNec2kL4hR67LN6qKXz6P7v+dG97faPcajrmPmDNNDqyeJ+ 9ewa6+AsIYgMJNHnbA9cuQsMFy1CVfnQtQ== X-Google-Smtp-Source: APXvYqwzkbW/MZ5n/ULQ9POm2Xt/rCkrJAFh4nPR4gciBW6mTqdU92Bn4tCNNLSYLXViozlcIQvJXQ== X-Received: by 2002:a05:600c:290:: with SMTP id 16mr3131736wmk.64.1582907954723; Fri, 28 Feb 2020 08:39:14 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 28/33] tests/acceptance/integratorcp: Verify Tux is displayed on framebuffer Date: Fri, 28 Feb 2020 16:38:35 +0000 Message-Id: <20200228163840.23585-29-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200228163840.23585-1-peter.maydell@linaro.org> References: <20200228163840.23585-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 Add a test that verifies the Tux logo is displayed on the framebuffer. We simply follow the OpenCV "Template Matching with Multiple Objects" tutorial, replacing Lionel Messi by Tux: https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html When OpenCV and NumPy are installed, this test can be run using: $ AVOCADO_ALLOW_UNTRUSTED_CODE=3Dhmmm \ avocado --show=3Dapp,framebuffer run -t device:framebuffer \ tests/acceptance/machine_arm_integratorcp.py JOB ID : 8c46b0f8269242e87d738247883ea2a470df949e JOB LOG : avocado/job-results/job-2020-01-31T21.38-8c46b0f/job.log (1/1) tests/acceptance/machine_arm_integratorcp.py:IntegratorMachine.tes= t_framebuffer_tux_logo: framebuffer: found Tux at position [x, y] =3D (0, 0) PASS (3.96 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | = CANCEL 0 JOB TIME : 4.23 s Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Wainer dos Santos Moschetta Message-id: 20200225172501.29609-5-philmd@redhat.com Message-Id: <20200131211102.29612-3-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- tests/acceptance/machine_arm_integratorcp.py | 52 ++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/acceptanc= e/machine_arm_integratorcp.py index 22afd3b82a8..49c8ebff78b 100644 --- a/tests/acceptance/machine_arm_integratorcp.py +++ b/tests/acceptance/machine_arm_integratorcp.py @@ -9,11 +9,26 @@ # later. See the COPYING file in the top-level directory. =20 import os +import logging =20 from avocado import skipUnless from avocado_qemu import Test from avocado_qemu import wait_for_console_pattern =20 + +NUMPY_AVAILABLE =3D True +try: + import numpy as np +except ImportError: + NUMPY_AVAILABLE =3D False + +CV2_AVAILABLE =3D True +try: + import cv2 +except ImportError: + CV2_AVAILABLE =3D False + + class IntegratorMachine(Test): =20 timeout =3D 90 @@ -45,3 +60,40 @@ class IntegratorMachine(Test): """ self.boot_integratorcp() wait_for_console_pattern(self, 'Log in as root') + + @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed') + @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed') + @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code= ') + def test_framebuffer_tux_logo(self): + """ + Boot Linux and verify the Tux logo is displayed on the framebuffer. + :avocado: tags=3Darch:arm + :avocado: tags=3Dmachine:integratorcp + :avocado: tags=3Ddevice:pl110 + :avocado: tags=3Ddevice:framebuffer + """ + screendump_path =3D os.path.join(self.workdir, "screendump.pbm") + tuxlogo_url =3D ('https://github.com/torvalds/linux/raw/v2.6.12/' + 'drivers/video/logo/logo_linux_vga16.ppm') + tuxlogo_hash =3D '3991c2ddbd1ddaecda7601f8aafbcf5b02dc86af' + tuxlogo_path =3D self.fetch_asset(tuxlogo_url, asset_hash=3Dtuxlog= o_hash) + + self.boot_integratorcp() + framebuffer_ready =3D 'Console: switching to colour frame buffer d= evice' + wait_for_console_pattern(self, framebuffer_ready) + self.vm.command('human-monitor-command', command_line=3D'stop') + self.vm.command('human-monitor-command', + command_line=3D'screendump %s' % screendump_path) + logger =3D logging.getLogger('framebuffer') + + cpu_count =3D 1 + match_threshold =3D 0.92 + screendump_bgr =3D cv2.imread(screendump_path) + screendump_gray =3D cv2.cvtColor(screendump_bgr, cv2.COLOR_BGR2GRA= Y) + result =3D cv2.matchTemplate(screendump_gray, cv2.imread(tuxlogo_p= ath, 0), + cv2.TM_CCOEFF_NORMED) + loc =3D np.where(result >=3D match_threshold) + tux_count =3D 0 + for tux_count, pt in enumerate(zip(*loc[::-1]), start=3D1): + logger.debug('found Tux at position [x, y] =3D %s', pt) + self.assertGreaterEqual(tux_count, cpu_count) --=20 2.20.1