[igt-dev] [PATCH i-g-t 4/4] tests/kms_sysfs_edid_timing: add total mean assertion threshold

Luca Coelho luca at coelho.fi
Tue Jun 7 07:42:40 UTC 2022


From: Luca Coelho <luciano.coelho at intel.com>

Add an assertion to make sure that the mean time it takes to probe all
connectors doesn't exceed 30 ms.  This is an arbitrary but reasonable
amount of time.

Signed-off-by: Luca Coelho <luciano.coelho at intel.com>
---
 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 4255cae3be17..680e4ef5985e 100644
--- a/tests/kms_sysfs_edid_timing.c
+++ b/tests/kms_sysfs_edid_timing.c
@@ -28,21 +28,27 @@
 
 #define THRESHOLD_PER_CONNECTOR		50
 #define THRESHOLD_PER_CONNECTOR_MEAN	40
+#define THRESHOLD_ALL_CONNECTORS_MEAN	30
 #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 reprode one connector is too long.");
+		     "to reprode 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



More information about the igt-dev mailing list