• Petr Machata's avatar
    selftests: mlxsw: bail_on_lldpad before installing the cleanup trap · 18d2c710
    Petr Machata authored
    A number of mlxsw-specific QoS tests use manual QoS DCB management. As
    such, they need to make sure lldpad is not running, because it would
    override the configuration the test has applied using other tools. To that
    end, these selftests invoke the bail_on_lldpad() helper, which terminates
    the selftest if th lldpad is running.
    
    Some of these tests however first install the bash exit trap, which invokes
    a cleanup() at the test exit. If bail_on_lldpad() has terminated the script
    even before the setup part was run, the cleanup part will be very confused.
    
    Therefore make sure bail_on_lldpad() is invoked before the cleanup is
    registered.
    
    While there are still edge cases where the user terminates the script
    before the setup was fully done, this takes care of a common situation
    where the cleanup would be invoked in an inconsistent state.
    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>
    18d2c710
sch_red_root.sh 1.16 KB