On Thu, Aug 15, 2024 at 04:29:23PM +0530, Abhinav Jain wrote:
Implement on/off testing for all non-fixed features via while loop. Save the initial state so that it can be restored after on/off checks.
Signed-off-by: Abhinav Jain jain.abhinav177@gmail.com
tools/testing/selftests/net/netdevice.sh | 37 +++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/netdevice.sh b/tools/testing/selftests/net/netdevice.sh index 0c32950fdd17..50f7b9d1163d 100755 --- a/tools/testing/selftests/net/netdevice.sh +++ b/tools/testing/selftests/net/netdevice.sh @@ -124,7 +124,42 @@ kci_netdev_ethtool() return 1 fi echo "PASS: $netdev: ethtool list features"
- #TODO for each non fixed features, try to turn them on/off
- while read -r FEATURE VALUE FIXED; do
[ "$FEATURE" != "Features" ] || continue # Skip "Features"[ "$FIXED" != "[fixed]" ] || continue # Skip fixed featuresfeature="${FEATURE%:*}"initial_state=$(ethtool -k "$netdev" | grep "$feature:" \| awk '{print $2}')
Hi Abhinav,
Isn't the value being read into $initial_state here already present in $VALUE?
ethtool --offload "$netdev" "$feature" offif [ $? -eq 0 ]; thenecho "PASS: $netdev: Turned off feature: $feature"elseecho "FAIL: $netdev: Failed to turn off feature:" \"$feature"fiethtool --offload "$netdev" "$feature" onif [ $? -eq 0 ]; thenecho "PASS: $netdev: Turned on feature: $feature"elseecho "FAIL: $netdev: Failed to turn on feature:" \"$feature"fi#restore the feature to its initial stateethtool --offload "$netdev" "$feature" "$initial_state"if [ $? -eq 0 ]; thenecho "PASS: $netdev: Restore feature $feature" \"to initial state $initial_state"elseecho "FAIL: $netdev: Failed to restore feature" \"$feature to default $initial_state"fi- done < "$TMP_ETHTOOL_FEATURES"
- rm "$TMP_ETHTOOL_FEATURES"
kci_netdev_ethtool_test 74 'dump' "ethtool -d $netdev" -- 2.34.1