Lines Matching refs:child
60 static void child_start(struct child_data *child, const char *program) in child_start() argument
70 child->pid = fork(); in child_start()
71 if (child->pid == -1) in child_start()
75 if (!child->pid) { in child_start()
128 child->stdout = pipefd[0]; in child_start()
129 child->output = NULL; in child_start()
130 child->exited = false; in child_start()
131 child->output_seen = false; in child_start()
134 ev.data.ptr = child; in child_start()
136 ret = epoll_ctl(epoll_fd, EPOLL_CTL_ADD, child->stdout, &ev); in child_start()
139 child->name, strerror(errno), errno); in child_start()
144 static bool child_output_read(struct child_data *child) in child_output_read() argument
150 ret = read(child->stdout, read_data, sizeof(read_data)); in child_output_read()
156 child->name, strerror(errno), in child_output_read()
162 child->output_seen = true; in child_output_read()
165 if (child->output) { in child_output_read()
166 strncpy(work, child->output, sizeof(work) - 1); in child_output_read()
168 free(child->output); in child_output_read()
169 child->output = NULL; in child_output_read()
180 ksft_print_msg("%s: %s\n", child->name, work); in child_output_read()
189 ret = asprintf(&child->output, "%s", work); in child_output_read()
197 static void child_output(struct child_data *child, uint32_t events, in child_output() argument
204 read_more = child_output_read(child); in child_output()
209 close(child->stdout); in child_output()
210 child->stdout = -1; in child_output()
214 if (flush && child->output) { in child_output()
215 ksft_print_msg("%s: %s<EOF>\n", child->name, child->output); in child_output()
216 free(child->output); in child_output()
217 child->output = NULL; in child_output()
221 static void child_tickle(struct child_data *child) in child_tickle() argument
223 if (child->output_seen && !child->exited) in child_tickle()
224 kill(child->pid, SIGUSR2); in child_tickle()
227 static void child_stop(struct child_data *child) in child_stop() argument
229 if (!child->exited) in child_stop()
230 kill(child->pid, SIGTERM); in child_stop()
233 static void child_cleanup(struct child_data *child) in child_cleanup() argument
239 if (!child->exited) { in child_cleanup()
241 ret = waitpid(child->pid, &status, 0); in child_cleanup()
247 child->pid, strerror(errno), in child_cleanup()
253 child->exit_status = WEXITSTATUS(status); in child_cleanup()
256 if (!child->output_seen) { in child_cleanup()
257 ksft_print_msg("%s no output seen\n", child->name); in child_cleanup()
261 if (child->exit_status != 0) { in child_cleanup()
263 child->name, child->exit_status); in child_cleanup()
267 ksft_test_result(!fail, "%s\n", child->name); in child_cleanup()
309 static void start_fpsimd(struct child_data *child, int cpu, int copy) in start_fpsimd() argument
313 ret = asprintf(&child->name, "FPSIMD-%d-%d", cpu, copy); in start_fpsimd()
317 child_start(child, "./fpsimd-test"); in start_fpsimd()
319 ksft_print_msg("Started %s\n", child->name); in start_fpsimd()
322 static void start_kernel(struct child_data *child, int cpu, int copy) in start_kernel() argument
326 ret = asprintf(&child->name, "KERNEL-%d-%d", cpu, copy); in start_kernel()
330 child_start(child, "./kernel-test"); in start_kernel()
332 ksft_print_msg("Started %s\n", child->name); in start_kernel()
335 static void start_sve(struct child_data *child, int vl, int cpu) in start_sve() argument
343 ret = asprintf(&child->name, "SVE-VL-%d-%d", vl, cpu); in start_sve()
347 child_start(child, "./sve-test"); in start_sve()
349 ksft_print_msg("Started %s\n", child->name); in start_sve()
352 static void start_ssve(struct child_data *child, int vl, int cpu) in start_ssve() argument
356 ret = asprintf(&child->name, "SSVE-VL-%d-%d", vl, cpu); in start_ssve()
364 child_start(child, "./ssve-test"); in start_ssve()
366 ksft_print_msg("Started %s\n", child->name); in start_ssve()
369 static void start_za(struct child_data *child, int vl, int cpu) in start_za() argument
377 ret = asprintf(&child->name, "ZA-VL-%d-%d", vl, cpu); in start_za()
381 child_start(child, "./za-test"); in start_za()
383 ksft_print_msg("Started %s\n", child->name); in start_za()
386 static void start_zt(struct child_data *child, int cpu) in start_zt() argument
390 ret = asprintf(&child->name, "ZT-%d", cpu); in start_zt()
394 child_start(child, "./zt-test"); in start_zt()
396 ksft_print_msg("Started %s\n", child->name); in start_zt()