From patchwork Sat Sep 30 16:28:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1841615 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RyXhq69DPz1yp0 for ; Sun, 1 Oct 2023 03:28:43 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 8F41341DD0; Sat, 30 Sep 2023 16:28:41 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 8F41341DD0 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dAFKkim6NkaY; Sat, 30 Sep 2023 16:28:40 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 128374226E; Sat, 30 Sep 2023 16:28:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 128374226E X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 5A75F1BF86C for ; Sat, 30 Sep 2023 16:28:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 33CCE402BC for ; Sat, 30 Sep 2023 16:28:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 33CCE402BC X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mo6eYr76esOe for ; Sat, 30 Sep 2023 16:28:25 +0000 (UTC) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by smtp2.osuosl.org (Postfix) with ESMTPS id 1B1594017A for ; Sat, 30 Sep 2023 16:28:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 1B1594017A Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32167a4adaaso14460388f8f.1 for ; Sat, 30 Sep 2023 09:28:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696091303; x=1696696103; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=eUceZBZZw/pvKnlCVrmYcJA4WhdLrtbMKV+lpzQktr4=; b=SJLxA0tpL6VncKyoUuKbXif9O8XezEuPqyOsHjurN4STWfeZMT3Y2841rqgel2/p8+ q+CSUr9rgZMDjW60/ZnpG5zA4mqLPyKw3BT4K7oqvmMBHDtj/hkDWpOtvxQtWL4OdalC eYNUptKpWwgRdNsZFZG37M8D7EWzacGzhQAGc1Ro9LQbpuFqEmJX7VOw45i7nyDKB2Yf NAGV+/GHdrikqCeb2mbayEixPijbes6J8u+oGcXIeTQD9TocKAKX9cVB3LtaEu136Egm 9i83ngM726VW3nVdSXVhseIO7q+/XPOu9YybM6xrSVuDlzkFmBz+IsqbmBRWo9eSmjQa 8alA== X-Gm-Message-State: AOJu0YwS+ZrBPqA7uOJDcFRmkCfyurQjtlnNFkr17z+lIrzrU5KYSj0n vB5MC3fRMWbBl81APFRHOVVOfGIoy0k= X-Google-Smtp-Source: AGHT+IHvY5V3skBD2kRE0HXkZbs1T1qg6ATz8DlU23iYTZz+2wYFYZ93ZTR2Rp0KYtAC+GfeXNIexQ== X-Received: by 2002:adf:f74a:0:b0:317:e5ec:8767 with SMTP id z10-20020adff74a000000b00317e5ec8767mr6055737wrp.21.1696091302514; Sat, 30 Sep 2023 09:28:22 -0700 (PDT) Received: from scaer.home (2a01cb0404ad0b00e4d10b92e94d73af.ipv6.abo.wanadoo.fr. [2a01:cb04:4ad:b00:e4d1:b92:e94d:73af]) by smtp.gmail.com with ESMTPSA id o11-20020a5d4a8b000000b0031fc4c31d77sm24116368wrq.88.2023.09.30.09.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 09:28:22 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sat, 30 Sep 2023 18:28:20 +0200 Message-Id: <4e13b2dcd07b334b461649e9072f52e8336a04a9.1696091295.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696091303; x=1696696103; darn=buildroot.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=eUceZBZZw/pvKnlCVrmYcJA4WhdLrtbMKV+lpzQktr4=; b=jLHkz84kaMvpgQZVj2CaBouHwRwh+GQrkWrn3FXk4EbTEjEa5tSzUM1/4rdz+NvZVN KpUBP+HhNVTsnRIFx0QYKjcb1SvqC+eMPC73G9Tnnixsyklc85M6ITAZm3v+J+Mc46xb RIkyh/ptxVhbMw8zgfyPqbVes4+Rbj4Dil5TANJ8tmjVhohGJhdL+PcKHKu4ZGgD6+pg wf6+FQVMxtWIUu8+qMLadR5dl1txdoziviUc5oDhvgMYJPVnXbz+uYfHgE17KofPNnDN ASiMxScr6IWF528gvfd22PZOvTMDwPh1L0aCU+PeZ0nfzIkrHHgtcTXiChCPdV68Rl/U 4osg== X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=jLHkz84k Subject: [Buildroot] [PATCH 1/2] support/runtime-test: add helper to test graphics rendering X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Julien Olivain , "Yann E. MORIN" Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" In 4edb0e3456ef (support/testing/tests/package/test_weston.py: new runtime test),the weston test was introduced, and thus was the first that needed to test that rendering was happening. Now we also have a test for a flutter application, and we'll want to have it test the rendering too. Move the corresponding code to a helper that can be reused by other tests, rather than duplicate (or reinvent) it. Switch weston to using that new helper. Signed-off-by: Yann E. MORIN Cc: Julien Olivain --- support/testing/tests/graphics_base.py | 39 +++++++++++++ support/testing/tests/package/test_weston.py | 61 ++++---------------- 2 files changed, 49 insertions(+), 51 deletions(-) create mode 100644 support/testing/tests/graphics_base.py diff --git a/support/testing/tests/graphics_base.py b/support/testing/tests/graphics_base.py new file mode 100644 index 0000000000..15a4c00bb2 --- /dev/null +++ b/support/testing/tests/graphics_base.py @@ -0,0 +1,39 @@ +class GraphicsBase: + def get_n_fb_crc(self, *, count=10, uniq=False, timeout=-1): + """ + Return count DRM CRC from the framebuffer. If uniq is True, + only unique CRCs are returned (which may be less than the + requested cont). + Returns a possibly empty list of integers. + Set timeout to -1 for no timeout, or to a positive number for + a timeout of that many seconds. + """ + # DRM CRCs are exposed through a sysfs pseudo file + try: + self.debugfs_mounted + except AttributeError: + # Note: some init system (e.g. systemd) may have this already + # mounted, so check beforehand + self.assertRunOk("mountpoint /sys/kernel/debug/ || mount -t debugfs none /sys/kernel/debug/") + self.debugfs_mounted = True + + # The first column is the frame number, the second column is the + # CRC measure. We use "head" to get the needed CRC count. + disp_crc_path = "/sys/kernel/debug/dri/0/crtc-0/crc/data" + cmd = f"head -{count} {disp_crc_path}" + + # The DRM CRC sysfs pseudo file lines are terminated by '\n' + # and '\0'. We remove the '\0' to have a text-only output. + cmd += " | tr -d '\\000'" + + # Finally, we drop the frame counter, and keep only the second + # column (CRC values) + cmd += " | cut -f 2 -d ' '" + + if uniq: + cmd += " | sort -u" + + output, exit_code = self.emulator.run(cmd, timeout=timeout) + self.assertTrue(exit_code == 0, f"'{cmd}' failed with exit code {exit_code}") + + return [int(crc, 16) for crc in output] diff --git a/support/testing/tests/package/test_weston.py b/support/testing/tests/package/test_weston.py index df1b7a4135..f37a73565f 100644 --- a/support/testing/tests/package/test_weston.py +++ b/support/testing/tests/package/test_weston.py @@ -2,9 +2,10 @@ import os import time import infra.basetest +from ..graphics_base import GraphicsBase -class TestWeston(infra.basetest.BRTest): +class TestWeston(infra.basetest.BRTest, GraphicsBase): config = \ """ BR2_aarch64=y @@ -36,31 +37,6 @@ class TestWeston(infra.basetest.BRTest): infra.filepath("tests/package/test_weston/linux-vkms.fragment") ) - def gen_read_disp_crcs_cmd(self, count=1): - # DRM CRCs are exposed through a sysfs pseudo file, one measure - # per line. The first column is the frame number, the second - # column is the CRC measure. We use "head" to get the needed - # CRC count. - disp_crc_path = "/sys/kernel/debug/dri/0/crtc-0/crc/data" - cmd = f"head -{count} {disp_crc_path}" - - # The DRM CRC sysfs pseudo file lines are terminated by '\n' - # and '\0'. We remove the '\0' to have a text-only output. - cmd += " | tr -d '\\000'" - - # Finally, we drop the frame counter, and keep only the second - # column (CRC values) - cmd += " | cut -f 2 -d ' '" - - return cmd - - def gen_count_unique_disp_crcs_cmd(self, count=10): - # We get the command generating one CRC per line... - cmd = self.gen_read_disp_crcs_cmd(count) - # ...then count the number of unique values - cmd += " | uniq | wc -l" - return cmd - def start_weston(self): self.assertRunOk("export XDG_RUNTIME_DIR=/tmp") @@ -106,25 +82,14 @@ class TestWeston(infra.basetest.BRTest): # Check a simple info client can communicate with the compositor self.assertRunOk("wayland-info", timeout=10) - # This test will use the Kernel VKMS DRM Display CRC support, - # which is exposed in debugfs. See: - # https://docs.kernel.org/gpu/drm-uapi.html#display-crc-support - self.assertRunOk("mount -t debugfs none /sys/kernel/debug/") - # We get 10 consecutive DRM frame CRCs and count how many # unique CRCs we have. Since weston is supposed to run idle, # we should have 10 times the same display CRC. - cmd = self.gen_count_unique_disp_crcs_cmd() - output, exit_code = self.emulator.run(cmd) - self.assertEqual(exit_code, 0) - self.assertEqual(int(output[0]), 1) + self.assertTrue(len(self.get_n_fb_crc(uniq=True)) == 1) # We save the CRC value of an empty weston desktop for # later... - cmd = self.gen_read_disp_crcs_cmd() - output, exit_code = self.emulator.run(cmd) - self.assertEqual(exit_code, 0) - weston_desktop_crc = int(output[0], 16) + weston_desktop_crc = self.get_n_fb_crc(count=1)[0] # We start the weston-simple-egl in background... Every # rendered frame is supposed to be different (as the triangle @@ -138,10 +103,8 @@ class TestWeston(infra.basetest.BRTest): # display something, we are now supposed to measure a # different display CRC than the one we measured when the # desktop was empty. - cmd = self.gen_read_disp_crcs_cmd() - output, exit_code = self.emulator.run(cmd) - self.assertEqual(exit_code, 0) - self.assertNotEqual(int(output[0], 16), weston_desktop_crc) + crc = self.get_n_fb_crc(count=1)[0] + self.assertNotEqual(crc, weston_desktop_crc) # While weston-simple-egl is running, we check the VKMS DRM # CRCs are now changing. We get many CRCs, one per display @@ -152,10 +115,8 @@ class TestWeston(infra.basetest.BRTest): # remain very permissive to slow emulation situations. # Increase timeout, as the command is expected to run about 5s, # which is the default timeout. - cmd = self.gen_count_unique_disp_crcs_cmd(300) - output, exit_code = self.emulator.run(cmd, timeout=10) - self.assertEqual(exit_code, 0) - self.assertGreaterEqual(int(output[0]), 5) + crcs = self.get_n_fb_crc(count=300, timeout=10) + self.assertGreaterEqual(len(crcs), 5) # We stop weston-simple-egl, and sleep a bit to let Weston do # its cleanup and desktop repaint refresh... @@ -165,10 +126,8 @@ class TestWeston(infra.basetest.BRTest): # After we stopped the application, we should have the initial # weston desktop background. The CRC we measure now should be # the same as the one we saved earlier. - cmd = self.gen_read_disp_crcs_cmd() - output, exit_code = self.emulator.run(cmd) - self.assertEqual(exit_code, 0) - self.assertEqual(int(output[0], 16), weston_desktop_crc) + crc = self.get_n_fb_crc(count=1)[0] + self.assertEqual(crc, weston_desktop_crc) self.stop_weston() From patchwork Sat Sep 30 16:28:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1841616 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RyXj50sXQz1yp0 for ; Sun, 1 Oct 2023 03:28:57 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0577142248; Sat, 30 Sep 2023 16:28:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0577142248 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GfmIp7lAEIHD; Sat, 30 Sep 2023 16:28:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 880B9424EB; Sat, 30 Sep 2023 16:28:52 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 880B9424EB X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 57D1E1BF2A3 for ; Sat, 30 Sep 2023 16:28:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 337D960D58 for ; Sat, 30 Sep 2023 16:28:27 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 337D960D58 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tE0smbAA8Te4 for ; Sat, 30 Sep 2023 16:28:25 +0000 (UTC) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by smtp3.osuosl.org (Postfix) with ESMTPS id 61A6360A5C for ; Sat, 30 Sep 2023 16:28:25 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 61A6360A5C Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-32320381a07so10765844f8f.0 for ; Sat, 30 Sep 2023 09:28:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696091303; x=1696696103; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lj++xgGhxlCss5wBa0pp3ApTf4opgH+wNc7OhQDH2rg=; b=SgzsZkS1OX6MYDUJ98VZCTa8oLvScMo+Y1mIYDR9ioigeSYd8SGe/ovnm+0oU3tsvH 3qJOU5YW6qDGoDWpvgpunyDpSYvFzpAmakEkoJJKM4S4/N5gQpXI0n0w3Sp5+aX4Lie7 3g6yWM0KHUKVdTObVc/OJkTQSTWTw9ZM08RqJS71tkwUm9VEoWSyd8FBUO8xCo96vZQQ oqX8BO3NSoBzvZrbMiPeVfpVlKPstKc10RSAOiNuoYM/OFpE3KGKRdphu7b8A/CZ9HOx re95fFtfay0gtyEydi7T52xOm5ySBoB4iI4ykGpwx7zEhttQgBSGc+LAp9zzAJ5iY3Wv NjGg== X-Gm-Message-State: AOJu0YxjD9teAxDW6XeTA3rTImoibMEGBCCtWzCDnH7zrgRVilM0KRkt XRAAivYUtklSbIPJJrezFipIe/+h3nY= X-Google-Smtp-Source: AGHT+IH9VV+77nw08AYTiNX6XFRxhj7LToMX89qfR56VhDzDqyl6Pb4DHn4wTZnBXMSCMaKcSt7Stw== X-Received: by 2002:adf:e543:0:b0:317:f714:3be6 with SMTP id z3-20020adfe543000000b00317f7143be6mr6332409wrm.61.1696091303011; Sat, 30 Sep 2023 09:28:23 -0700 (PDT) Received: from scaer.home (2a01cb0404ad0b00e4d10b92e94d73af.ipv6.abo.wanadoo.fr. [2a01:cb04:4ad:b00:e4d1:b92:e94d:73af]) by smtp.gmail.com with ESMTPSA id o11-20020a5d4a8b000000b0031fc4c31d77sm24116368wrq.88.2023.09.30.09.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Sep 2023 09:28:22 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sat, 30 Sep 2023 18:28:21 +0200 Message-Id: <7cf874f127f56c8132862163aa2c4d44f6f39efe.1696091295.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696091303; x=1696696103; darn=buildroot.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=lj++xgGhxlCss5wBa0pp3ApTf4opgH+wNc7OhQDH2rg=; b=jOdjtwEcqH6nmdn6BdpD0LM3w4R5DSvvdkaxu2i1/+XL5hGHp0oVjxlCEuCfMGBeue PmJ5J9xPotSFd6OWa3mqdV94D/YoG5XUQNWOjdTy+XMlRv1ZPJdNIX4bDln/Em+u5pgA 4uFjDhL7JQ/eaiAOfqXj+r8eq/aPqOJEdhhgsElidJCm+2YlF0ZyvIpuE5r7FjLPipNB ML2jU2VB+CbvN4n6Cdq3VK3BKbIEZZXIBtJAdcS/vnMDLwhovALzk/uXe1TcnCpN4UfG G8v3LB5B1aag/OGknQULQ0ygCh7Oha/KcyFZxZLfbiIXeeA7r9HVjdQ0fitzsRL64Pwm yx5w== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=jOdjtwEc Subject: [Buildroot] [PATCH 2/2] suport/runtime-test: extend flutter test to check rendering is happening X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E. MORIN" , Adam Duskett Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Commit 7f0af11cee31 (support/testing/tests/package/test_flutter.py: new runtime test) added a simple test that just checked that the systemd unit launching the application, was active. It is perfectly possible, from a systemd perspective, that the unit is active, while the application actually crashes. Instead, what we need to check, is that the application does actually render "something" we don't really care what, as long as we know it is actually rendering, thus the graphical stack is working and the aplication stack is running). Extend the fultter runtime test to also check that the framebuffer is modified by the application when it is running, similarly to what we do in the weston test. We drop the activation of the unit and start it manually, as we want to check the state of the CRC before, during, and after the application runs. Signed-off-by: Yann E. MORIN Cc: Adam Duskett --- support/testing/tests/package/test_flutter.py | 33 ++++++++++++++++--- .../flutter-gallery.service | 1 - 2 files changed, 28 insertions(+), 6 deletions(-) delete mode 120000 support/testing/tests/package/test_flutter/overlay/etc/systemd/system/multi-user.target.wants/flutter-gallery.service diff --git a/support/testing/tests/package/test_flutter.py b/support/testing/tests/package/test_flutter.py index a3e98a43e5..6368bd1372 100644 --- a/support/testing/tests/package/test_flutter.py +++ b/support/testing/tests/package/test_flutter.py @@ -1,8 +1,11 @@ import os +import time import infra.basetest +from ..graphics_base import GraphicsBase -class TestFlutter(infra.basetest.BRTest): + +class TestFlutter(infra.basetest.BRTest, GraphicsBase): config = f""" BR2_aarch64=y BR2_TOOLCHAIN_EXTERNAL=y @@ -48,7 +51,27 @@ class TestFlutter(infra.basetest.BRTest): "-vnc", "none", "-drive", f"file={img},if=virtio,format=raw"]) self.emulator.login() - cmd = "systemctl is-active flutter-gallery" - output, exit_code = self.emulator.run(cmd, 10) - self.assertEqual(exit_code, 0) - self.assertEqual(output[0], "active") + + # Get the CRC from the current ramebuffer + empty_crc = self.get_n_fb_crc(count=1)[0] + + # Start the gallery Aapp. It can take a bit of time to start, + # so lets try a few times. 600 samples should cover about 10s + # @60Hz (although, the rendering could be much slower on slow + # machines) + self.assertRunOk("systemctl start flutter-gallery", timeout=10) + for i in range(600): + gallery_crc = self.get_n_fb_crc(count=1)[0] + if gallery_crc != empty_crc: + break + time.sleep(1) + self.assertNotEqual(gallery_crc, empty_crc, "gallery app did not render anything on screen") + + # Stop the application, and check it restored the framebuffer content + self.assertRunOk("systemctl start flutter-gallery", timeout=10) + for i in range(600): + gallery_crc = self.get_n_fb_crc(count=1)[0] + if gallery_crc == empty_crc: + break + time.sleep(1) + self.assertEqual(gallery_crc, empty_crc, "gallery app did stop rendering") diff --git a/support/testing/tests/package/test_flutter/overlay/etc/systemd/system/multi-user.target.wants/flutter-gallery.service b/support/testing/tests/package/test_flutter/overlay/etc/systemd/system/multi-user.target.wants/flutter-gallery.service deleted file mode 120000 index 40993fb16c..0000000000 --- a/support/testing/tests/package/test_flutter/overlay/etc/systemd/system/multi-user.target.wants/flutter-gallery.service +++ /dev/null @@ -1 +0,0 @@ -../../../../usr/lib/systemd/system/flutter-gallery.service \ No newline at end of file