[PATCH i-g-t 6/7] HAX: debug messages

Dominik Karol Piatkowski dominik.karol.piatkowski at intel.com
Tue May 23 06:08:54 UTC 2023


---
 lib/igt_ktap.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/lib/igt_ktap.c b/lib/igt_ktap.c
index 11f4a607..0c4d6181 100644
--- a/lib/igt_ktap.c
+++ b/lib/igt_ktap.c
@@ -336,6 +336,8 @@ void *igt_ktap_parser(void *unused)
 	char record[BUF_LEN + 1];
 	bool is_builtin = ktap_args.is_builtin;
 
+	int debug_counter = 0;
+
 	struct ktap_test_results_element *r, *temp;
 	struct timespec last_kmsg, current;
 
@@ -370,27 +372,35 @@ igt_ktap_parser_start:
 				igt_warn("kmsg truncated: too many messages. You may want to increase log_buf_len in kmcdline\n");
 				continue;
 			}
+			fprintf(stderr, "[DEBUG] read successful; results.still_running: %d\n", READ_ONCE(results.still_running));
 		}
 
 		clock_gettime(CLOCK_MONOTONIC, &last_kmsg);
 
 		while (sublevel >= 0) {
+
+			fprintf(stderr, "[DEBUG] sublevel: %d\n", sublevel);
+
 			switch (find_next_tap_subtest(fp, record, is_builtin)) {
 			case -2:
 				/* no more data to read */
+				fprintf(stderr, "[DEBUG] find_next_tap_subtest: -2\n");
 				goto igt_ktap_parser_start;
 			case -1:
 				/* no test found, so we keep parsing */
+				fprintf(stderr, "[DEBUG] find_next_tap_subtest: -1\n");
 				break;
 			case 0:
 				/*
 				 * tests found, but they're missing info, so we might
 				 * have read into test output
 				 */
+				fprintf(stderr, "[DEBUG] find_next_tap_subtest: 0\n");
 				found_tests = true;
 				sublevel++;
 				break;
 			default:
+				fprintf(stderr, "[DEBUG] find_next_tap_subtest: default\n");
 				while (read(fp_fd, record, BUF_LEN) < 0) {
 					if (errno == EINTR)
 						continue;
@@ -416,8 +426,10 @@ igt_ktap_parser_start:
 
 			switch (parse_kmsg_for_tap(fp, record, test_name)) {
 			case -2:
+				fprintf(stderr, "[DEBUG] parse_kmsg_for_tap: -2\n");
 				goto igt_ktap_parser_start;
 			case -1:
+				fprintf(stderr, "[DEBUG] parse_kmsg_for_tap: -1\n");
 				sublevel--;
 				failed_tests = true;
 
@@ -443,18 +455,35 @@ igt_ktap_parser_start:
 				test_name[0] = '\0';
 				break;
 			case 0: /* fallthrough */
+				fprintf(stderr, "[DEBUG] parse_kmsg_for_tap: 0\n");
 				igt_subtest(test_name)
 					igt_success();
 				test_name[0] = '\0';
 			default:
+				fprintf(stderr, "[DEBUG] parse_kmsg_for_tap: default\n");
 				break;
 			}
 		}
 
+		fprintf(stderr, "[DEBUG] sublevel_after: %d\n", sublevel);
+
 		if (sublevel < 0)
 			ktap_args.is_running = false;
+
+		//DEBUG
+		if (elapsed(&last_kmsg, &current) > 0.5) {
+			results.still_running = false;
+			break;
+		}
+
+		if (++debug_counter > 1000) {
+			results.still_running = false;
+			break;
+		}
 	}
 
+	fprintf(stderr, "[DEBUG] outside main loop\n");
+
 	if (failed_tests || !found_tests)
 		ktap_args.ret = IGT_EXIT_FAILURE;
 	else
-- 
2.34.1



More information about the Intel-gfx-trybot mailing list