selftests: helpers: handle multi line in test_sysfs_prop_optional_list
Subsystems (2)
v2 cover selftests: helpers: handle multi line in test_sysfs_prop_optional_list
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(-)
Signature · 1 line
2.47.3
PATCH v2 1/2 selftests: helpers: handle multi line in test_sysfs_prop_optional_list
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"--- tools/testing/selftests/power_supply/helpers.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/power_supply/helpers.sh +4 -4
@@ -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
Signature · 1 line
2.47.3
PATCH v2 2/2 selftests: test possible usb type values from documentation
In reply to Boris Shtrasmanmodify 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.
--- .../selftests/power_supply/test_power_supply_properties.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/power_supply/test_power_supply_properties.sh +4 -1
@@ -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
Signature · 1 line
2.47.3
Sebastian Reichel
maintainerRe: [PATCH v2 2/2] selftests: test possible usb type values from documentation
Hi,
Quoted 20 lines · Boris Shtrasman
modify kselftest to check for
usb_typesvalues fromDocumentation/ABI/testing/sysfs-class-powerinstead 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 <[email protected]>--- .../selftests/power_supply/test_power_supply_properties.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)tools/testing/selftests/power_supply/test_power_supply_properties.sh +0
-0
tools/testing/selftests/power_supply/test_power_supply_properties.sh for DEVNAME in $supplies; do · line 64
Quoted 8 lines
tools/testing/selftests/power_supply/test_power_supply_properties.sh +4
-1@@ -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"
I've picked up the other patch, but skipped this one, because it does not work. The usb_type property reports back differently from what the test_sysfs_prop_optional_list function expects:
sre@venus ~ % cat /sys/class/power_supply/ucsi-source-psy-pmic_glink.ucsi.01/usb_type
[C] PD PD_PPS
Greetings,
-- Sebastian
Sebastian Reichel
AppliedQuoted 10 lines · Boris Shtrasman
Modify
test_sysfs_prop_optional_listto 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"[...]
Applied, thanks!
[1/2] selftests: helpers: handle multi line in test_sysfs_prop_optional_list
commit: 426decb0c770ec4e0677906e1f51b6d19dc1b788
[2/2] selftests: test possible usb type values from documentation
(no commit info)
Best regards,
Signature · 1 line
Sebastian Reichel <[email protected]>