The patches in this series make the ktap sh helper and the power_supply selftest POSIX-compliant. Tested with bash, dash and busybox ash.
Signed-off-by: Nícolas F. R. A. Prado nfraprado@collabora.com --- Nícolas F. R. A. Prado (2): selftests: ktap_helpers: Make it POSIX-compliant selftests: power_supply: Make it POSIX-compliant
tools/testing/selftests/kselftest/ktap_helpers.sh | 4 ++-- tools/testing/selftests/power_supply/test_power_supply_properties.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) --- base-commit: 7e74ee01d1754156ed3706b61e793fbd46f5cd7b change-id: 20240415-supply-selftest-posix-sh-aee99cf85e8f
Best regards,
There are a couple uses of bash specific syntax in the script. Change them to the equivalent POSIX syntax. This doesn't change functionality and allows non-bash test scripts to make use of these helpers.
Reported-by: Mike Looijmans mike.looijmans@topic.nl Closes: https://lore.kernel.org/all/efae4037-c22a-40be-8ba9-7c1c12ece042@topic.nl/ Fixes: 2dd0b5a8fcc4 ("selftests: ktap_helpers: Add a helper to finish the test") Fixes: 14571ab1ad21 ("kselftest: Add new test for detecting unprobed Devicetree devices") Signed-off-by: Nícolas F. R. A. Prado nfraprado@collabora.com --- tools/testing/selftests/kselftest/ktap_helpers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kselftest/ktap_helpers.sh b/tools/testing/selftests/kselftest/ktap_helpers.sh index f2fbb914e058..79a125eb24c2 100644 --- a/tools/testing/selftests/kselftest/ktap_helpers.sh +++ b/tools/testing/selftests/kselftest/ktap_helpers.sh @@ -43,7 +43,7 @@ __ktap_test() { directive="$3" # optional
local directive_str= - [[ ! -z "$directive" ]] && directive_str="# $directive" + [ ! -z "$directive" ] && directive_str="# $directive"
echo $result $KTAP_TESTNO $description $directive_str
@@ -99,7 +99,7 @@ ktap_exit_fail_msg() { ktap_finished() { ktap_print_totals
- if [ $(("$KTAP_CNT_PASS" + "$KTAP_CNT_SKIP")) -eq "$KSFT_NUM_TESTS" ]; then + if [ $((KTAP_CNT_PASS + KTAP_CNT_SKIP)) -eq "$KSFT_NUM_TESTS" ]; then exit "$KSFT_PASS" else exit "$KSFT_FAIL"
On 4/15/24 8:32 PM, Nícolas F. R. A. Prado wrote:
There are a couple uses of bash specific syntax in the script. Change them to the equivalent POSIX syntax. This doesn't change functionality and allows non-bash test scripts to make use of these helpers.
Reported-by: Mike Looijmans mike.looijmans@topic.nl Closes: https://lore.kernel.org/all/efae4037-c22a-40be-8ba9-7c1c12ece042@topic.nl/ Fixes: 2dd0b5a8fcc4 ("selftests: ktap_helpers: Add a helper to finish the test") Fixes: 14571ab1ad21 ("kselftest: Add new test for detecting unprobed Devicetree devices") Signed-off-by: Nícolas F. R. A. Prado nfraprado@collabora.com
Reviewed-by: Muhammad Usama Anjum usama.anjum@collabora.com
tools/testing/selftests/kselftest/ktap_helpers.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kselftest/ktap_helpers.sh b/tools/testing/selftests/kselftest/ktap_helpers.sh index f2fbb914e058..79a125eb24c2 100644 --- a/tools/testing/selftests/kselftest/ktap_helpers.sh +++ b/tools/testing/selftests/kselftest/ktap_helpers.sh @@ -43,7 +43,7 @@ __ktap_test() { directive="$3" # optional local directive_str=
- [[ ! -z "$directive" ]] && directive_str="# $directive"
- [ ! -z "$directive" ] && directive_str="# $directive"
echo $result $KTAP_TESTNO $description $directive_str @@ -99,7 +99,7 @@ ktap_exit_fail_msg() { ktap_finished() { ktap_print_totals
- if [ $(("$KTAP_CNT_PASS" + "$KTAP_CNT_SKIP")) -eq "$KSFT_NUM_TESTS" ]; then
- if [ $((KTAP_CNT_PASS + KTAP_CNT_SKIP)) -eq "$KSFT_NUM_TESTS" ]; then exit "$KSFT_PASS" else exit "$KSFT_FAIL"
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 mike.looijmans@topic.nl Closes: https://lore.kernel.org/all/efae4037-c22a-40be-8ba9-7c1c12ece042@topic.nl/ Fixes: 4a679c5afca0 ("selftests: Add test to verify power supply properties") Signed-off-by: Nícolas F. R. A. Prado nfraprado@collabora.com --- 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"
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 mike.looijmans@topic.nl Closes: https://lore.kernel.org/all/efae4037-c22a-40be-8ba9-7c1c12ece042@topic.nl/ Fixes: 4a679c5afca0 ("selftests: Add test to verify power supply properties") Signed-off-by: Nícolas F. R. A. Prado nfraprado@collabora.com
Reviewed-by: Muhammad Usama Anjum usama.anjum@collabora.com
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"))
donetotal_tests=$((total_tests + NUM_TESTS))
echo "$total_tests"
On 4/15/24 09:32, Nícolas F. R. A. Prado wrote:
The patches in this series make the ktap sh helper and the power_supply selftest POSIX-compliant. Tested with bash, dash and busybox ash.
Signed-off-by: Nícolas F. R. A. Prado nfraprado@collabora.com
Nícolas F. R. A. Prado (2): selftests: ktap_helpers: Make it POSIX-compliant selftests: power_supply: Make it POSIX-compliant
tools/testing/selftests/kselftest/ktap_helpers.sh | 4 ++-- tools/testing/selftests/power_supply/test_power_supply_properties.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
base-commit: 7e74ee01d1754156ed3706b61e793fbd46f5cd7b change-id: 20240415-supply-selftest-posix-sh-aee99cf85e8f
Best regards,
Thank you. Applied the patches to linux-kselftest next for Linux 6.10-rc1
thanks, -- Shuah
linux-kselftest-mirror@lists.linaro.org