Message ID | 1447774291-14532-17-git-send-email-acme@kernel.org |
---|---|
State | New |
Headers | show |
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 2277e0ba96a9..dd3159f53937 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -227,7 +227,22 @@ static int run_test(struct test *test, int subtest) } if (!child) { + int nullfd; + pr_debug("test child forked, pid %d\n", getpid()); + + if (!verbose) { + nullfd = open("/dev/null", O_WRONLY); + if (nullfd >= 0) { + close(STDERR_FILENO); + close(STDOUT_FILENO); + + dup2(nullfd, STDOUT_FILENO); + dup2(STDOUT_FILENO, STDERR_FILENO); + close(nullfd); + } + } + if (!test->need_subtests) err = test->func(); else