diff mbox series

[v2] tst_test.sh: Normalize the locale concerned variables

Message ID 20221020120924.212843-1-akihiko.odaki@daynix.com
State Superseded
Headers show
Series [v2] tst_test.sh: Normalize the locale concerned variables | expand

Commit Message

Akihiko Odaki Oct. 20, 2022, 12:09 p.m. UTC
network/tcp_cmds/tracepath/tracepath01.sh fails with LANG=ja_JP.UTF-8
because it parses localized output. The below is an example of such
output:
$ tracepath localhost
 1?: [LOCALHOST]                        0.040ミリ秒 pmtu 65536
 1:  localhost                                             0.274ミリ秒 到達しました
 1:  localhost                                             0.261ミリ秒 到達しました
     要約: pmtu 65536 ホップ数 1 戻りホップ数 1

To avoid such a problem, we can always normalize the locale concerned
variables. network/stress/ns-tools/check_envval does that, but it is
limited to the network stress test. Add code to normalize the locale
to tst_test.sh so that it can cover more tests.

Note that the added code is based on the kernel implementation [1]
rather than the network stress test to avoid requiring locale
installed.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 testcases/lib/tst_test.sh | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 28b7d12ba..1681eaa1f 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -831,3 +831,7 @@  if [ -z "$TST_NO_DEFAULT_RUN" ]; then
 		fi
 	fi
 fi
+
+unset LC_ALL
+export LC_COLLATE=C
+export LC_NUMERIC=C