1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

shtests: -l: make sure radix point is '.'

Using the bin/shtests -l/--locale option to run the regression
tests in your own locale broke the tests if you're in a locale that
uses ',' as the radix point, like my nl_NL.UTF-8, unless
LC_NUMERIC=C was exported manually. Let's automate that fix.

src/cmd/ksh93/tests/shtests: --locale:
- If LC_ALL was set, copy it to LANG and unset all LC_* vars.
  This allows overriding the radix point with LC_NUMERIC if needed.
- If '1.0' is not a valid shell arithmetic expression, export
  LC_NUMERIC=C to fix it.
This commit is contained in:
Martijn Dekker 2020-08-11 08:58:40 +01:00
parent e01801572d
commit 34d145bb88

View file

@ -10,7 +10,7 @@ valgrindflags='--xml=yes --log-file=/dev/null --track-origins=yes --read-var-inf
USAGE=$' USAGE=$'
[-s8? [-s8?
@(#)$Id: shtests (AT&T Research/ksh93) 2020-07-04 $ @(#)$Id: shtests (AT&T Research/ksh93) 2020-08-11 $
] ]
'$USAGE_LICENSE$' '$USAGE_LICENSE$'
[+NAME?shtests - ksh regression test harness] [+NAME?shtests - ksh regression test harness]
@ -33,9 +33,9 @@ USAGE=$'
[d:debug?Enable \bshtests\b execution trace.] [d:debug?Enable \bshtests\b execution trace.]
[k:keep?Keep temporary files after test run; shtests will report the location.] [k:keep?Keep temporary files after test run; shtests will report the location.]
[l:locale?Disable \b--utf8\b and run the \b--posix\b and \b--compile\b [l:locale?Disable \b--utf8\b and run the \b--posix\b and \b--compile\b
tests, if enabled, in the locale of the caller. This may cause invalid tests, if enabled, in the locale of the caller. However, for locales
regressions, especially for locales where \b.\b is not the radix where \b.\b is not the radix point, \bLC_NUMERIC\b is set to \bC\b
point.] to avoid invalid regressions.]
[p:posix?Run the test scripts in the posix/C locale.] [p:posix?Run the test scripts in the posix/C locale.]
[t!:time?Include the current date/time in the test identification [t!:time?Include the current date/time in the test identification
messages.] messages.]
@ -234,6 +234,10 @@ if (( locale ))
then utf8=0 then utf8=0
if [[ $LC_ALL ]] if [[ $LC_ALL ]]
then export LANG=$LC_ALL then export LANG=$LC_ALL
unset ${!LC_*}
fi
if ! let 1.0 2>/dev/null
then export LC_NUMERIC=C
fi fi
else unset LANG LC_ALL else unset LANG LC_ALL
export LC_NUMERIC=C export LC_NUMERIC=C