test/meson.build: use the default POSIX locale for unit tests
[email protected]
maintainerPATCH 1/1 test/meson.build: use the default POSIX locale for unit tests
From: Alison Schofield <[email protected]>
A user reported that unit test inject-smart.sh fails with locale set to LANG=cs.CZ-UTF-8.[1] That locale uses commas as separators whereas the unit test expects periods.
Set LC_ALL=C in the meson.build test environment to fix this and to make sure the bash scripts can rely on predictable output when parsing in general.
This failing test case now passes:
LANG=cs.CZ.UTF-8 meson test -C build inject-smart.sh
Tidy up by moving the test_env definition out of the for loop.
[1] https://github.com/pmem/ndctl/issues/254
--- test/meson.build | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
test/meson.build +10 -7
@@ -235,6 +235,15 @@ if get_option('keyutils').enabled() ] endif +test_env = [ + 'LC_ALL=C', + 'NDCTL=@0@'.format(ndctl_tool.full_path()), + 'DAXCTL=@0@'.format(daxctl_tool.full_path()), + 'CXL=@0@'.format(cxl_tool.full_path()), + 'TEST_PATH=@0@'.format(meson.current_build_dir()), + 'DATA_PATH=@0@'.format(meson.current_source_dir()), +] + foreach t : tests test(t[0], t[1], is_parallel : false,
@@ -252,12 +261,6 @@ foreach t : tests ], suite: t[2], timeout : 600, - env : [ - 'NDCTL=@0@'.format(ndctl_tool.full_path()), - 'DAXCTL=@0@'.format(daxctl_tool.full_path()), - 'CXL=@0@'.format(cxl_tool.full_path()), - 'TEST_PATH=@0@'.format(meson.current_build_dir()), - 'DATA_PATH=@0@'.format(meson.current_source_dir()), - ], + env : test_env, ) endforeach
Signature · 1 line
2.37.3
Quoted 10 lines · On 2025-05-14 11:57, [email protected] wrote:
From: Alison Schofield <[email protected]>
A user reported that unit test
inject-smart.shfails with locale set to LANG=cs.CZ-UTF-8.[1] That locale uses commas as separators whereas the unit test expects periods.Set LC_ALL=C in the meson.build test environment to fix this and to make sure the bash scripts can rely on predictable output when parsing in general.
Quoted 8 lines
This failing test case now passes:
LANG=cs.CZ.UTF-8 meson test -C buildinject-smart.shTidy up by moving the
test_envdefinition out of the for loop.[1] https://github.com/pmem/ndctl/issues/254
Signed-off-by Alison Schofield <[email protected]>
Quoted 4 lines · On Wed, May 14, 2025 at 11:57:05AM -0700, [email protected] wrote:
From: Alison Schofield <[email protected]>
A user reported that unit test
inject-smart.shfails with locale set to LANG=cs.CZ-UTF-8.[1] That locale uses commas as separators
'set to cs_CZ-UTF-8 ...'
Quoted 8 lines
whereas the unit test expects periods.
Set LC_ALL=C in the meson.build test environment to fix this and to make sure the bash scripts can rely on predictable output when parsing in general.
This failing test case now passes:
LANG=cs.CZ.UTF-8 meson test -C buildinject-smart.sh
s/LANG/LC_ALL
LC_ALL=cs_CZ.UTF-8 meson test -C build inject-smart.sh
need that 'ALL' to override all locale categories.
Quoted 6 lines
Tidy up by moving the
test_envdefinition out of the for loop.[1] https://github.com/pmem/ndctl/issues/254
Signed-off-by Alison Schofield <[email protected]>
Fixed up above test while testing on pending.
Applied to pending branch:
https://github.com/pmem/ndctl/tree/pending
Quoted 41 lines
--- test/meson.build | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)test/meson.build +10
-7@@ -235,6 +235,15 @@ if get_option('keyutils').enabled() ] endif +test_env = [ + 'LC_ALL=C', + 'NDCTL=@0@'.format(ndctl_tool.full_path()), + 'DAXCTL=@0@'.format(daxctl_tool.full_path()), + 'CXL=@0@'.format(cxl_tool.full_path()), + 'TEST_PATH=@0@'.format(meson.current_build_dir()), + 'DATA_PATH=@0@'.format(meson.current_source_dir()), +] + foreach t : tests test(t[0], t[1], is_parallel : false,@@ -252,12 +261,6 @@ foreach t : tests ], suite: t[2], timeout : 600, - env : [ - 'NDCTL=@0@'.format(ndctl_tool.full_path()), - 'DAXCTL=@0@'.format(daxctl_tool.full_path()), - 'CXL=@0@'.format(cxl_tool.full_path()), - 'TEST_PATH=@0@'.format(meson.current_build_dir()), - 'DATA_PATH=@0@'.format(meson.current_source_dir()), - ], + env : test_env, ) endforeachSignature · 1 line
2.37.3