Skip to contentSkip to conversation

set English environment

KVM_AUTOTEST Lukáš Doktor 3 participants 4 messages Jul 9, 2009 – Jul 21, 2009 KVM

lore
Share & tools
lore
#0 lore raw

Set English environment before test executions.
This is critical because we are parsing outputs of commands, which are localized!

Tested by: [email protected] on RHEL5.4 with kvm-83-72.el5

client/tests/kvm/control +2 -0
@@ -45,6 +45,8 @@ Each test is appropriately documented on
 
 import sys, os
 
+# set English environment
+os.environ['LANG'] = 'en_US.UTF-8'
 # enable modules import from current directory (tests/kvm)
 pwd = os.path.join(os.environ['AUTODIR'],'tests/kvm')
 sys.path.append(pwd)
#1 lore raw

2009/7/9 Lukáš Doktor <[email protected]>:

Quoted 5 lines

Set English environment before test executions.
This is critical because we are parsing outputs of commands, which are localized!

Tested by: [email protected] on RHEL5.4 with kvm-83-72.el5

Ok, fair enough to have this extra security. Thanks, applied.

#2 lore raw
In reply to Lukáš Doktor

client/tests/kvm/control Each test is appropriately documented on · line 52

Quoted 11 lines · Lukáš Doktor

--- orig/client/tests/kvm/control 2009-07-08 13:18:07.000000000 +0200
+++ new/client/tests/kvm/control 2009-07-09 12:32:32.000000000 +0200

client/tests/kvm/control +2 -0
@@ -45,6 +45,8 @@ Each test is appropriately documented on
 
 import sys, os
 
+# set English environment
+os.environ['LANG'] = 'en_US.UTF-8'
 # enable modules import from current directory (tests/kvm)
 pwd = os.path.join(os.environ['AUTODIR'],'tests/kvm')
 sys.path.append(pwd)

LANG can still be overridden with LC_ALL. For a well-defined environment, best set LC_ALL='C'. This will also set other i18n settings and works on systems that don't come with UTF-8 enabled.

	Arnd <><
#3 lore raw

Dne 21.7.2009 02:09, Arnd Bergmann napsal(a):

Quoted 17 lines · Lukáš Doktor

Review Each test is appropriately documented on · line 52

Quoted 11 lines
   --- orig/client/tests/kvm/control       2009-07-08 13:18:07.000000000 +0200

+++ new/client/tests/kvm/control 2009-07-09 12:32:32.000000000 +0200

(quoted diff) +2 -0
@@ -45,6 +45,8 @@ Each test is appropriately documented on
 
  import sys, os
 
+# set English environment
+os.environ['LANG'] = 'en_US.UTF-8'
  # enable modules import from current directory (tests/kvm)
  pwd = os.path.join(os.environ['AUTODIR'],'tests/kvm')
  sys.path.append(pwd)

LANG can still be overridden with LC_ALL. For a well-defined environment, best set LC_ALL='C'. This will also set other i18n settings and works on systems that don't come with UTF-8 enabled.

Quoted 1 line
	Arnd<><

Yes, you are right. LC_ALL='C' is more clean way to do.

Attached the fixed patch.

client/tests/kvm/control +2 -0
@@ -45,6 +45,8 @@ Each test is appropriately documented on
 
 import sys, os
 
+# set English environment
+os.environ['LC_ALL'] = 'C'
 # enable modules import from current directory (tests/kvm)
 pwd = os.path.join(os.environ['AUTODIR'],'tests/kvm')
 sys.path.append(pwd)