* [PATCH 0/2] selftests: Make sh helper and power supply test POSIX-compliant
@ 2024-04-15 15:32 Nícolas F. R. A. Prado
2024-04-15 15:32 ` [PATCH 1/2] selftests: ktap_helpers: Make it POSIX-compliant Nícolas F. R. A. Prado
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-04-15 15:32 UTC (permalink / raw)
To: Shuah Khan
Cc: Sebastian Reichel, Mike Looijmans, kernel, linux-kselftest,
linux-kernel, linux-pm, Nícolas F. R. A. Prado
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,
--
Nícolas F. R. A. Prado <nfraprado@collabora.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] selftests: ktap_helpers: Make it POSIX-compliant
2024-04-15 15:32 [PATCH 0/2] selftests: Make sh helper and power supply test POSIX-compliant Nícolas F. R. A. Prado
@ 2024-04-15 15:32 ` Nícolas F. R. A. Prado
2024-04-15 18:38 ` Muhammad Usama Anjum
2024-04-15 15:32 ` [PATCH 2/2] selftests: power_supply: " Nícolas F. R. A. Prado
2024-04-24 13:33 ` [PATCH 0/2] selftests: Make sh helper and power supply test POSIX-compliant Shuah Khan
2 siblings, 1 reply; 6+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-04-15 15:32 UTC (permalink / raw)
To: Shuah Khan
Cc: Sebastian Reichel, Mike Looijmans, kernel, linux-kselftest,
linux-kernel, linux-pm, Nícolas F. R. A. Prado
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"
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] selftests: ktap_helpers: Make it POSIX-compliant
2024-04-15 15:32 ` [PATCH 1/2] selftests: ktap_helpers: Make it POSIX-compliant Nícolas F. R. A. Prado
@ 2024-04-15 18:38 ` Muhammad Usama Anjum
0 siblings, 0 replies; 6+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-15 18:38 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Shuah Khan
Cc: Muhammad Usama Anjum, Sebastian Reichel, Mike Looijmans, kernel,
linux-kselftest, linux-kernel, linux-pm
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"
>
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] selftests: power_supply: Make it POSIX-compliant
2024-04-15 15:32 [PATCH 0/2] selftests: Make sh helper and power supply test POSIX-compliant Nícolas F. R. A. Prado
2024-04-15 15:32 ` [PATCH 1/2] selftests: ktap_helpers: Make it POSIX-compliant Nícolas F. R. A. Prado
@ 2024-04-15 15:32 ` Nícolas F. R. A. Prado
2024-04-15 18:38 ` Muhammad Usama Anjum
2024-04-24 13:33 ` [PATCH 0/2] selftests: Make sh helper and power supply test POSIX-compliant Shuah Khan
2 siblings, 1 reply; 6+ messages in thread
From: Nícolas F. R. A. Prado @ 2024-04-15 15:32 UTC (permalink / raw)
To: Shuah Khan
Cc: Sebastian Reichel, Mike Looijmans, kernel, linux-kselftest,
linux-kernel, linux-pm, Nícolas F. R. A. Prado
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"
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] selftests: power_supply: Make it POSIX-compliant
2024-04-15 15:32 ` [PATCH 2/2] selftests: power_supply: " Nícolas F. R. A. Prado
@ 2024-04-15 18:38 ` Muhammad Usama Anjum
0 siblings, 0 replies; 6+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-15 18:38 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Shuah Khan
Cc: Muhammad Usama Anjum, Sebastian Reichel, Mike Looijmans, kernel,
linux-kselftest, linux-kernel, linux-pm
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"))
> + total_tests=$((total_tests + NUM_TESTS))
> done
>
> echo "$total_tests"
>
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] selftests: Make sh helper and power supply test POSIX-compliant
2024-04-15 15:32 [PATCH 0/2] selftests: Make sh helper and power supply test POSIX-compliant Nícolas F. R. A. Prado
2024-04-15 15:32 ` [PATCH 1/2] selftests: ktap_helpers: Make it POSIX-compliant Nícolas F. R. A. Prado
2024-04-15 15:32 ` [PATCH 2/2] selftests: power_supply: " Nícolas F. R. A. Prado
@ 2024-04-24 13:33 ` Shuah Khan
2 siblings, 0 replies; 6+ messages in thread
From: Shuah Khan @ 2024-04-24 13:33 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Shuah Khan
Cc: Sebastian Reichel, Mike Looijmans, kernel, linux-kselftest,
linux-kernel, linux-pm, Shuah Khan
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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-04-24 13:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-15 15:32 [PATCH 0/2] selftests: Make sh helper and power supply test POSIX-compliant Nícolas F. R. A. Prado
2024-04-15 15:32 ` [PATCH 1/2] selftests: ktap_helpers: Make it POSIX-compliant Nícolas F. R. A. Prado
2024-04-15 18:38 ` Muhammad Usama Anjum
2024-04-15 15:32 ` [PATCH 2/2] selftests: power_supply: " Nícolas F. R. A. Prado
2024-04-15 18:38 ` Muhammad Usama Anjum
2024-04-24 13:33 ` [PATCH 0/2] selftests: Make sh helper and power supply test POSIX-compliant Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox