summaryrefslogtreecommitdiff
path: root/lib/igt_core.c
diff options
context:
space:
mode:
authorThomas Wood <thomas.wood@intel.com>2015-10-29 17:01:17 +0000
committerThomas Wood <thomas.wood@intel.com>2015-11-11 14:52:47 +0000
commitfca7b1b5fd2d61dfec6a612f1a2798270d1f8a4e (patch)
treeabcccc774c5a4b21b8790f75801ca252a81b386f /lib/igt_core.c
parent3dce57a699e1481bbe7b2e4c52a7643654e2da19 (diff)
lib: highlight subtest results on terminals
Make subtest results easier to identify by making them bold when the output is a terminal. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r--lib/igt_core.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 4fc0bd1c..7e99b24f 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -779,9 +779,12 @@ bool __igt_run_subtest(const char *subtest_name)
}
if (skip_subtests_henceforth) {
- printf("Subtest %s: %s\n", subtest_name,
+ bool istty = isatty(STDOUT_FILENO);
+
+ printf("%sSubtest %s: %s%s\n",
+ (istty) ? "\x1b[1m" : "", subtest_name,
skip_subtests_henceforth == SKIP ?
- "SKIP" : "FAIL");
+ "SKIP" : "FAIL", (istty) ? "\x1b[0m" : "");
return false;
}
@@ -825,12 +828,14 @@ static void exit_subtest(const char *result)
{
struct timespec now;
double elapsed;
+ bool istty = isatty(STDOUT_FILENO);
gettime(&now);
elapsed = now.tv_sec - subtest_time.tv_sec;
elapsed += (now.tv_nsec - subtest_time.tv_nsec) * 1e-9;
- printf("Subtest %s: %s (%.3fs)\n", in_subtest, result, elapsed);
+ printf("%sSubtest %s: %s (%.3fs)%s\n", (istty) ? "\x1b[1m" : "",
+ in_subtest, result, elapsed, (istty) ? "\x1b[0m" : "");
fflush(stdout);
in_subtest = NULL;