selftests: test netdevsim reload forbid and fail
authorJiri Pirko <jiri@mellanox.com>
Sun, 6 Oct 2019 06:30:02 +0000 (08:30 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 6 Oct 2019 16:28:42 +0000 (18:28 +0200)
Extend netdevsim reload test by simulation of failures.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/drivers/net/netdevsim/devlink.sh

index 69af99b..de31744 100755 (executable)
@@ -150,6 +150,30 @@ reload_test()
        devlink dev reload $DL_HANDLE
        check_err $? "Failed to reload"
 
+       echo "y"> $DEBUGFS_DIR/fail_reload
+       check_err $? "Failed to setup devlink reload to fail"
+
+       devlink dev reload $DL_HANDLE
+       check_fail $? "Unexpected success of devlink reload"
+
+       echo "n"> $DEBUGFS_DIR/fail_reload
+       check_err $? "Failed to setup devlink reload not to fail"
+
+       devlink dev reload $DL_HANDLE
+       check_err $? "Failed to reload after set not to fail"
+
+       echo "y"> $DEBUGFS_DIR/dont_allow_reload
+       check_err $? "Failed to forbid devlink reload"
+
+       devlink dev reload $DL_HANDLE
+       check_fail $? "Unexpected success of devlink reload"
+
+       echo "n"> $DEBUGFS_DIR/dont_allow_reload
+       check_err $? "Failed to re-enable devlink reload"
+
+       devlink dev reload $DL_HANDLE
+       check_err $? "Failed to reload after re-enable"
+
        log_test "reload test"
 }