• Petr Machata's avatar
    selftests: mlxsw: Add helpers for skipping selftests · b8bfafe4
    Petr Machata authored
    A number of mlxsw-specific selftests currently detect whether they are run
    on a compatible machine, and bail out silently when not. These tests are
    however done in a somewhat impenetrable manner by directly comparing PCI
    IDs against a blacklist or a whitelist, and bailing out silently if the
    machine is not compatible.
    
    Instead, add a helper, mlxsw_only_on_spectrum(), which allows specifying
    the supported machines in a human-readable manner. If the current machine
    is incompatible, the helper emits a SKIP message and returns an error code,
    based on which the caller can gracefully bail out in a suitable way. This
    allows a more readable conditions such as:
    
    	mlxsw_only_on_spectrum 2+ || return
    
    Convert all existing open-coded guards to the new helper. Also add two new
    guards to do_mark_test() and do_drop_test(), which are supported only on
    Spectrum-2+, but the corresponding check was not there.
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b8bfafe4
devlink_trap_control.sh 17.9 KB