torture: Correctly fetch CPUs for kvm-build.sh with all native language
Subsystems (2)
PATCH 1/1 torture: Correctly fetch CPUs for kvm-build.sh with all native language
Grepping for "CPU" on lscpu output isn't always successful, depending on the local language setting. As a result, the build can be aborted early with:
"make: the '-j' option requires a positive integer argument"
Prefer a more generic solution.
--- tools/testing/selftests/rcutorture/bin/kvm-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/kvm-build.sh +1 -1
@@ -42,7 +42,7 @@ then fi # Tell "make" to use double the number of real CPUs on the build system. -ncpus="`lscpu | grep '^CPU(' | awk '{ print $2 }'`" +ncpus="`getconf _NPROCESSORS_ONLN`" make -j$((2 * ncpus)) $TORTURE_KMAKE_ARG > $resdir/Make.out 2>&1 retval=$? if test $retval -ne 0 || grep "rcu[^/]*": < $resdir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $resdir/Make.out
Signature · 1 line
2.25.1
Paul E. McKenney
maintainerQuoted 9 lines · Frederic Weisbecker
Grepping for "CPU" on lscpu output isn't always successful, depending on the local language setting. As a result, the build can be aborted early with:
"make: the '-j' option requires a positive integer argument"
Prefer a more generic solution.
Signed-off-by Frederic Weisbecker <[email protected]>
Good catch, applied, thank you!
There is a similar construct in kvm-remote.sh, so I added a similar fix to your patch.
But what about this in functions.sh?
nt="lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'"
I am guessing that "node0" is human-language-independent, but is "NUMA"?
Thanx, Paul
------------------------------------------------------------------------
commit cf519a9b736cf7dcd47920065e4de8c1855b5532
Author: Frederic Weisbecker <[email protected]> Date: Thu Apr 1 15:26:02 2021 +0200
torture: Correctly fetch number of CPUs for non-English languages
Grepping for "CPU" on lscpu output isn't always successful, depending on the local language setting. As a result, the build can be aborted early with:
"make: the '-j' option requires a positive integer argument"
This commit therefore uses the human-language-independent approach available via the getconf command, both in kvm-build.sh and in kvm-remote.sh.
tools/testing/selftests/rcutorture/bin/kvm-build.sh +1 -1
@@ -42,7 +42,7 @@ then fi # Tell "make" to use double the number of real CPUs on the build system. -ncpus="`lscpu | grep '^CPU(' | awk '{ print $2 }'`" +ncpus="`getconf _NPROCESSORS_ONLN`" make -j$((2 * ncpus)) $TORTURE_KMAKE_ARG > $resdir/Make.out 2>&1 retval=$? if test $retval -ne 0 || grep "rcu[^/]*": < $resdir/Make.out | egrep -q "Stop|Error|error:|warning:" || egrep -q "Stop|Error|error:" < $resdir/Make.out
tools/testing/selftests/rcutorture/bin/kvm-remote.sh +1 -1
@@ -136,7 +136,7 @@ chmod +x $T/bin/kvm-remote-*.sh # Check first to avoid the need for cleanup for system-name typos for i in $systems do - ncpus="`ssh $i lscpu | grep '^CPU(' | awk '{ print $2 }'`" + ncpus="`ssh $i getconf _NPROCESSORS_ONLN 2> /dev/null`" echo $i: $ncpus CPUs " " `date` | tee -a "$oldrun/remote-log" ret=$? if test "$ret" -ne 0
Quoted 13 lines · Paul E. McKenney
Quoted 9 lines · Frederic Weisbecker
Grepping for "CPU" on lscpu output isn't always successful, depending on the local language setting. As a result, the build can be aborted early with:
"make: the '-j' option requires a positive integer argument"
Prefer a more generic solution.
Signed-off-by Frederic Weisbecker <[email protected]>Good catch, applied, thank you!
Quoted 8 lines
There is a similar construct in
kvm-remote.sh, so I added a similar fix to your patch.But what about this in
functions.sh?nt="
lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'"I am guessing that "node0" is human-language-independent, but is "NUMA"?
I thought they wouldn't bother translating that, but they did...
NUMA node0 CPU(s): 0-7
becomes:
Nœud NUMA 0 de processeur(s) : 0-7
Not sure about the best way to fix it.
Thanks.
Paul E. McKenney
maintainerQuoted 25 lines · Frederic Weisbecker
Quoted 13 lines · Paul E. McKenney
Quoted 9 lines · Frederic Weisbecker
Grepping for "CPU" on lscpu output isn't always successful, depending on the local language setting. As a result, the build can be aborted early with:
"make: the '-j' option requires a positive integer argument"
Prefer a more generic solution.
Signed-off-by Frederic Weisbecker <[email protected]>Good catch, applied, thank you!
Quoted 8 lines
There is a similar construct in
kvm-remote.sh, so I added a similar fix to your patch.But what about this in
functions.sh?nt="
lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'"I am guessing that "node0" is human-language-independent, but is "NUMA"?
I thought they wouldn't bother translating that, but they did...
Quoted 7 lines
NUMA node0 CPU(s): 0-7
becomes:
Nœud NUMA 0 de processeur(s) : 0-7
Not sure about the best way to fix it.
The rude and crude fix is for the scripts to force the local language to English. ;-)
Thanx, Paul
Quoted 28 lines · Paul E. McKenney
Quoted 27 lines · Frederic Weisbecker
Quoted 13 lines · Paul E. McKenney
Quoted 9 lines · Frederic Weisbecker
Grepping for "CPU" on lscpu output isn't always successful, depending on the local language setting. As a result, the build can be aborted early with:
"make: the '-j' option requires a positive integer argument"
Prefer a more generic solution.
Signed-off-by Frederic Weisbecker <[email protected]>Good catch, applied, thank you!
Quoted 8 lines
There is a similar construct in
kvm-remote.sh, so I added a similar fix to your patch.But what about this in
functions.sh?nt="
lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'"I am guessing that "node0" is human-language-independent, but is "NUMA"?
I thought they wouldn't bother translating that, but they did...
NUMA node0 CPU(s): 0-7
Quoted 8 lines
Quoted 5 lines
becomes:
Nœud NUMA 0 de processeur(s) : 0-7
Not sure about the best way to fix it.
The rude and crude fix is for the scripts to force the local language to English. ;-)
I don't have a better answer :o)
Paul E. McKenney
maintainerQuoted 31 lines · Frederic Weisbecker
Quoted 30 lines · Paul E. McKenney
Quoted 29 lines · Frederic Weisbecker
Quoted 13 lines · Paul E. McKenney
Quoted 9 lines · Frederic Weisbecker
Grepping for "CPU" on lscpu output isn't always successful, depending on the local language setting. As a result, the build can be aborted early with:
"make: the '-j' option requires a positive integer argument"
Prefer a more generic solution.
Signed-off-by Frederic Weisbecker <[email protected]>Good catch, applied, thank you!
Quoted 8 lines
There is a similar construct in
kvm-remote.sh, so I added a similar fix to your patch.But what about this in
functions.sh?nt="
lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'"I am guessing that "node0" is human-language-independent, but is "NUMA"?
I thought they wouldn't bother translating that, but they did...
NUMA node0 CPU(s): 0-7
becomes:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Nœud NUMA 0 de processeur(s) : 0-7
Not sure about the best way to fix it.
The rude and crude fix is for the scripts to force the local language to English. ;-)
I don't have a better answer :o)
If you set the environment variable LANG to en_US.UTF-8, does that make things work for you? Huh. Setting it to fr_FR.UTF-8 does not shift lscpu out of English for me, so I am guessing "no".
Help?
Thanx, Paul
Quoted 36 lines · Paul E. McKenney
Quoted 35 lines · Frederic Weisbecker
Quoted 34 lines · Paul E. McKenney
Quoted 32 lines · Frederic Weisbecker
Quoted 13 lines · Paul E. McKenney
Quoted 9 lines · Frederic Weisbecker
Grepping for "CPU" on lscpu output isn't always successful, depending on the local language setting. As a result, the build can be aborted early with:
"make: the '-j' option requires a positive integer argument"
Prefer a more generic solution.
Signed-off-by Frederic Weisbecker <[email protected]>Good catch, applied, thank you!
Quoted 8 lines
There is a similar construct in
kvm-remote.sh, so I added a similar fix to your patch.But what about this in
functions.sh?nt="
lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'"I am guessing that "node0" is human-language-independent, but is "NUMA"?
I thought they wouldn't bother translating that, but they did...
NUMA node0 CPU(s): 0-7
becomes:
Nœud NUMA 0 de processeur(s) : 0-7
Not sure about the best way to fix it.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The rude and crude fix is for the scripts to force the local language to English. ;-)
I don't have a better answer :o)
If you set the environment variable LANG to en_US.UTF-8, does that make things work for you? Huh. Setting it to fr_FR.UTF-8 does not shift lscpu out of English for me, so I am guessing "no".
Maybe that language isn't installed in your system. I would expect en_US.UTF-8 to be supported pretty much everywhere though. At least it works for me with: "LANG=en_US.UTF-8 lscpu".
Thanks.
Quoted 4 lines
Help?
Thanx, Paul
Paul E. McKenney
maintainerQuoted 46 lines · Frederic Weisbecker
Quoted 36 lines · Paul E. McKenney
Quoted 35 lines · Frederic Weisbecker
Quoted 34 lines · Paul E. McKenney
Quoted 32 lines · Frederic Weisbecker
Quoted 13 lines · Paul E. McKenney
Quoted 9 lines · Frederic Weisbecker
Grepping for "CPU" on lscpu output isn't always successful, depending on the local language setting. As a result, the build can be aborted early with:
"make: the '-j' option requires a positive integer argument"
Prefer a more generic solution.
Signed-off-by Frederic Weisbecker <[email protected]>Good catch, applied, thank you!
Quoted 8 lines
There is a similar construct in
kvm-remote.sh, so I added a similar fix to your patch.But what about this in
functions.sh?nt="
lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'"I am guessing that "node0" is human-language-independent, but is "NUMA"?
I thought they wouldn't bother translating that, but they did...
NUMA node0 CPU(s): 0-7
becomes:
Nœud NUMA 0 de processeur(s) : 0-7
Not sure about the best way to fix it.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The rude and crude fix is for the scripts to force the local language to English. ;-)
I don't have a better answer :o)
If you set the environment variable LANG to en_US.UTF-8, does that make things work for you? Huh. Setting it to fr_FR.UTF-8 does not shift lscpu out of English for me, so I am guessing "no".
Quoted 5 lines
Maybe that language isn't installed in your system. I would expect en_US.UTF-8 to be supported pretty much everywhere though. At least it works for me with: "LANG=en_US.UTF-8 lscpu".
Thanks.
How about like this? I put this only in kvm.sh for the moment, but if these keep cropping up I will just hit all the scripts. ;-)
Thanx, Paul
------------------------------------------------------------------------
commit 4ca332016ed81c15ebb3b744dbfc462281c544b8
Author: Paul E. McKenney <[email protected]> Date: Thu Apr 1 15:26:56 2021 -0700
torture: Set kvm.sh language to English
Some of the code invoked directly and indirectly from kvm.sh parses the output of commands. This parsing assumes English, which can cause failures if the user has set some other language. In a few cases, there are language-independent commands available, but this is not always the case. Therefore, as an alternative to polyglot parsing, this commit sets the LANG environment variable to en_US.UTF-8.
tools/testing/selftests/rcutorture/bin/kvm.sh +3 -0
@@ -20,6 +20,9 @@ mkdir $T cd `dirname $scriptname`/../../../../../ +# This script knows only English. +LANG=en_US.UTF-8; export LANG + dur=$((30*60)) dryrun="" KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
Quoted 3 lines · Paul E. McKenney
On Thu, Apr 01, 2021 at 11:08:02PM +0200, Frederic Weisbecker wrote:
How about like this? I put this only inkvm.shfor the moment, but if these keep cropping up I will just hit all the scripts. ;-)
Sure, works for me!
Thanks.
Quoted 35 lines
Thanx, Paul
------------------------------------------------------------------------
commit
4ca332016ed81c15ebb3b744dbfc462281c544b8Author: Paul E. McKenney <[email protected]> Date: Thu Apr 1 15:26:56 2021 -0700torture: Set
kvm.shlanguage to EnglishSome of the code invoked directly and indirectly from
kvm.shparses the output of commands. This parsing assumes English, which can cause failures if the user has set some other language. In a few cases, there are language-independent commands available, but this is not always the case. Therefore, as an alternative to polyglot parsing, this commit sets the LANG environment variable to en_US.UTF-8.Reported-by Frederic Weisbecker <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>tools/testing/selftests/rcutorture/bin/kvm.sh +3
-0@@ -20,6 +20,9 @@ mkdir $T cd `dirname $scriptname`/../../../../../ +# This script knows only English. +LANG=en_US.UTF-8; export LANG + dur=$((30*60)) dryrun="" KVM="`pwd`/tools/testing/selftests/rcutorture"; export KVM
tools/testing/selftests/rcutorture/bin/kvm.sh mkdir $T · line 24
Quoted 2 lines · Paul E. McKenney
tools/testing/selftests/rcutorture/bin/kvm.sh +2
-0+# This script knows only English. +LANG=en_US.UTF-8; export LANG
This, too, will only work if en_US.UTF-8 is installed . Check with "locale -a" if it is. Also, Perl will complain loudly if the language is not installed (try: "LANG=en_US.UTF-9 perl"), a nice way to test if LANG works as expected.
So, wouldn't LANG=C be a more conservative fallback here?
</bikeshed>
Christian.
Signature · 3 lines
BOFH excuse #58: high pressure system failure
Paul E. McKenney
maintainerQuoted 10 lines · Christian Kujau
tools/testing/selftests/rcutorture/bin/kvm.sh mkdir $T · line 24
Quoted 2 lines · Paul E. McKenney
tools/testing/selftests/rcutorture/bin/kvm.sh +2
-0+# This script knows only English. +LANG=en_US.UTF-8; export LANGThis, too, will only work if en_US.UTF-8 is installed . Check with "locale -a" if it is. Also, Perl will complain loudly if the language is not installed (try: "LANG=en_US.UTF-9 perl"), a nice way to test if LANG works as expected.
So, wouldn't LANG=C be a more conservative fallback here?
If it works for Frederic, I am good with it. And yes, we do need to have a least-common-denominator solution.
Quoted 1 line
</bikeshed>
Plaid!!! We must paint the bikeshed plaid! ;-)
Thanx, Paul