#include "testsuite.h"
+static const char *ANSI_HIGHLIGHT_GREEN_ON = "\x1B[1;32m";
+static const char *ANSI_HIGHLIGHT_RED_ON = "\x1B[1;31m";
+static const char *ANSI_HIGHLIGHT_OFF = "\x1B[0m";
+
static const char *progname;
static int oneshot = 0;
static const char options_short[] = "lhn";
}
}
+ if (isatty(STDOUT_FILENO) == 0) {
+ ANSI_HIGHLIGHT_OFF = "";
+ ANSI_HIGHLIGHT_RED_ON = "";
+ ANSI_HIGHLIGHT_GREEN_ON = "";
+ }
+
return optind;
}
if (err == 0) {
if (matchout)
- LOG("PASSED: %s\n", t->name);
+ LOG("%sPASSED%s: %s\n",
+ ANSI_HIGHLIGHT_GREEN_ON, ANSI_HIGHLIGHT_OFF,
+ t->name);
else {
- ERR("FAILED: exit ok but outputs do not match: %s\n",
- t->name);
+ ERR("%sFAILED%s: exit ok but outputs do not match: %s\n",
+ ANSI_HIGHLIGHT_RED_ON, ANSI_HIGHLIGHT_OFF,
+ t->name);
err = EXIT_FAILURE;
}
} else
- ERR("FAILED: %s\n", t->name);
+ ERR("%sFAILED%s: %s\n",
+ ANSI_HIGHLIGHT_RED_ON, ANSI_HIGHLIGHT_OFF,
+ t->name);
return err;
}