Return-Path: Received: from farmhouse.coelho.fi (paleale.coelho.fi [176.9.41.70]) by gabe.freedesktop.org (Postfix) with ESMTPS id C357110E3A2 for ; Wed, 15 Jun 2022 12:25:42 +0000 (UTC) From: Luca Coelho To: igt-dev@lists.freedesktop.org Date: Wed, 15 Jun 2022 15:25:33 +0300 Message-Id: <20220615122533.658564-5-luca@coelho.fi> In-Reply-To: <20220615122533.658564-1-luca@coelho.fi> References: <20220615122533.658564-1-luca@coelho.fi> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [PATCH i-g-t v2 4/4] tests/kms_sysfs_edid_timing: add total mean assertion threshold List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: petri.latvala@intel.com Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: From: Luca Coelho Add an assertion to make sure that the mean time it takes to probe all connectors doesn't exceed 100 ms. This is an arbitrary but reasonable amount of time, based on real life tests. Signed-off-by: Luca Coelho --- tests/kms_sysfs_edid_timing.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/kms_sysfs_edid_timing.c b/tests/kms_sysfs_edid_timing.c index 4a14965fc21d..775211089f81 100644 --- a/tests/kms_sysfs_edid_timing.c +++ b/tests/kms_sysfs_edid_timing.c @@ -28,21 +28,27 @@ #define THRESHOLD_PER_CONNECTOR 150 #define THRESHOLD_PER_CONNECTOR_MEAN 140 +#define THRESHOLD_ALL_CONNECTORS_MEAN 100 #define CHECK_TIMES 15 IGT_TEST_DESCRIPTION("This test checks the time it takes to reprobe each " "connector and fails if either the time it takes for " "one reprobe is too long or if the mean time it takes " - "to reprobe one connector is too long."); + "to reprobe one connector is too long. Additionally, " + "make sure that the mean time for all connectors is " + "not too long."); igt_simple_main { DIR *dirp; struct dirent *de; + struct igt_mean all_mean; dirp = opendir("/sys/class/drm"); igt_assert(dirp != NULL); + igt_mean_init(&all_mean); + while ((de = readdir(dirp))) { struct igt_mean mean = {}; struct stat st; @@ -88,7 +94,14 @@ igt_simple_main "%s: mean probe time exceeded %dms, max=%.2fms, avg=%.2fms\n", de->d_name, THRESHOLD_PER_CONNECTOR_MEAN, mean.max / 1e6, mean.mean / 1e6); + + igt_mean_add(&all_mean, mean.mean); } - closedir(dirp); + igt_assert_f(all_mean.mean < THRESHOLD_ALL_CONNECTORS_MEAN * 1e6, + "Mean of all connector means exceeds %dms, max=%.2fms, mean=%.2fms\n", + THRESHOLD_ALL_CONNECTORS_MEAN, all_mean.max / 1e6, + all_mean.mean / 1e6); + + closedir(dirp); } -- 2.36.1