diff mbox series

[net,v2] selftests: net: fix rps_default_mask with >32 CPUs

Message ID 20240120210256.3864747-1-kuba@kernel.org
State Accepted
Commit 0719b5338a0cbe80d1637a5fb03d8141b5bfc7a1
Headers show
Series [net,v2] selftests: net: fix rps_default_mask with >32 CPUs | expand

Commit Message

Jakub Kicinski Jan. 20, 2024, 9:02 p.m. UTC
If there is more than 32 cpus the bitmask will start to contain
commas, leading to:

./rps_default_mask.sh: line 36: [: 00000000,00000000: integer expression expected

Remove the commas, bash doesn't interpret leading zeroes as oct
so that should be good enough.

Fixes: c12e0d5f267d ("self-tests: introduce self-tests for RPS default mask")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2:
 - remove all commas
v1: https://lore.kernel.org/all/20240119151248.3476897-1-kuba@kernel.org/

CC: shuah@kernel.org
CC: horms@kernel.org
CC: linux-kselftest@vger.kernel.org
---
 tools/testing/selftests/net/rps_default_mask.sh | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Horman Jan. 21, 2024, 8:34 p.m. UTC | #1
On Sat, Jan 20, 2024 at 01:02:56PM -0800, Jakub Kicinski wrote:
> If there is more than 32 cpus the bitmask will start to contain
> commas, leading to:
> 
> ./rps_default_mask.sh: line 36: [: 00000000,00000000: integer expression expected
> 
> Remove the commas, bash doesn't interpret leading zeroes as oct
> so that should be good enough.
> 
> Fixes: c12e0d5f267d ("self-tests: introduce self-tests for RPS default mask")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> v2:
>  - remove all commas
> v1: https://lore.kernel.org/all/20240119151248.3476897-1-kuba@kernel.org/

Thanks,

this version looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/rps_default_mask.sh b/tools/testing/selftests/net/rps_default_mask.sh
index a26c5624429f..4729e7026a73 100755
--- a/tools/testing/selftests/net/rps_default_mask.sh
+++ b/tools/testing/selftests/net/rps_default_mask.sh
@@ -33,6 +33,10 @@  chk_rps() {
 
 	rps_mask=$($cmd /sys/class/net/$dev_name/queues/rx-0/rps_cpus)
 	printf "%-60s" "$msg"
+
+	# In case there is more than 32 CPUs we need to remove commas from masks
+	rps_mask=${rps_mask//,}
+	expected_rps_mask=${expected_rps_mask//,}
 	if [ $rps_mask -eq $expected_rps_mask ]; then
 		echo "[ ok ]"
 	else