ifupdown-ng/tests/linux/ethtool_test

484 lines
13 KiB
Text
Raw Normal View History

#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/ethtool"
tests_init \
pre_up_msglvl \
pre_up_ethernet_port \
up_speed \
up_duplex \
up_wol \
up_wol_sopass \
up_autoneg_simple \
up_autoneg_mask \
up_pause_autoneg \
up_pause_tx \
2020-09-21 15:18:08 +00:00
up_pause_rx \
up_offload_gro \
up_offload_gso \
up_offload_lro \
up_offload_rx \
up_offload_sg \
up_offload_tso \
up_offload_tx \
2020-09-21 15:38:39 +00:00
up_offload_ufo \
up_dma_ring_rx \
up_dma_ring_rx_jumbo \
up_dma_ring_rx_mini \
up_dma_ring_tx \
up_coalesce_adaptive_rx \
up_coalesce_adaptive_tx \
up_coalesce_pkt_rate_low \
up_coalesce_pkt_rate_high \
up_coalesce_sample_interval \
up_coalesce_stats_block_usecs \
up_coalesce_rx_frames \
up_coalesce_rx_frames_low \
up_coalesce_rx_frames_irq \
up_coalesce_rx_frames_high \
up_coalesce_rx_usecs \
up_coalesce_rx_usecs_low \
up_coalesce_rx_usecs_irq \
up_coalesce_rx_usecs_high \
up_coalesce_tx_frames \
up_coalesce_tx_frames_low \
up_coalesce_tx_frames_irq \
up_coalesce_tx_frames_high \
up_coalesce_tx_usecs \
up_coalesce_tx_usecs_low \
up_coalesce_tx_usecs_irq \
up_coalesce_tx_usecs_high
pre_up_msglvl_body() {
export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_MSGLVL="debug on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --change eth0' \
-o match:'msglvl debug on' \
${EXECUTOR}
}
pre_up_ethernet_port_body() {
export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_ETHERNET_PORT="4" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --change eth0' \
-o match:'port 4' \
${EXECUTOR}
}
up_speed_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_LINK_SPEED="1000" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --change eth0' \
-o match:'speed 1000' \
${EXECUTOR}
}
up_duplex_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_LINK_DUPLEX="full" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --change eth0' \
-o match:'duplex full' \
${EXECUTOR}
}
up_wol_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_WOL="g" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --change eth0' \
-o match:'wol g' \
${EXECUTOR}
}
up_wol_sopass_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_WOL="s abc123" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --change eth0' \
-o match:'wol s sopass abc123' \
${EXECUTOR}
}
up_autoneg_simple_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_AUTONEG="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --change eth0' \
-o match:'autoneg on' \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_AUTONEG="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --change eth0' \
-o match:'autoneg off' \
${EXECUTOR}
}
up_autoneg_mask_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_AUTONEG="1000/full" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --change eth0' \
-o match:'autoneg on advertise 1000/full' \
${EXECUTOR}
}
up_pause_autoneg_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_AUTONEG="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --pause eth0' \
-o match:"autoneg 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_AUTONEG="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --pause eth0' \
-o match:"autoneg 'off'" \
${EXECUTOR}
}
up_pause_tx_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_TX="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --pause eth0' \
-o match:"tx 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_TX="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --pause eth0' \
-o match:"tx 'off'" \
${EXECUTOR}
}
up_pause_rx_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_RX="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --pause eth0' \
-o match:"rx 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_RX="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --pause eth0' \
-o match:"rx 'off'" \
${EXECUTOR}
}
2020-09-21 15:18:08 +00:00
up_offload_gro_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GRO="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"gro 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GRO="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"gro 'off'" \
${EXECUTOR}
}
up_offload_gso_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GSO="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"gso 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GSO="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"gso 'off'" \
${EXECUTOR}
}
up_offload_lro_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_LRO="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"lro 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_LRO="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"lro 'off'" \
${EXECUTOR}
}
up_offload_rx_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_RX="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"rx 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_RX="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"rx 'off'" \
${EXECUTOR}
}
up_offload_sg_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_SG="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"sg 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_SG="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"sg 'off'" \
${EXECUTOR}
}
up_offload_tso_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TSO="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"tso 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TSO="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"tso 'off'" \
${EXECUTOR}
}
up_offload_tx_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TX="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"tx 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TX="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"tx 'off'" \
${EXECUTOR}
}
up_offload_ufo_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_UFO="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"ufo 'on'" \
${EXECUTOR}
export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_UFO="off" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --offload eth0' \
-o match:"ufo 'off'" \
${EXECUTOR}
}
2020-09-21 15:38:39 +00:00
up_dma_ring_rx_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --set-ring eth0' \
-o match:"rx '1024'" \
${EXECUTOR}
}
up_dma_ring_rx_jumbo_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX_JUMBO="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --set-ring eth0' \
-o match:"rx-jumbo '1024'" \
${EXECUTOR}
}
up_dma_ring_rx_mini_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX_MINI="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --set-ring eth0' \
-o match:"rx-mini '1024'" \
${EXECUTOR}
}
up_dma_ring_tx_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_TX="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --set-ring eth0' \
-o match:"tx '1024'" \
${EXECUTOR}
}
up_coalesce_adaptive_rx_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_ADAPTIVE_RX="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"adaptive-rx 'on'" \
${EXECUTOR}
}
up_coalesce_adaptive_tx_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_ADAPTIVE_TX="on" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"adaptive-tx 'on'" \
${EXECUTOR}
}
up_coalesce_pkt_rate_low_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_PKT_RATE_LOW="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"pkt-rate-low '1024'" \
${EXECUTOR}
}
up_coalesce_pkt_rate_high_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_PKT_RATE_HIGH="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"pkt-rate-high '1024'" \
${EXECUTOR}
}
up_coalesce_sample_interval_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_SAMPLE_INTERVAL="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"sample-interval '1024'" \
${EXECUTOR}
}
up_coalesce_stats_block_usecs_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_STATS_BLOCK_USECS="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"stats-block-usecs '1024'" \
${EXECUTOR}
}
up_coalesce_rx_frames_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"rx-frames '1024'" \
${EXECUTOR}
}
up_coalesce_rx_frames_low_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES_LOW="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"rx-frames-low '1024'" \
${EXECUTOR}
}
up_coalesce_rx_frames_irq_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES_IRQ="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"rx-frames-irq '1024'" \
${EXECUTOR}
}
up_coalesce_rx_frames_high_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES_HIGH="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"rx-frames-high '1024'" \
${EXECUTOR}
}
up_coalesce_rx_usecs_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"rx-usecs '1024'" \
${EXECUTOR}
}
up_coalesce_rx_usecs_low_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS_LOW="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"rx-usecs-low '1024'" \
${EXECUTOR}
}
up_coalesce_rx_usecs_irq_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS_IRQ="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"rx-usecs-irq '1024'" \
${EXECUTOR}
}
up_coalesce_rx_usecs_high_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS_HIGH="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"rx-usecs-high '1024'" \
${EXECUTOR}
}
up_coalesce_tx_frames_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"tx-frames '1024'" \
${EXECUTOR}
}
up_coalesce_tx_frames_low_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES_LOW="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"tx-frames-low '1024'" \
${EXECUTOR}
}
up_coalesce_tx_frames_irq_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES_IRQ="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"tx-frames-irq '1024'" \
${EXECUTOR}
}
up_coalesce_tx_frames_high_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES_HIGH="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"tx-frames-high '1024'" \
${EXECUTOR}
}
up_coalesce_tx_usecs_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"tx-usecs '1024'" \
${EXECUTOR}
}
up_coalesce_tx_usecs_low_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS_LOW="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"tx-usecs-low '1024'" \
${EXECUTOR}
}
up_coalesce_tx_usecs_irq_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS_IRQ="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"tx-usecs-irq '1024'" \
${EXECUTOR}
}
up_coalesce_tx_usecs_high_body() {
export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS_HIGH="1024" MOCK="echo"
atf_check -s exit:0 \
-o match:'ethtool --coalesce eth0' \
-o match:"tx-usecs-high '1024'" \
${EXECUTOR}
}