diff --git a/lib/igt_core.c b/lib/igt_core.c index 8b1c7b2f..425848a2 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -273,7 +273,7 @@ static enum { CONT = 0, SKIP, FAIL } skip_subtests_henceforth = CONT; -static char __current_description[4096]; +static char __current_description[512]; struct description_node { char desc[sizeof(__current_description)]; @@ -1010,30 +1010,30 @@ static void _clear_current_description(void) { __current_description[0] = '\0'; } -#define __INDENT " " -static void __igt_print_description(const char *subtest_name, const char *file, const int line) +static void __igt_print_description(const char *subtest_name, const char *file, int line) { struct description_node *desc; + const char indent[] = " "; bool has_doc = false; + printf("SUB %s %s:%d:\n", subtest_name, file, line); igt_list_for_each(desc, &subgroup_descriptions, link) { - print_line_wrapping(__INDENT, desc->desc); + print_line_wrapping(indent, desc->desc); printf("\n"); has_doc = true; } if (__current_description[0] != '\0') { - print_line_wrapping(__INDENT, __current_description); + print_line_wrapping(indent, __current_description); printf("\n"); has_doc = true; } if (!has_doc) - printf("%sNO DOCUMENTATION!\n\n", __INDENT); + printf("%sNO DOCUMENTATION!\n\n", indent); } -#undef __INDENT /* * Note: Testcases which use these helpers MUST NOT output anything to stdout diff --git a/lib/tests/igt_describe.c b/lib/tests/igt_describe.c index a9f857bb..a4457fa9 100644 --- a/lib/tests/igt_describe.c +++ b/lib/tests/igt_describe.c @@ -155,6 +155,14 @@ static void read_whole_pipe(int fd, char *buf, size_t buflen) offset = 0; while ((readlen = read(fd, buf+offset, buflen-offset))) { + if (readlen == -1) { + if (errno == EINTR) { + continue; + } else { + printf("read failed with %s\n", strerror(errno)); + exit(1); + } + } internal_assert(readlen != -1); offset += readlen; } @@ -172,8 +180,13 @@ static pid_t do_fork(int argc, char **argv, int *out, int *err) internal_assert(pid != -1); if (pid == 0) { - while ((dup2(outfd[1], STDOUT_FILENO) == -1) && (errno == EINTR)) {} - while ((dup2(errfd[1], STDERR_FILENO) == -1) && (errno == EINTR)) {} + while (dup2(outfd[1], STDOUT_FILENO) == -1 && errno == EINTR) {} + while (dup2(errfd[1], STDERR_FILENO) == -1 && errno == EINTR) {} + + close(outfd[0]); + close(outfd[1]); + close(errfd[0]); + close(errfd[1]); fake_main(argc, argv); @@ -218,6 +231,7 @@ int main(int argc, char **argv) assert_pipe_empty(errfd); internal_assert(_wait(pid, &status) != -1); + internal_assert(WIFEXITED(status)); internal_assert(WEXITSTATUS(status) == IGT_EXIT_SUCCESS); internal_assert(0 == strcmp(DESCRIBE_ALL_OUTPUT, out));