[PATCH i-g-t 1/3] tests/intel/kms_dirtyfb: Modify check_feature to not use assert

Jouni Högander jouni.hogander at intel.com
Mon Mar 25 16:53:47 UTC 2024


We want to use prepare and check_feature to figure out if features are
supported before adding dynamic tests. Due to this do not use assert in
check_feature. Instead return false if the feature is not supported
properly. Also move check_feature to the caller of prepare and do the
assertion there.

Signed-off-by: Jouni Högander <jouni.hogander at intel.com>
---
 tests/intel/kms_dirtyfb.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/tests/intel/kms_dirtyfb.c b/tests/intel/kms_dirtyfb.c
index 9e4832929..e1b854a22 100644
--- a/tests/intel/kms_dirtyfb.c
+++ b/tests/intel/kms_dirtyfb.c
@@ -140,29 +140,30 @@ static void enable_feature(data_t *data)
 	}
 }
 
-static void check_feature(data_t *data)
+static bool check_feature(data_t *data)
 {
 	switch (data->feature) {
 	case FEATURE_NONE:
+	case FEATURE_DEFAULT:
 		break;
 	case FEATURE_FBC:
-		igt_assert_f(intel_fbc_wait_until_enabled(data->drm_fd,
-							  data->pipe),
-			     "FBC still disabled\n");
+		if (intel_fbc_wait_until_enabled(data->drm_fd,
+						 data->pipe))
+			return false;
 		break;
 	case FEATURE_PSR:
-		igt_assert_f(psr_wait_entry(data->debugfs_fd, PSR_MODE_1, NULL),
-			     "PSR still disabled\n");
+		if (!psr_wait_entry(data->debugfs_fd, PSR_MODE_1, NULL))
+			return false;
 		break;
 	case FEATURE_DRRS:
-		igt_assert_f(!intel_is_drrs_inactive(data->drm_fd, data->pipe),
-			     "DRRS INACTIVE\n");
-		break;
-	case FEATURE_DEFAULT:
+		if (intel_is_drrs_inactive(data->drm_fd, data->pipe))
+			return false;
 		break;
 	default:
 		igt_assert(false);
 	}
+
+	return true;
 }
 
 static void disable_features(data_t *data)
@@ -224,8 +225,6 @@ static void prepare(data_t *data)
 	enable_feature(data);
 
 	igt_display_commit2(&data->display, COMMIT_ATOMIC);
-
-	check_feature(data);
 }
 
 static void cleanup(data_t *data)
@@ -337,6 +336,9 @@ igt_main
 						      kmstest_pipe_name(data.pipe),
 						      igt_output_name(data.output)) {
 						prepare(&data);
+						igt_assert_f(check_feature(&data),
+							     "%s was not correctly enabled",
+							     feature_str(data.feature));
 						run_test(&data);
 						cleanup(&data);
 					}
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list