On Thu, 10 Jul 2025 08:22:47 +0200 Maxime Chevallier wrote:
+set -o pipefail
+# Check simple PHY addition and listing
+# Parent == 0 means that the PHY's parent is the netdev +PHY_DFS=$(make_phydev_on_netdev "$NSIM_ID" 0)
+# First PHY gets index 1 +index=$(ethtool --show-phys "$NSIM_NETDEV" | grep "PHY index" | cut -d ' ' -f 3) +check $? "$index" "1"
+# Insert a second PHY, same parent. It gets index 2. +PHY2_DFS=$(make_phydev_on_netdev "$NSIM_ID" 0)
+# Create another netdev +NSIM_ID2=$((RANDOM % 1024)) +NSIM_NETDEV_2=$(make_netdev_from_id "$NSIM_ID2")
+PHY3_DFS=$(make_phydev_on_netdev "$NSIM_ID2" 0);
+# Check unfiltered PHY Dump +n_phy=$(ethtool --show-phys '*' | grep -c "PHY index") +check $? "$n_phy" "3"
+# Check filtered Dump +n_phy=$(ethtool --show-phys "$NSIM_NETDEV" | grep -c "PHY index") +check $? "$n_phy" "2"
Not a very strong preference, but I wonder if we should wire up the paths to the Python lib for drivers/net/netdevsim and switch to Python? It does the setup and cleanup and it gives us direct YNL access. More convenient for testing new stuff than jugging ethtool builds.. But I guess you could argue that testing the CLI is good in itself.