From patchwork Sun Jul 31 15:20:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12933120 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50D90C19F2B for ; Sun, 31 Jul 2022 15:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233156AbiGaPUg (ORCPT ); Sun, 31 Jul 2022 11:20:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236805AbiGaPUe (ORCPT ); Sun, 31 Jul 2022 11:20:34 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF1D3260D for ; Sun, 31 Jul 2022 08:20:33 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0BE6556D; Sun, 31 Jul 2022 17:20:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659280832; bh=nHMSxXUMO60p2RGhdvdsIsFyJwSAZsVSA7ctIlCt+lY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ezb/NOJx8D98pKknccl1Bb9Gzo8RvM1baT2dTE7B+NqhBXNATFfjw0w420BZ3ihgr qxCfGmyjrVBlRwBxrr3mzjb45k4b1QEIwPj3ynxECpbeY218znZXoFAqEsTQwefkVz asarRY6gfMAJxyzEJEDVMWk8BAH9+W4c3rhECRvQ= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [kms-test] [PATCH 1/7] tests: brxalloc: Fix test start log message Date: Sun, 31 Jul 2022 18:20:18 +0300 Message-Id: <20220731152024.24090-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> References: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The test start log message incorrectly prints the same connector twice instead of the source and destination connectors. Fix it. Signed-off-by: Laurent Pinchart --- tests/kms-test-brxalloc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kms-test-brxalloc.py b/tests/kms-test-brxalloc.py index 7170ee6c7708..c80d2e33c846 100755 --- a/tests/kms-test-brxalloc.py +++ b/tests/kms-test-brxalloc.py @@ -62,7 +62,7 @@ class BRxAllocTest(kmstest.KMSTest): return self.start(f'Moving {len(planes)} planes from {outputs[0].connector.fullname} ' - f'to {outputs[0].connector.fullname}') + f'to {outputs[1].connector.fullname}') # Set the initial mode for both outputs and wait 5s for the monitors to # wake up. From patchwork Sun Jul 31 15:20:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12933121 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1C43C19F29 for ; Sun, 31 Jul 2022 15:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233631AbiGaPUg (ORCPT ); Sun, 31 Jul 2022 11:20:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232548AbiGaPUg (ORCPT ); Sun, 31 Jul 2022 11:20:36 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B859260D for ; Sun, 31 Jul 2022 08:20:35 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EDDBC415; Sun, 31 Jul 2022 17:20:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659280834; bh=jxokSrdOuulaS/ekU2uv7jdZrY7VBp/1BBKg6BYvGE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZQx6SoxJBaSXWeP/WuyI/oT+UixGlOibY/OlPoBWH0B25n95KNvIXAEKum05b8Zq zn/7TslbUTSUUxTWg0qBUNairaes5F69pKo/dVAN5RZBLP6/1aG7j8p+Ua/XVbaumV xMUZoAvwfVZzIDTkmfhjP2ttNpmkXI+blphduQjw= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [kms-test] [PATCH 2/7] tests: modes: Fix access to RuntimeError message text Date: Sun, 31 Jul 2022 18:20:19 +0300 Message-Id: <20220731152024.24090-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> References: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The RuntimeError class has no message member. Use args[0] instead. Signed-off-by: Laurent Pinchart --- tests/kms-test-modes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kms-test-modes.py b/tests/kms-test-modes.py index c47848904ec4..14463add7802 100755 --- a/tests/kms-test-modes.py +++ b/tests/kms-test-modes.py @@ -60,7 +60,7 @@ class ModesTest(kmstest.KMSTest): self.progress(i+1, len(modes)) self.test_mode(connector, crtc, modes[i]) except RuntimeError as e: - self.fail(e.message) + self.fail(e.args[0]) break else: self.success() From patchwork Sun Jul 31 15:20:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12933122 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB188C19F2D for ; Sun, 31 Jul 2022 15:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233306AbiGaPUi (ORCPT ); Sun, 31 Jul 2022 11:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232548AbiGaPUh (ORCPT ); Sun, 31 Jul 2022 11:20:37 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21816260D for ; Sun, 31 Jul 2022 08:20:37 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A87F856D; Sun, 31 Jul 2022 17:20:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659280835; bh=PgII6PKbk6FEAQwwNtpY2aRWdHHo4rDqLUPCd2UzAPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u3vcSUJvI8IyYv15CuyudmBdhZmt7aNq5ISXF++AdgAT4RgGiVECqmT8XoM/a/A9y eNLgsTLSifYsgOmEw0YEjVaKwlDcOBgN2RFeW/rnQnY6qql3taQDQJEzlVfX7zra8W kkJvzOIAlo3QnGAjLbBN6tl5+LQWcc61Jf70AsfQ= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [kms-test] [PATCH 3/7] kmstest: Fix CRC directory name string Date: Sun, 31 Jul 2022 18:20:20 +0300 Message-Id: <20220731152024.24090-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> References: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The CRC directory name string was converted to a Python formatted string literal incorrectly, with the f prefix within the string instead of just before it. Fix it. Fixes: dcbc93a117b0 ("tests: Convert to formatted string literals") Signed-off-by: Laurent Pinchart --- tests/kmstest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kmstest.py b/tests/kmstest.py index 18432375c1ca..177110ebd894 100755 --- a/tests/kmstest.py +++ b/tests/kmstest.py @@ -171,7 +171,7 @@ class CRCReader(object): # Hardcode the device minor to 0 as the KMSTest constructor opens the # default card object. - self.dir = os.open('f/sys/kernel/debug/dri/0/crtc-{self.pipe}/crc', 0) + self.dir = os.open(f'/sys/kernel/debug/dri/0/crtc-{self.pipe}/crc', 0) self.ctrl = os.open('control', os.O_WRONLY, dir_fd = self.dir) self.data = -1 From patchwork Sun Jul 31 15:20:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12933123 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEBAFC00140 for ; Sun, 31 Jul 2022 15:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233771AbiGaPUk (ORCPT ); Sun, 31 Jul 2022 11:20:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232548AbiGaPUj (ORCPT ); Sun, 31 Jul 2022 11:20:39 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A26F7260D for ; Sun, 31 Jul 2022 08:20:38 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2B1086D4; Sun, 31 Jul 2022 17:20:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659280837; bh=GdbhRD+IZtalaTcAijl8rQrM63Eq773gcNvZ0V2Us3c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCx1xvCejOgxWFV0uFz8n4OaiZH1+5+nOgTXEaMQ05TZOMY1mPGkM9UfHm5NuBYIF WMp9YjrZ5wUyhNjU+lb9EWgAtFPssWnNO8aHcBRSOATH0xels8WBPVPp5o3jpRQw5B ZKR0h33c6OazGrc2P5Rtp4Iwgt2eZi4XJHT0Tfj0= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [kms-test] [PATCH 4/7] kmstest: Fix exception handling in CRCReader constructor and destructor Date: Sun, 31 Jul 2022 18:20:21 +0300 Message-Id: <20220731152024.24090-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> References: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org If an exception occurs in the CRCReader constructor, the self.dir, self.ctrl and self.data members may not be set. This causes another exception to be thrown by the destructor when it tries to access those members. Fix it by initializing all the members first, and only closing the dir and ctrl file descriptors if they have been successfully opened. Signed-off-by: Laurent Pinchart --- tests/kmstest.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/kmstest.py b/tests/kmstest.py index 177110ebd894..960c27f301ce 100755 --- a/tests/kmstest.py +++ b/tests/kmstest.py @@ -168,17 +168,21 @@ class CRCReader(object): def __init__(self, crtc): self.pipe = crtc.idx + self.ctrl = -1 + self.dir = -1 + self.data = -1 # Hardcode the device minor to 0 as the KMSTest constructor opens the # default card object. self.dir = os.open(f'/sys/kernel/debug/dri/0/crtc-{self.pipe}/crc', 0) self.ctrl = os.open('control', os.O_WRONLY, dir_fd = self.dir) - self.data = -1 def __del__(self): self.stop() - os.close(self.ctrl) - os.close(self.dir) + if self.ctrl != -1: + os.close(self.ctrl) + if self.dir != -1: + os.close(self.dir) def start(self, source): os.write(self.ctrl, source.encode('ascii')) From patchwork Sun Jul 31 15:20:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12933124 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09501C00140 for ; Sun, 31 Jul 2022 15:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236763AbiGaPUl (ORCPT ); Sun, 31 Jul 2022 11:20:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233668AbiGaPUl (ORCPT ); Sun, 31 Jul 2022 11:20:41 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F218630C for ; Sun, 31 Jul 2022 08:20:40 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D12056D; Sun, 31 Jul 2022 17:20:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659280838; bh=oougXVdBnWnqFqSl9zia5AsdVAllO259xkmmRVwOuAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XB4ewKQtguxTK62EJH5fl5y5ppXX88R/6wZu1THha4aLajXs2dZxHSt2RC+cvCA1H NbdFtNMigY6QfyvvJ29IFxUmJmPzNqgUr4grWnTF83Vr3BYu7GCDFuOlKKX0VU+3ve u51WnDrySM8DqFJ1ghQ7z2vp3rdOE02oTzW1yQ2c= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [kms-test] [PATCH 5/7] tests: crc: Skip test if CRC support isn't available Date: Sun, 31 Jul 2022 18:20:22 +0300 Message-Id: <20220731152024.24090-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> References: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org If CRC support isn't available (most likely caused by debugfs not being mounted), the CRCReader constructor will throw an exception that the crc test doesn't handle. Move construction of the CRCReader earlier and skip the test if it fails. Signed-off-by: Laurent Pinchart --- tests/kms-test-crc.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/kms-test-crc.py b/tests/kms-test-crc.py index efb3cf0dbe41..01f9606f2de9 100755 --- a/tests/kms-test-crc.py +++ b/tests/kms-test-crc.py @@ -123,6 +123,13 @@ class CRCTest(kmstest.KMSTest): for crtc in self.card.crtcs: self.start(f'CRC calculation on CRTC {crtc.id}') + try: + crc_reader = kmstest.CRCReader(crtc) + except: + self.logger.log('Failed to create CRC reader, check that debugfs is mounted') + self.skip(f'CRC support not available for CRTC {crtc.id}') + continue + # Get the connector and default mode try: connector = connectors[crtc]; @@ -198,7 +205,6 @@ class CRCTest(kmstest.KMSTest): # Set the CRC source and acquire 10 CRC values. Discard the # first value, as the device is running and the new source # needs one frame to take effect. - crc_reader = kmstest.CRCReader(crtc) crc_reader.start(crc_source) crcs = crc_reader.read(10) crc_reader.stop() From patchwork Sun Jul 31 15:20:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12933125 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FBF9C00140 for ; Sun, 31 Jul 2022 15:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236334AbiGaPUo (ORCPT ); Sun, 31 Jul 2022 11:20:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236805AbiGaPUn (ORCPT ); Sun, 31 Jul 2022 11:20:43 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04D48630C for ; Sun, 31 Jul 2022 08:20:42 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 84D5C415; Sun, 31 Jul 2022 17:20:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659280840; bh=SCansLg4IFK/Xr/uTK3tz3Ye2NHxHbag80ujgoJT+Go=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TSPmOoX6Q1AePKB9wKF7Z7Gek//axhOhZvRfRE35cf7Z0FUIuDhShOAcPYuAbWIYz 6iVrNR3uCqONFlbnX2KBWgaU0GgEib7YZwW+0xBODxEZxMF67bzzgCkgRVs2d88gdl hqNTYL5TH36kO2ZLfs42gC/JXUBFpsDkDjHMNUrk= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [kms-test] [PATCH 6/7] tests: Only call execute() if the test is run directly Date: Sun, 31 Jul 2022 18:20:23 +0300 Message-Id: <20220731152024.24090-7-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> References: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Only run a test automatically if the Python test script is executed directly. This will allow importing tests as modules in a test runner. Signed-off-by: Laurent Pinchart --- tests/kms-test-allplanes.py | 4 +++- tests/kms-test-brxalloc.py | 4 +++- tests/kms-test-connectors.py | 3 ++- tests/kms-test-crc.py | 4 +++- tests/kms-test-formats.py | 4 +++- tests/kms-test-legacy-modeset.py | 4 +++- tests/kms-test-modes.py | 4 +++- tests/kms-test-modeset.py | 4 +++- tests/kms-test-pageflip.py | 4 +++- tests/kms-test-plane-alpha.py | 4 +++- tests/kms-test-plane-position.py | 4 +++- tests/kms-test-plane-zpos.py | 4 +++- tests/kms-test-routing.py | 3 ++- 13 files changed, 37 insertions(+), 13 deletions(-) diff --git a/tests/kms-test-allplanes.py b/tests/kms-test-allplanes.py index 96ac4f19f538..6a6f7e72ca52 100755 --- a/tests/kms-test-allplanes.py +++ b/tests/kms-test-allplanes.py @@ -85,4 +85,6 @@ class AllPlanesTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) -AllPlanesTest().execute() + +if __name__ == '__main__': + AllPlanesTest().execute() diff --git a/tests/kms-test-brxalloc.py b/tests/kms-test-brxalloc.py index c80d2e33c846..3ccd6995b449 100755 --- a/tests/kms-test-brxalloc.py +++ b/tests/kms-test-brxalloc.py @@ -128,4 +128,6 @@ class BRxAllocTest(kmstest.KMSTest): self.atomic_crtc_disable(outputs[0].crtc) self.atomic_crtc_disable(outputs[1].crtc) -BRxAllocTest().execute() + +if __name__ == '__main__': + BRxAllocTest().execute() diff --git a/tests/kms-test-connectors.py b/tests/kms-test-connectors.py index d2ca636eb2a0..fdbe8bdf6e97 100755 --- a/tests/kms-test-connectors.py +++ b/tests/kms-test-connectors.py @@ -27,4 +27,5 @@ class ConnectorsTest(kmstest.KMSTest): self.success() -ConnectorsTest().execute() +if __name__ == '__main__': + ConnectorsTest().execute() diff --git a/tests/kms-test-crc.py b/tests/kms-test-crc.py index 01f9606f2de9..b1af65d5256d 100755 --- a/tests/kms-test-crc.py +++ b/tests/kms-test-crc.py @@ -230,4 +230,6 @@ class CRCTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) -CRCTest().execute() + +if __name__ == '__main__': + CRCTest().execute() diff --git a/tests/kms-test-formats.py b/tests/kms-test-formats.py index 5c3bfd441a38..afc5454d0b5d 100755 --- a/tests/kms-test-formats.py +++ b/tests/kms-test-formats.py @@ -75,4 +75,6 @@ class FormatsTest(kmstest.KMSTest): else: self.success() -FormatsTest().execute() + +if __name__ == '__main__': + FormatsTest().execute() diff --git a/tests/kms-test-legacy-modeset.py b/tests/kms-test-legacy-modeset.py index 06eceade19c4..4082093ab985 100755 --- a/tests/kms-test-legacy-modeset.py +++ b/tests/kms-test-legacy-modeset.py @@ -59,4 +59,6 @@ class LegacyModeSetTest(kmstest.KMSTest): self.success() -LegacyModeSetTest().execute() + +if __name__ == '__main__': + LegacyModeSetTest().execute() diff --git a/tests/kms-test-modes.py b/tests/kms-test-modes.py index 14463add7802..d857dd6e6f05 100755 --- a/tests/kms-test-modes.py +++ b/tests/kms-test-modes.py @@ -65,4 +65,6 @@ class ModesTest(kmstest.KMSTest): else: self.success() -ModesTest().execute() + +if __name__ == '__main__': + ModesTest().execute() diff --git a/tests/kms-test-modeset.py b/tests/kms-test-modeset.py index e8b3d9ac37f9..fd0c4acb91de 100755 --- a/tests/kms-test-modeset.py +++ b/tests/kms-test-modeset.py @@ -58,4 +58,6 @@ class ModeSetTest(kmstest.KMSTest): else: self.success() -ModeSetTest().execute() + +if __name__ == '__main__': + ModeSetTest().execute() diff --git a/tests/kms-test-pageflip.py b/tests/kms-test-pageflip.py index 14bea0a877a3..1bb1214080ff 100755 --- a/tests/kms-test-pageflip.py +++ b/tests/kms-test-pageflip.py @@ -118,4 +118,6 @@ class PageFlipTest(kmstest.KMSTest): f'({self.flips}/{frames} frames in {interval} s)') self.success() -PageFlipTest().execute() + +if __name__ == '__main__': + PageFlipTest().execute() diff --git a/tests/kms-test-plane-alpha.py b/tests/kms-test-plane-alpha.py index 8802bfeae40c..894e4ab8baaa 100755 --- a/tests/kms-test-plane-alpha.py +++ b/tests/kms-test-plane-alpha.py @@ -94,4 +94,6 @@ class PlaneAlphaTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) -PlaneAlphaTest().execute() + +if __name__ == '__main__': + PlaneAlphaTest().execute() diff --git a/tests/kms-test-plane-position.py b/tests/kms-test-plane-position.py index aceb849950a1..5dfcfaaba05e 100755 --- a/tests/kms-test-plane-position.py +++ b/tests/kms-test-plane-position.py @@ -123,4 +123,6 @@ class PlanePositionTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) self.success() -PlanePositionTest().execute() + +if __name__ == '__main__': + PlanePositionTest().execute() diff --git a/tests/kms-test-plane-zpos.py b/tests/kms-test-plane-zpos.py index 052eea542ec0..d27008823827 100755 --- a/tests/kms-test-plane-zpos.py +++ b/tests/kms-test-plane-zpos.py @@ -99,4 +99,6 @@ class PlaneZPosTest(kmstest.KMSTest): self.atomic_crtc_disable(crtc) -PlaneZPosTest().execute() + +if __name__ == '__main__': + PlaneZPosTest().execute() diff --git a/tests/kms-test-routing.py b/tests/kms-test-routing.py index 68aff9c11cff..ccf61d83488d 100755 --- a/tests/kms-test-routing.py +++ b/tests/kms-test-routing.py @@ -141,4 +141,5 @@ class RoutingTest(kmstest.KMSTest): return allocated -RoutingTest().execute() +if __name__ == '__main__': + RoutingTest().execute() From patchwork Sun Jul 31 15:20:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12933126 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E51BAC19F29 for ; Sun, 31 Jul 2022 15:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232548AbiGaPUp (ORCPT ); Sun, 31 Jul 2022 11:20:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233668AbiGaPUo (ORCPT ); Sun, 31 Jul 2022 11:20:44 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 789DC6321 for ; Sun, 31 Jul 2022 08:20:43 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EA34A56D; Sun, 31 Jul 2022 17:20:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659280842; bh=KuMe3zFeEt4xUdUmdKtkeB0lYKDCMajCOuwwK4Ir6i4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pdd9Ny4OPp6CVE3IRWOLKyvQU2VYhUbmatck4XOdJJ7uM0R2VPueb3JudalBct7Nl m9Bam7FMTzuzfrJVzR9m/0+BFHSr8GxFf2wsaHHrHonvMl3vaPUSl8FX7K9KfEjuQM qSOgWSXulYGZs1C60Ly28ETFLUjdPZsoqLIeWfJY= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [kms-test] [PATCH 7/7] kmstest: Implement test runner when executed directly Date: Sun, 31 Jul 2022 18:20:24 +0300 Message-Id: <20220731152024.24090-8-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> References: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Run all tests from the current directory when the kmstest.py script it executed directly, as opposed to being imported by individual tests. This simplifies running all tests. Signed-off-by: Laurent Pinchart --- tests/kmstest.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/kmstest.py b/tests/kmstest.py index 960c27f301ce..e84d8fe859f4 100755 --- a/tests/kmstest.py +++ b/tests/kmstest.py @@ -334,7 +334,17 @@ class KMSTest(object): if use_default_key_handler: self.loop.register(sys.stdin, selectors.EVENT_READ, self.__read_key) + def __enter__(self): + return self + + def __exit__(self, *err): + self.card = None + self.loop.close() + self.logger.close() + def __del__(self): + self.card = None + self.loop.close() self.logger.close() def atomic_crtc_disable(self, crtc, sync=True): @@ -520,3 +530,33 @@ class KMSTest(object): sys.stdout.write(f'\rTesting {self.test_name}: SUCCESS\n') sys.stdout.flush() + +if __name__ == '__main__': + import importlib + import inspect + import os + + files = [] + for path in os.scandir(): + if path.is_file() and path.name.startswith('kms-test-') and path.name.endswith('.py'): + files.append(path.name) + + files.sort() + for file in files: + print(f'- {file}') + module = importlib.import_module(file[:-3]) + tests = [] + for name in dir(module): + obj = getattr(module, name) + if not isinstance(obj, type): + continue + + if 'KMSTest' in [cls.__name__ for cls in inspect.getmro(obj)]: + tests.append(obj) + + for test in tests: + # Use a context manager to ensure proper cleanup after each test, + # otherwise state from one test may leak to the other based on when + # objects end up being deleted. + with test() as test: + test.execute() From patchwork Sun Jul 31 18:52:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12933196 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE1C6C00140 for ; Sun, 31 Jul 2022 18:52:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237673AbiGaSwr (ORCPT ); Sun, 31 Jul 2022 14:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237649AbiGaSwl (ORCPT ); Sun, 31 Jul 2022 14:52:41 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5F0F959A for ; Sun, 31 Jul 2022 11:52:38 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D0964415; Sun, 31 Jul 2022 20:52:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659293557; bh=cCuKZ2f0lHj9gooIf7Nxg5YrlNEnz2MB9DgutAuSDxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OXYCdIK/yC39lfdJaFq0eMsa/z6a4MLIqLIYLJE32IRDAycg/Db7KHoxgbLdtTfIH bzztzHmTk6bWSN/zomPgpt5OqV2obihcYGWOMSZ6pEvwyYIA1K8O2eh4XIguDhMC1I QrkGNomd1KBRrCn1i/S1RJJiX0jf02WwDWa0BbB0= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [kms-test] [PATCH 8/7] tests: Don't skip formats and plane-position tests on unconnected connector Date: Sun, 31 Jul 2022 21:52:32 +0300 Message-Id: <20220731185232.11121-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> References: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The formats and plane-position tests need one connected connector. Don't skip them upon the first unconnected connector, only when no connected connector can be found. Signed-off-by: Laurent Pinchart --- tests/kms-test-formats.py | 2 +- tests/kms-test-plane-position.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/kms-test-formats.py b/tests/kms-test-formats.py index afc5454d0b5d..a4f4fbfa3071 100755 --- a/tests/kms-test-formats.py +++ b/tests/kms-test-formats.py @@ -15,7 +15,7 @@ class FormatsTest(kmstest.KMSTest): # Find a CRTC with a connected connector and at least one plane for connector in self.output_connectors(): if not connector.connected(): - self.skip('unconnected connector') + self.logger.log(f'unconnected connector {connector.fullname}') continue try: diff --git a/tests/kms-test-plane-position.py b/tests/kms-test-plane-position.py index 5dfcfaaba05e..c85375adc0d2 100755 --- a/tests/kms-test-plane-position.py +++ b/tests/kms-test-plane-position.py @@ -15,7 +15,7 @@ class PlanePositionTest(kmstest.KMSTest): # Find a CRTC with a connected connector and at least two planes for connector in self.output_connectors(): if not connector.connected(): - self.skip('unconnected connector') + self.logger.log(f'unconnected connector {connector.fullname}') continue try: From patchwork Sun Jul 31 18:52:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 12933197 X-Patchwork-Delegate: kieran@bingham.xyz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 334F1C19F2C for ; Sun, 31 Jul 2022 18:52:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235053AbiGaSws (ORCPT ); Sun, 31 Jul 2022 14:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237661AbiGaSwq (ORCPT ); Sun, 31 Jul 2022 14:52:46 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94F52E037 for ; Sun, 31 Jul 2022 11:52:43 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2A68F415; Sun, 31 Jul 2022 20:52:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1659293562; bh=eBfnfDHslXJbMu7WHHvEm6XeS0XUVMM2vkRzHqkqaO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJGttAtE3YutjsOOMtMmWPO5nliJ9w/sHvEGyxkQ5qMv6vu+xSmCi3mANodpGpFeC K+njTom+0dPZk9dD38wzikDqe1X/qt1Ctt53y/7UUuMxOTwF4PDaC98jc+wK/Azq4N M7NMvnhXJHOUH5g6dk8hdK0xUr+ryl8/i42gipvM= From: Laurent Pinchart To: linux-renesas-soc@vger.kernel.org Cc: Kieran Bingham Subject: [kms-test] [PATCH 9/7] kmstest: Raise clear exception when property is not found Date: Sun, 31 Jul 2022 21:52:37 +0300 Message-Id: <20220731185237.11151-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> References: <20220731152024.24090-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org When converting a property value string to an integer, if the property is not found, an AttributeError exception is raised and reports that "'NoneType' object has no attribute 'type'". This isn't very clear, replace it with a RuntimeError with a proper message. Signed-off-by: Laurent Pinchart --- tests/kmstest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/kmstest.py b/tests/kmstest.py index e84d8fe859f4..3e53defc1dae 100755 --- a/tests/kmstest.py +++ b/tests/kmstest.py @@ -268,6 +268,8 @@ class AtomicRequest(pykms.AtomicReq): if isinstance(v, str): if v.endswith('%'): prop = obj.get_prop(k) + if not prop: + raise RuntimeError(f'Property {k} not supported by object {obj}') if prop.type not in (pykms.PropertyType.Range, pykms.PropertyType.SignedRange): raise RuntimeError(f'Unsupported property type {prop.type} for value {v}')