scripts/common.zsh

75 lines
1.5 KiB
Bash

#!/bin/zsh
##############################
# #
# NFS client configuration #
# #
##############################
CLIENT=(client)
MOUNTPOINT=(/mnt/test)
SCRATCHMNT=(/mnt/scratch)
##############################
# #
# NFS server configuration #
# #
##############################
SERVER=(server)
EXPORT=(/srv/xfs/test)
SCRATCH=(/srv/xfs/scratch)
###########################
# #
# General configuration #
# #
###########################
BIN=$HOME/bin
DMESG=()
PROTO=(tcp)
SRVDMESG=()
USER=$(whoami)
VERSION=(3 4.0 4.1 4.2)
######################
# #
# Shared functions #
# #
######################
function setup_client_func()
{
ssh ${CLIENT[-1]} "sudo setup-testdirs.zsh ${SERVER[-1]} \
${EXPORT[-1]} \
${MOUNTPOINT[-1]} \
$USER"
}
function prepare_to_test()
{
$BIN/vm.zsh boot ${CLIENT[-1]} ${SERVER[-1]}
$BIN/install-scripts.zsh ${CLIENT[-1]}
if [ ${#DMESG} -gt 0 ]; then
ssh ${CLIENT[-1]} "sudo dmesg --clear"
fi
if [ ${#SRVDMESG} -gt 0 ]; then
ssh ${SERVER[-1]} "sudo dmesg --clear"
fi
if [ ${#RDMA} -gt 0 ]; then
PROTO+=(rdma)
$BIN/rping.zsh ${RDMA[-1]} ${CLIENT[-1]} ${SERVER[-1]}
fi
setup_client_func
echo
}
TRAPEXIT()
{
if [ ${#DMESG} -gt 0 ]; then
ssh ${CLIENT[-1]} "sudo dmesg --color=always"
fi
if [ ${#SRVDMESG} -gt 0 ]; then
ssh ${SERVER[-1]} "sudo dmesg --color=always"
fi
}