Lines Matching refs:child
58 static void child_start(struct child_data *child, const char *program) in child_start() argument
68 child->pid = fork(); in child_start()
69 if (child->pid == -1) in child_start()
73 if (!child->pid) { in child_start()
102 child->stdout = pipefd[0]; in child_start()
103 child->output = NULL; in child_start()
104 child->exited = false; in child_start()
105 child->output_seen = false; in child_start()
108 ev.data.ptr = child; in child_start()
110 ret = epoll_ctl(epoll_fd, EPOLL_CTL_ADD, child->stdout, &ev); in child_start()
113 child->name, strerror(errno), errno); in child_start()
124 static bool child_output_read(struct child_data *child) in child_output_read() argument
130 ret = read(child->stdout, read_data, sizeof(read_data)); in child_output_read()
136 child->name, strerror(errno), in child_output_read()
142 child->output_seen = true; in child_output_read()
145 if (child->output) { in child_output_read()
146 strncpy(work, child->output, sizeof(work) - 1); in child_output_read()
148 free(child->output); in child_output_read()
149 child->output = NULL; in child_output_read()
160 ksft_print_msg("%s: %s\n", child->name, work); in child_output_read()
169 ret = asprintf(&child->output, "%s", work); in child_output_read()
177 static void child_output(struct child_data *child, uint32_t events, in child_output() argument
184 read_more = child_output_read(child); in child_output()
189 close(child->stdout); in child_output()
190 child->stdout = -1; in child_output()
194 if (flush && child->output) { in child_output()
195 ksft_print_msg("%s: %s<EOF>\n", child->name, child->output); in child_output()
196 free(child->output); in child_output()
197 child->output = NULL; in child_output()
201 static void child_tickle(struct child_data *child) in child_tickle() argument
203 if (child->output_seen && !child->exited) in child_tickle()
204 kill(child->pid, SIGUSR2); in child_tickle()
207 static void child_stop(struct child_data *child) in child_stop() argument
209 if (!child->exited) in child_stop()
210 kill(child->pid, SIGTERM); in child_stop()
213 static void child_cleanup(struct child_data *child) in child_cleanup() argument
219 if (!child->exited) { in child_cleanup()
221 ret = waitpid(child->pid, &status, 0); in child_cleanup()
227 child->pid, strerror(errno), in child_cleanup()
233 child->exit_status = WEXITSTATUS(status); in child_cleanup()
236 if (!child->output_seen) { in child_cleanup()
237 ksft_print_msg("%s no output seen\n", child->name); in child_cleanup()
241 if (child->exit_status != 0) { in child_cleanup()
243 child->name, child->exit_status); in child_cleanup()
247 ksft_test_result(!fail, "%s\n", child->name); in child_cleanup()
289 static void start_fpsimd(struct child_data *child, int cpu, int copy) in start_fpsimd() argument
293 child_start(child, "./fpsimd-test"); in start_fpsimd()
295 ret = asprintf(&child->name, "FPSIMD-%d-%d", cpu, copy); in start_fpsimd()
299 ksft_print_msg("Started %s\n", child->name); in start_fpsimd()
302 static void start_sve(struct child_data *child, int vl, int cpu) in start_sve() argument
310 child_start(child, "./sve-test"); in start_sve()
312 ret = asprintf(&child->name, "SVE-VL-%d-%d", vl, cpu); in start_sve()
316 ksft_print_msg("Started %s\n", child->name); in start_sve()
319 static void start_ssve(struct child_data *child, int vl, int cpu) in start_ssve() argument
327 child_start(child, "./ssve-test"); in start_ssve()
329 ret = asprintf(&child->name, "SSVE-VL-%d-%d", vl, cpu); in start_ssve()
333 ksft_print_msg("Started %s\n", child->name); in start_ssve()
336 static void start_za(struct child_data *child, int vl, int cpu) in start_za() argument
344 child_start(child, "./za-test"); in start_za()
346 ret = asprintf(&child->name, "ZA-VL-%d-%d", vl, cpu); in start_za()
350 ksft_print_msg("Started %s\n", child->name); in start_za()