From: Daniel Vetter Subject: [PATCH 3/5] tests: dont polute stderr if the test succeeds/skips Date: Tue, 27 Nov 2012 21:13:51 +0100 Message-ID: <1354047233-23264-4-git-send-email-daniel.vetter@ffwll.ch> References: <1354047233-23264-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 581ABE6013 for ; Tue, 27 Nov 2012 12:25:12 -0800 (PST) Received: by mail-ee0-f49.google.com with SMTP id c4so5438260eek.36 for ; Tue, 27 Nov 2012 12:25:11 -0800 (PST) In-Reply-To: <1354047233-23264-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Intel Graphics Development Cc: Daniel Vetter List-Id: intel-gfx@lists.freedesktop.org Results in spurious 'warn' results in piglit. Also don't print progress indicators when not outputting to a terminal. Signed-off-by: Daniel Vetter --- lib/drmtest.c | 3 +++ tests/gem_cpu_reloc.c | 2 +- tests/gem_cs_prefetch.c | 2 +- tests/gem_ctx_create.c | 2 +- tests/sysfs_rps.c | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index c309851..a18b3a0 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -543,6 +543,9 @@ void drmtest_progress(const char *header, uint64_t i, uint64_t total) { int divider = 200; + if (!isatty(fileno(stderr))) + return; + if (i+1 >= total) { fprintf(stderr, "\r%s100%%\n", header); return; diff --git a/tests/gem_cpu_reloc.c b/tests/gem_cpu_reloc.c index 787e507..baf8301 100644 --- a/tests/gem_cpu_reloc.c +++ b/tests/gem_cpu_reloc.c @@ -209,7 +209,7 @@ int main(int argc, char **argv) drmtest_progress("gem_cpu_reloc: ", 2*count+i, 3*count); } - fprintf(stderr, "Test suceeded, cleanup up - this might take a while.\n"); + printf("Test suceeded, cleanup up - this might take a while.\n"); close(fd); return 0; diff --git a/tests/gem_cs_prefetch.c b/tests/gem_cs_prefetch.c index 9ba8028..9ef35eb 100644 --- a/tests/gem_cs_prefetch.c +++ b/tests/gem_cs_prefetch.c @@ -163,7 +163,7 @@ int main(int argc, char **argv) drmtest_progress("gem_cs_prefetch: ", i, count); } - fprintf(stderr, "Test suceeded, cleanup up - this might take a while.\n"); + printf("Test suceeded, cleanup up - this might take a while.\n"); drm_intel_bufmgr_destroy(bufmgr); close(fd); diff --git a/tests/gem_ctx_create.c b/tests/gem_ctx_create.c index def76d3..84ef214 100644 --- a/tests/gem_ctx_create.c +++ b/tests/gem_ctx_create.c @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) ret = drmIoctl(fd, CONTEXT_CREATE_IOCTL, &create); if (ret != 0 && (errno == ENODEV || errno == EINVAL)) { - fprintf(stderr, "Kernel is too old, or contexts not supported: %s\n", + printf("Kernel is too old, or contexts not supported: %s\n", strerror(errno)); exit(77); } else if (ret != 0) { diff --git a/tests/sysfs_rps.c b/tests/sysfs_rps.c index 94c4382..8ba541c 100644 --- a/tests/sysfs_rps.c +++ b/tests/sysfs_rps.c @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) assert(ret != -1); junk->filp = fopen(path, junk->mode); if (junk->filp == NULL) { - fprintf(stderr, "Kernel is too old. GTFO\n"); + printf("Kernel is too old. GTFO\n"); exit(77); } val = readval(junk->filp); -- 1.7.11.7