tests: dont polute stderr if the test succeeds/skips

Results in spurious 'warn' results in piglit. Also don't print
progress indicators when not outputting to a terminal.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Daniel Vetter 2012-11-27 20:04:15 +01:00
parent 4fae0c65c5
commit 021909e10d
5 changed files with 7 additions and 4 deletions

View File

@ -543,6 +543,9 @@ void drmtest_progress(const char *header, uint64_t i, uint64_t total)
{ {
int divider = 200; int divider = 200;
if (!isatty(fileno(stderr)))
return;
if (i+1 >= total) { if (i+1 >= total) {
fprintf(stderr, "\r%s100%%\n", header); fprintf(stderr, "\r%s100%%\n", header);
return; return;

View File

@ -209,7 +209,7 @@ int main(int argc, char **argv)
drmtest_progress("gem_cpu_reloc: ", 2*count+i, 3*count); 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); close(fd);
return 0; return 0;

View File

@ -163,7 +163,7 @@ int main(int argc, char **argv)
drmtest_progress("gem_cs_prefetch: ", i, count); 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); drm_intel_bufmgr_destroy(bufmgr);
close(fd); close(fd);

View File

@ -49,7 +49,7 @@ int main(int argc, char *argv[])
ret = drmIoctl(fd, CONTEXT_CREATE_IOCTL, &create); ret = drmIoctl(fd, CONTEXT_CREATE_IOCTL, &create);
if (ret != 0 && (errno == ENODEV || errno == EINVAL)) { 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)); strerror(errno));
exit(77); exit(77);
} else if (ret != 0) { } else if (ret != 0) {

View File

@ -147,7 +147,7 @@ int main(int argc, char *argv[])
assert(ret != -1); assert(ret != -1);
junk->filp = fopen(path, junk->mode); junk->filp = fopen(path, junk->mode);
if (junk->filp == NULL) { if (junk->filp == NULL) {
fprintf(stderr, "Kernel is too old. GTFO\n"); printf("Kernel is too old. GTFO\n");
exit(77); exit(77);
} }
val = readval(junk->filp); val = readval(junk->filp);