2024-04-15 15:33:00

by Nícolas F. R. A. Prado

[permalink] [raw]
Subject: [PATCH 2/2] selftests: power_supply: Make it POSIX-compliant

There is one use of bash specific syntax in the script. Change it to the
equivalent POSIX syntax. This doesn't change functionality and allows
the test to be run on shells other than bash.

Reported-by: Mike Looijmans <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Fixes: 4a679c5afca0 ("selftests: Add test to verify power supply properties")
Signed-off-by: Nícolas F. R. A. Prado <[email protected]>
---
tools/testing/selftests/power_supply/test_power_supply_properties.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/power_supply/test_power_supply_properties.sh b/tools/testing/selftests/power_supply/test_power_supply_properties.sh
index df272dfe1d2a..a66b1313ed88 100755
--- a/tools/testing/selftests/power_supply/test_power_supply_properties.sh
+++ b/tools/testing/selftests/power_supply/test_power_supply_properties.sh
@@ -23,7 +23,7 @@ count_tests() {
total_tests=0

for i in $SUPPLIES; do
- total_tests=$(("$total_tests" + "$NUM_TESTS"))
+ total_tests=$((total_tests + NUM_TESTS))
done

echo "$total_tests"

--
2.44.0



2024-04-15 18:38:18

by Muhammad Usama Anjum

[permalink] [raw]
Subject: Re: [PATCH 2/2] selftests: power_supply: Make it POSIX-compliant

On 4/15/24 8:32 PM, Nícolas F. R. A. Prado wrote:
> There is one use of bash specific syntax in the script. Change it to the
> equivalent POSIX syntax. This doesn't change functionality and allows
> the test to be run on shells other than bash.
>
> Reported-by: Mike Looijmans <[email protected]>
> Closes: https://lore.kernel.org/all/[email protected]/
> Fixes: 4a679c5afca0 ("selftests: Add test to verify power supply properties")
> Signed-off-by: Nícolas F. R. A. Prado <[email protected]>
Reviewed-by: Muhammad Usama Anjum <[email protected]>

> ---
> tools/testing/selftests/power_supply/test_power_supply_properties.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/power_supply/test_power_supply_properties.sh b/tools/testing/selftests/power_supply/test_power_supply_properties.sh
> index df272dfe1d2a..a66b1313ed88 100755
> --- a/tools/testing/selftests/power_supply/test_power_supply_properties.sh
> +++ b/tools/testing/selftests/power_supply/test_power_supply_properties.sh
> @@ -23,7 +23,7 @@ count_tests() {
> total_tests=0
>
> for i in $SUPPLIES; do
> - total_tests=$(("$total_tests" + "$NUM_TESTS"))
> + total_tests=$((total_tests + NUM_TESTS))
> done
>
> echo "$total_tests"
>

--
BR,
Muhammad Usama Anjum