[PATCH i-g-t 04/24] Actually handle socketfd, and correctly sprintf the env
Petri Latvala
petri.latvala at intel.com
Thu Mar 4 09:06:00 UTC 2021
---
runner/executor.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/runner/executor.c b/runner/executor.c
index a2f29d32..2f6eaf1d 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -478,8 +478,8 @@ bool open_output_files(int dirfd, int *fds, bool write)
for (i = 0; i < _F_LAST; i++) {
if ((fds[i] = openfunc(dirfd, filenames[i])) < 0) {
- /* Ignore failure to open socket comms */
- if (i == _F_SOCKET) continue;
+ /* Ignore failure to open socket comms for reading */
+ if (i == _F_SOCKET && !write) continue;
while (--i >= 0)
close(fds[i]);
@@ -842,6 +842,8 @@ static int monitor_output(pid_t child,
FD_SET(outfd, &set);
if (errfd >= 0)
FD_SET(errfd, &set);
+ if (socketfd >= 0)
+ FD_SET(socketfd, &set);
if (kmsgfd >= 0)
FD_SET(kmsgfd, &set);
if (sigfd >= 0)
@@ -1496,7 +1498,7 @@ static int execute_next_entry(struct execute_state *state,
result = -1;
goto out_kmsgfd;
} else if (child == 0) {
- char *envstring = NULL;
+ char envstring[16];
outfd = outpipe[1];
errfd = errpipe[1];
@@ -1507,8 +1509,10 @@ static int execute_next_entry(struct execute_state *state,
sigprocmask(SIG_UNBLOCK, sigmask, NULL);
- if (socketfd >= 0 && asprintf(&envstring, "%d", socketfd) == 1)
+ if (socketfd >= 0) {
+ snprintf(envstring, sizeof(envstring), "%d", socketfd);
setenv("IGT_RUNNER_SOCKET_FD", envstring, 1);
+ }
setenv("IGT_SENTINEL_ON_STDERR", "1", 1);
execute_test_process(outfd, errfd, socketfd, settings, entry);
--
2.29.2
More information about the Intel-gfx-trybot
mailing list