Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] selftests: helpers: handle multi line in test_sysfs_prop_optional_list
@ 2026-06-25 16:05 Boris Shtrasman
  2026-06-25 16:05 ` [PATCH v2 1/2] " Boris Shtrasman
  2026-06-25 16:05 ` [PATCH v2 2/2] selftests: test possible usb type values from documentation Boris Shtrasman
  0 siblings, 2 replies; 3+ messages in thread
From: Boris Shtrasman @ 2026-06-25 16:05 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 \
               usb_type "Unknown","SDP","DCP","CDP","ACA","C","PD"\
                       ,"PD_DRP","PD_PPS","BrickID", "PD_SPR_AVS" \
                       ,"PD_PPS_SPR_AVS"

--
Changes in v2:
- correctped typo IFS vs $IFS.
- Added the patch to treat usb_types

--

Boris Shtrasman (2):
  selftests: helpers: handle multi line in test_sysfs_prop_optional_list
  selftests: test possible usb type values from documentation

 tools/testing/selftests/power_supply/helpers.sh           | 8 ++++----
 .../power_supply/test_power_supply_properties.sh          | 5 ++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] selftests: helpers: handle multi line in test_sysfs_prop_optional_list
  2026-06-25 16:05 [PATCH v2 0/2] selftests: helpers: handle multi line in test_sysfs_prop_optional_list Boris Shtrasman
@ 2026-06-25 16:05 ` Boris Shtrasman
  2026-06-25 16:05 ` [PATCH v2 2/2] selftests: test possible usb type values from documentation Boris Shtrasman
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Shtrasman @ 2026-06-25 16:05 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..ff1175aeed72 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] 3+ messages in thread

* [PATCH v2 2/2] selftests: test possible usb type values from documentation
  2026-06-25 16:05 [PATCH v2 0/2] selftests: helpers: handle multi line in test_sysfs_prop_optional_list Boris Shtrasman
  2026-06-25 16:05 ` [PATCH v2 1/2] " Boris Shtrasman
@ 2026-06-25 16:05 ` Boris Shtrasman
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Shtrasman @ 2026-06-25 16:05 UTC (permalink / raw)
  To: Sebastian Reichel, Shuah Khan
  Cc: linux-pm, linux-kselftest, linux-kernel, Boris Shtrasman

modify kselftest to check for usb_types values from
Documentation/ABI/testing/sysfs-class-power instead of only checking for
property.

Added the
"Unknown", "SDP", "DCP", "CDP", "ACA", "C", "PD",
"PD_DRP", "PD_PPS", "BrickID", "PD_SPR_AVS",
"PD_PPS_SPR_AVS" values from the
 /sys/class/power_supply/<supply_name>/usb_type section.

Signed-off-by: Boris Shtrasman <borissh1983@gmail.com>
---
 .../selftests/power_supply/test_power_supply_properties.sh   | 5 ++++-
 1 file changed, 4 insertions(+), 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 a66b1313ed88..7bf76af4cfd5 100755
--- a/tools/testing/selftests/power_supply/test_power_supply_properties.sh
+++ b/tools/testing/selftests/power_supply/test_power_supply_properties.sh
@@ -58,7 +58,10 @@ for DEVNAME in $supplies; do
 	# This fails on kernels < 5.8 (needs 2ad3d74e3c69f)
 	test_uevent_prop TYPE "$SUPPLY_TYPE"
 
-	test_sysfs_prop_optional usb_type
+	test_sysfs_prop_optional_list \
+		usb_type "Unknown","SDP","DCP","CDP","ACA","C","PD"\
+			,"PD_DRP","PD_PPS","BrickID", "PD_SPR_AVS" \
+			,"PD_PPS_SPR_AVS"
 
 	test_sysfs_prop_optional_range online 0 2
 	test_sysfs_prop_optional_range present 0 1
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-25 16:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-25 16:05 [PATCH v2 0/2] selftests: helpers: handle multi line in test_sysfs_prop_optional_list Boris Shtrasman
2026-06-25 16:05 ` [PATCH v2 1/2] " Boris Shtrasman
2026-06-25 16:05 ` [PATCH v2 2/2] selftests: test possible usb type values from documentation Boris Shtrasman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox