* [igt] Enable locale dependent output to a terminal
@ 2015-06-24 10:29 Chris Wilson
2015-06-24 12:23 ` Michel Thierry
0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2015-06-24 10:29 UTC (permalink / raw)
To: intel-gfx
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).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
lib/igt_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 1367863..8ac1f33 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -55,6 +55,7 @@
#include <time.h>
#include <ctype.h>
#include <limits.h>
+#include <locale.h>
#include "drmtest.h"
#include "intel_chipset.h"
@@ -523,6 +524,9 @@ static int common_init(int *argc, char **argv,
int ret = 0;
char *env = getenv("IGT_LOG_LEVEL");
+ if (isatty(STDOUT_FILENO))
+ setlocale(LC_ALL, "");
+
if (env) {
if (strcmp(env, "debug") == 0)
igt_log_level = IGT_LOG_DEBUG;
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [igt] Enable locale dependent output to a terminal
2015-06-24 10:29 [igt] Enable locale dependent output to a terminal Chris Wilson
@ 2015-06-24 12:23 ` Michel Thierry
2015-06-24 16:04 ` Chris Wilson
0 siblings, 1 reply; 3+ messages in thread
From: Michel Thierry @ 2015-06-24 12:23 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On 6/24/2015 11:29 AM, Chris Wilson wrote:
> 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).
Thanks, I'll follow up with a patch replacing existing %llu with %'llu.
Reviewed-by: Michel Thierry <michel.thierry@intel.com>
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> lib/igt_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 1367863..8ac1f33 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -55,6 +55,7 @@
> #include <time.h>
> #include <ctype.h>
> #include <limits.h>
> +#include <locale.h>
>
> #include "drmtest.h"
> #include "intel_chipset.h"
> @@ -523,6 +524,9 @@ static int common_init(int *argc, char **argv,
> int ret = 0;
> char *env = getenv("IGT_LOG_LEVEL");
>
> + if (isatty(STDOUT_FILENO))
> + setlocale(LC_ALL, "");
> +
> if (env) {
> if (strcmp(env, "debug") == 0)
> igt_log_level = IGT_LOG_DEBUG;
> --
> 2.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [igt] Enable locale dependent output to a terminal
2015-06-24 12:23 ` Michel Thierry
@ 2015-06-24 16:04 ` Chris Wilson
0 siblings, 0 replies; 3+ messages in thread
From: Chris Wilson @ 2015-06-24 16:04 UTC (permalink / raw)
To: Michel Thierry; +Cc: intel-gfx
On Wed, Jun 24, 2015 at 01:23:42PM +0100, Michel Thierry wrote:
> On 6/24/2015 11:29 AM, Chris Wilson wrote:
> >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).
>
> Thanks, I'll follow up with a patch replacing existing %llu with %'llu.
>
> Reviewed-by: Michel Thierry <michel.thierry@intel.com>
Thanks for the review, no one panicked so I pushed...
To ssh://git.freedesktop.org/git/xorg/app/intel-gpu-tools
7eb5f07..44d444a 44d444acaa8cfd61ea25c82fb7c3bff5f41f0835 -> master
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-24 16:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 10:29 [igt] Enable locale dependent output to a terminal Chris Wilson
2015-06-24 12:23 ` Michel Thierry
2015-06-24 16:04 ` Chris Wilson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.