mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-22 07:16:14 +00:00
lib: Enable locale dependent output to a terminal
If we are in an interactive session, enable the locale. This allows for features like setting thousand separators for printing large values. By only enabling it for interactive terminals, we avoid changing outputs for the test scripts (leaving them as the "C" locale). Note this mainly affects the testcases, or binaries built using libigt. Other binaries need to be localised separately. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Michel Thierry <michel.thierry@intel.com>
This commit is contained in:
parent
7eb5f07949
commit
453792c501
@ -55,6 +55,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
#include "drmtest.h"
|
#include "drmtest.h"
|
||||||
#include "intel_chipset.h"
|
#include "intel_chipset.h"
|
||||||
@ -522,6 +523,9 @@ static int common_init(int *argc, char **argv,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *env = getenv("IGT_LOG_LEVEL");
|
char *env = getenv("IGT_LOG_LEVEL");
|
||||||
|
|
||||||
|
if (isatty(STDOUT_FILENO))
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
if (env) {
|
if (env) {
|
||||||
if (strcmp(env, "debug") == 0)
|
if (strcmp(env, "debug") == 0)
|
||||||
igt_log_level = IGT_LOG_DEBUG;
|
igt_log_level = IGT_LOG_DEBUG;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user