[PATCH i-g-t 2/3] tests/kms_flip: Restrict the hang tests execution to two pipes

Bhanuprakash Modem bhanuprakash.modem at intel.com
Fri Jul 2 12:40:05 UTC 2021


To save the CI execution time, instead of running on all pipes
restrict the hang tests execution to two pipes (first & last).

If we want to execute on all pipes, we need to pass an extra
argument "-e" indicates extended.

Example: ./build/tests/kms_flip -e --r flip-vs-modeset-vs-hang

v2, v3:
* Fix the typo in args handler (Petri)

Cc: Uma Shankar <uma.shankar at intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
Cc: Karthik B S <karthik.b.s at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Reviewed-by: Petri Latvala <petri.latvala at intel.com>
---
 tests/kms_flip.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 8f736652be..8f27da2841 100755
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -85,6 +85,8 @@
 #define DRM_CAP_TIMESTAMP_MONOTONIC 6
 #endif
 
+static bool all_pipes = false;
+
 drmModeRes *resources;
 int drm_fd;
 static struct buf_ops *bops;
@@ -1450,6 +1452,11 @@ static int run_test(int duration, int flags)
 	/* Count output configurations to scale test runtime. */
 	for (i = 0; i < resources->count_connectors; i++) {
 		for (n = 0; n < resources->count_crtcs; n++) {
+			/* Limit the execution to 2 CRTCs (first & last) for hang tests */
+			if (((flags & TEST_HANG) && !all_pipes) &&
+			    (n != 0 || n != resources->count_crtcs - 1))
+				continue;
+
 			memset(&o, 0, sizeof(o));
 			o.count = 1;
 			o._connector[0] = resources->connectors[i];
@@ -1474,6 +1481,11 @@ static int run_test(int duration, int flags)
 		for (n = 0; n < resources->count_crtcs; n++) {
 			int crtc_idx;
 
+			/* Limit the execution to 2 CRTCs (first & last) for hang tests */
+			if (((flags & TEST_HANG) && !all_pipes) &&
+			    (n != 0 || n != resources->count_crtcs - 1))
+				continue;
+
 			memset(&o, 0, sizeof(o));
 			o.count = 1;
 			o._connector[0] = resources->connectors[i];
@@ -1505,8 +1517,18 @@ static int run_pair(int duration, int flags)
 	/* Find a pair of connected displays */
 	for (i = 0; i < resources->count_connectors; i++) {
 		for (n = 0; n < resources->count_crtcs; n++) {
+			/* Limit the execution to 2 CRTCs (first & last) for hang tests */
+			if (((flags & TEST_HANG) && !all_pipes) &&
+			    (n != 0 || n != resources->count_crtcs - 1))
+				continue;
+
 			for (j = i + 1; j < resources->count_connectors; j++) {
 				for (m = n + 1; m < resources->count_crtcs; m++) {
+					/* Limit the execution to 2 CRTCs (first & last) for hang tests */
+					if (((flags & TEST_HANG) && !all_pipes) &&
+					    (m != 0 || m != resources->count_crtcs - 1))
+						continue;
+
 					memset(&o, 0, sizeof(o));
 					o.count = 2;
 					o._connector[0] = resources->connectors[i];
@@ -1534,10 +1556,20 @@ static int run_pair(int duration, int flags)
 	/* Find a pair of connected displays */
 	for (i = 0; i < resources->count_connectors; i++) {
 		for (n = 0; n < resources->count_crtcs; n++) {
+			/* Limit the execution to 2 CRTCs (first & last) for hang tests */
+			if (((flags & TEST_HANG) && !all_pipes) &&
+			    (n != 0 || n != resources->count_crtcs - 1))
+				continue;
+
 			for (j = i + 1; j < resources->count_connectors; j++) {
 				for (m = n + 1; m < resources->count_crtcs; m++) {
 					int crtc_idxs[2];
 
+					/* Limit the execution to 2 CRTCs (first & last) for hang tests */
+					if (((flags & TEST_HANG) && !all_pipes) &&
+					    (m != 0 || m != resources->count_crtcs - 1))
+						continue;
+
 					memset(&o, 0, sizeof(o));
 					o.count = 2;
 					o._connector[0] = resources->connectors[i];
@@ -1604,7 +1636,23 @@ static void test_nonblocking_read(int in)
 	close(fd);
 }
 
-igt_main
+static int opt_handler(int opt, int opt_index, void *data)
+{
+	switch (opt) {
+		case 'e':
+			all_pipes = true;
+			break;
+		default:
+			return IGT_OPT_HANDLER_ERROR;
+	}
+
+	return IGT_OPT_HANDLER_SUCCESS;
+}
+
+const char *help_str =
+	"  -e \tRun on all pipes. (By default subtests will run on two pipes)\n";
+
+igt_main_args("e", NULL, help_str, opt_handler, NULL)
 {
 	struct {
 		int duration;
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list