* [PATCH] selftests: helpers: handle multi line in test_sysfs_prop_optional_list
@ 2026-06-25 12:52 Boris Shtrasman
2026-06-26 6:40 ` borissh1983
0 siblings, 1 reply; 2+ messages in thread
From: Boris Shtrasman @ 2026-06-25 12:52 UTC (permalink / raw)
To: Sebastian Reichel, Shuah Khan
Cc: linux-pm, linux-kselftest, linux-kernel, Boris Shtrasman
Modify test_sysfs_prop_optional_list to allow multi line parameters, in
order to comply with checkpatch output that limit line by 100 chars.
Allow use cases like:
test_sysfs_prop_optional_list \
property_name "value1","value2","val3","very_long_option"\
,"extra_long_option" \
,"even_more_data"
Signed-off-by: Boris Shtrasman <borissh1983@gmail.com>
---
tools/testing/selftests/power_supply/helpers.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/power_supply/helpers.sh b/tools/testing/selftests/power_supply/helpers.sh
index 1ec90d7c9108..8535cb7ed094 100644
--- a/tools/testing/selftests/power_supply/helpers.sh
+++ b/tools/testing/selftests/power_supply/helpers.sh
@@ -108,7 +108,7 @@ test_sysfs_prop_optional_range() {
test_sysfs_prop_optional_list() {
PROP=$1
- LIST=$2
+ shift
TEST_NAME="$DEVNAME".sysfs."$PROP"
@@ -118,9 +118,9 @@ test_sysfs_prop_optional_list() {
valid=0
OLDIFS=$IFS
- IFS=","
- for item in $LIST; do
- if [ "$DATA" = "$item" ]; then
+ IFS=",IFS"
+ for item in $*; do
+ if [ "$item" ] && [ "$DATA" = "$item" ]; then
valid=1
break
fi
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests: helpers: handle multi line in test_sysfs_prop_optional_list
2026-06-25 12:52 [PATCH] selftests: helpers: handle multi line in test_sysfs_prop_optional_list Boris Shtrasman
@ 2026-06-26 6:40 ` borissh1983
0 siblings, 0 replies; 2+ messages in thread
From: borissh1983 @ 2026-06-26 6:40 UTC (permalink / raw)
To: Sebastian Reichel, Shuah Khan; +Cc: linux-pm, linux-kselftest, linux-kernel
On Thursday, 25 June 2026 15:52:37 Israel Daylight Time Boris Shtrasman wrote:
> Modify test_sysfs_prop_optional_list to allow multi line parameters, in
> order to comply with checkpatch output that limit line by 100 chars.
>
> Allow use cases like:
>
> test_sysfs_prop_optional_list \
> property_name "value1","value2","val3","very_long_option"\
> ,"extra_long_option" \
> ,"even_more_data"
>
> Signed-off-by: Boris Shtrasman <borissh1983@gmail.com>
> ---
> tools/testing/selftests/power_supply/helpers.sh | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/power_supply/helpers.sh b/tools/testing/selftests/power_supply/helpers.sh
> index 1ec90d7c9108..8535cb7ed094 100644
> --- a/tools/testing/selftests/power_supply/helpers.sh
> +++ b/tools/testing/selftests/power_supply/helpers.sh
> @@ -108,7 +108,7 @@ test_sysfs_prop_optional_range() {
>
> test_sysfs_prop_optional_list() {
> PROP=$1
> - LIST=$2
> + shift
>
> TEST_NAME="$DEVNAME".sysfs."$PROP"
>
> @@ -118,9 +118,9 @@ test_sysfs_prop_optional_list() {
> valid=0
>
> OLDIFS=$IFS
> - IFS=","
> - for item in $LIST; do
> - if [ "$DATA" = "$item" ]; then
> + IFS=",IFS"
> + for item in $*; do
> + if [ "$item" ] && [ "$DATA" = "$item" ]; then
> valid=1
> break
> fi
>
A new version of this patch now at
https://lore.kernel.org/linux-pm/20260625160556.54830-1-borissh1983@gmail.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-26 6:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-25 12:52 [PATCH] selftests: helpers: handle multi line in test_sysfs_prop_optional_list Boris Shtrasman
2026-06-26 6:40 ` borissh1983
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.