public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/6] runner: Use a bigger buffer for receiving test outputs
@ 2022-11-07 12:01 Petri Latvala
  2022-11-07 12:01 ` [igt-dev] [PATCH i-g-t 2/6] igt_core: Split too long log lines when sending to runner with comms Petri Latvala
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Petri Latvala @ 2022-11-07 12:01 UTC (permalink / raw)
  To: igt-dev; +Cc: Petri Latvala

Stream-based receiving was able to use buffers of any size for read(),
but with datagrams we actually need to prepare for actual sizes. In
practice, some file dumps from tests come as single log packets of a
couple of kB.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
Cc: Arkadiusz Hiler <arek@hiler.eu>
Cc: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 runner/executor.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/runner/executor.c b/runner/executor.c
index a79a34e0..1fcc9afe 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -857,7 +857,8 @@ static int monitor_output(pid_t child,
 			  char **abortreason)
 {
 	fd_set set;
-	char buf[2048];
+	char *buf;
+	size_t bufsize;
 	char *outbuf = NULL;
 	size_t outbufsize = 0;
 	char current_subtest[256] = {};
@@ -910,6 +911,9 @@ static int monitor_output(pid_t child,
 		}
 	}
 
+	bufsize = 262144; /* 256 kiB */
+	buf = malloc(bufsize);
+
 	while (outfd >= 0 || errfd >= 0 || sigfd >= 0) {
 		const char *timeout_reason;
 		struct timeval tv = { .tv_sec = interval_length };
@@ -942,7 +946,7 @@ static int monitor_output(pid_t child,
 
 			time_last_activity = time_now;
 
-			s = read(outfd, buf, sizeof(buf));
+			s = read(outfd, buf, bufsize);
 			if (s <= 0) {
 				if (s < 0) {
 					errf("Error reading test's stdout: %m\n");
@@ -1037,7 +1041,7 @@ static int monitor_output(pid_t child,
 		if (errfd >= 0 && FD_ISSET(errfd, &set)) {
 			time_last_activity = time_now;
 
-			s = read(errfd, buf, sizeof(buf));
+			s = read(errfd, buf, bufsize);
 			if (s <= 0) {
 				if (s < 0) {
 					errf("Error reading test's stderr: %m\n");
@@ -1060,7 +1064,7 @@ static int monitor_output(pid_t child,
 
 			/* Fully drain everything */
 			while (true) {
-				s = recv(socketfd, buf, sizeof(buf), MSG_DONTWAIT);
+				s = recv(socketfd, buf, bufsize, MSG_DONTWAIT);
 
 				if (s < 0) {
 					if (errno == EAGAIN)
@@ -1394,6 +1398,7 @@ static int monitor_output(pid_t child,
 					fdatasync(outputs[_F_DMESG]);
 
 				close_watchdogs(settings);
+				free(buf);
 				free(outbuf);
 				close(outfd);
 				close(errfd);
@@ -1418,6 +1423,7 @@ static int monitor_output(pid_t child,
 	if (settings->sync)
 		fdatasync(outputs[_F_DMESG]);
 
+	free(buf);
 	free(outbuf);
 	close(outfd);
 	close(errfd);
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-11-08  9:39 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-07 12:01 [igt-dev] [PATCH i-g-t 1/6] runner: Use a bigger buffer for receiving test outputs Petri Latvala
2022-11-07 12:01 ` [igt-dev] [PATCH i-g-t 2/6] igt_core: Split too long log lines when sending to runner with comms Petri Latvala
2022-11-07 14:16   ` Kamil Konieczny
2022-11-07 15:14     ` Petri Latvala
2022-11-07 16:40       ` Kamil Konieczny
2022-11-07 16:45         ` Petri Latvala
2022-11-07 12:01 ` [igt-dev] [PATCH i-g-t 3/6] runner: Continue using socket comms when getting an invalid packet Petri Latvala
2022-11-07 16:16   ` Kamil Konieczny
2022-11-07 12:01 ` [igt-dev] [PATCH i-g-t 4/6] igt_core: Make sure test result gets to runner when test has no subtests Petri Latvala
2022-11-07 13:57   ` Kamil Konieczny
2022-11-07 12:01 ` [igt-dev] [PATCH i-g-t 5/6] lib/runnercomms: Report empty comms dump as empty Petri Latvala
2022-11-07 13:59   ` Kamil Konieczny
2022-11-07 12:01 ` [igt-dev] [PATCH i-g-t 6/6] Revert "runner: Disable socket communications for now" Petri Latvala
2022-11-07 14:00   ` Kamil Konieczny
2022-11-07 13:40 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/6] runner: Use a bigger buffer for receiving test outputs Patchwork
2022-11-07 16:45 ` [igt-dev] [PATCH i-g-t 1/6] " Kamil Konieczny
2022-11-08  9:39   ` Petri Latvala

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox