test/nvme-perf: move executable lines from common file
Move executable lines from common.sh body into a function. Otherwise these are run when file is sourced. Leaving getopts as only executable in common.sh, this can be fixed later and does not cause problems now. Change-Id: Iddbfd9aff5cd006cf3afb579f627f3463663ea6a Signed-off-by: Karol Latecki <karol.latecki@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479816 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
73d398dd29
commit
96ff6348b6
@ -328,6 +328,21 @@ function wait_for_nvme_reload() {
|
||||
shopt -q extglob
|
||||
}
|
||||
|
||||
function verify_disk_number() {
|
||||
# Check if we have appropriate number of disks to carry out the test
|
||||
if [[ $PLUGIN == "bdev" ]] || [[ $PLUGIN == "bdevperf" ]]; then
|
||||
$ROOT_DIR/scripts/gen_nvme.sh >> $BASE_DIR/bdev.conf
|
||||
fi
|
||||
|
||||
disks=($(get_disks $PLUGIN))
|
||||
if [[ $DISKNO == "ALL" ]] || [[ $DISKNO == "all" ]]; then
|
||||
DISKNO=${#disks[@]}
|
||||
elif [[ $DISKNO -gt ${#disks[@]} ]] || [[ ! $DISKNO =~ ^[0-9]+$ ]]; then
|
||||
echo "error: Required devices number ($DISKNO) is not a valid number or it's larger than the number of devices found (${#disks[@]})"
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
function usage()
|
||||
{
|
||||
set +x
|
||||
@ -397,17 +412,3 @@ while getopts 'h-:' optchar; do
|
||||
*) usage $0 "Invalid argument '$optchar'"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
trap 'rm -f *.state $BASE_DIR/bdev.conf; print_backtrace' ERR SIGTERM SIGABRT
|
||||
mkdir -p $BASE_DIR/results
|
||||
if [[ $PLUGIN == "bdev" ]] || [[ $PLUGIN == "bdevperf" ]]; then
|
||||
$ROOT_DIR/scripts/gen_nvme.sh >> $BASE_DIR/bdev.conf
|
||||
fi
|
||||
|
||||
disks=($(get_disks $PLUGIN))
|
||||
if [[ $DISKNO == "ALL" ]] || [[ $DISKNO == "all" ]]; then
|
||||
DISKNO=${#disks[@]}
|
||||
elif [[ $DISKNO -gt ${#disks[@]} ]] || [[ ! $DISKNO =~ ^[0-9]+$ ]]; then
|
||||
echo "error: Required devices number ($DISKNO) is not a valid number or it's larger than the number of devices found (${#disks[@]})"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -34,6 +34,9 @@
|
||||
BASE_DIR=$(readlink -f $(dirname $0))
|
||||
. $BASE_DIR/common.sh
|
||||
|
||||
trap 'rm -f *.state $BASE_DIR/bdev.conf; print_backtrace' ERR SIGTERM SIGABRT
|
||||
verify_disk_number
|
||||
|
||||
DISK_NAMES=$(get_disks $PLUGIN)
|
||||
DISKS_NUMA=$(get_numa_node $PLUGIN "$DISK_NAMES")
|
||||
CORES=$(get_cores "$CPUS_ALLOWED")
|
||||
|
Loading…
x
Reference in New Issue
Block a user