diff --git a/test/nvme/hw_hotplug.sh b/test/nvme/hw_hotplug.sh index a0891230b..19984ad9b 100755 --- a/test/nvme/hw_hotplug.sh +++ b/test/nvme/hw_hotplug.sh @@ -4,33 +4,43 @@ testdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $testdir/../..) source $rootdir/test/common/autotest_common.sh +function beetle_ssh() { + if [[ -n $BEETLE_SSH_KEY ]]; then + ssh_opts=" -i $(readlink -f $BEETLE_SSH_KEY)" + fi + + #shellcheck disable=SC2029 + ssh $ssh_opts root@$ip "$@" +} + function insert_device() { - ssh root@$ip 'Beetle --SetGpio "$gpio" HIGH' + beetle_ssh 'Beetle --SetGpio "$gpio" HIGH' waitforblk $name DRIVER_OVERRIDE=$driver $rootdir/scripts/setup.sh } function remove_device() { - ssh root@$ip 'Beetle --SetGpio "$gpio" LOW' + beetle_ssh 'Beetle --SetGpio "$gpio" LOW' } function restore_device() { - ssh root@$ip 'Beetle --SetGpio "$gpio" HIGH' + beetle_ssh 'Beetle --SetGpio "$gpio" HIGH' } ip=$1 gpio=$2 driver=$3 + declare -i io_time=5 declare -i kernel_hotplug_time=7 timing_enter hotplug_hw_cfg # Configure microcontroller -ssh root@$ip 'Beetle --SetGpioDirection "$gpio" OUT' +beetle_ssh 'Beetle --SetGpioDirection "$gpio" OUT' # Get blk dev name connected to interposer -ssh root@$ip 'Beetle --SetGpio "$gpio" HIGH' +beetle_ssh 'Beetle --SetGpio "$gpio" HIGH' sleep $kernel_hotplug_time $rootdir/scripts/setup.sh reset blk_list1=$(lsblk -d --output NAME | grep "^nvme")