check_format: Reformat the Bash code in compliance with shfmt

Change-Id: I93e7b9d355870b0528a0ac3382fba1a10a558d45
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1718
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Michal Berger 2020-05-07 13:27:06 +02:00 committed by Jim Harris
parent 0c1d022b57
commit 844c8ec383
135 changed files with 3368 additions and 3397 deletions

View File

@ -35,7 +35,7 @@ $MAKE cc_version
$MAKE cxx_version $MAKE cxx_version
echo "** END ** Info for Hostname: $HOSTNAME" echo "** END ** Info for Hostname: $HOSTNAME"
function ocf_precompile { function ocf_precompile() {
# We compile OCF sources ourselves # We compile OCF sources ourselves
# They don't need to be checked with scanbuild and code coverage is not applicable # They don't need to be checked with scanbuild and code coverage is not applicable
# So we precompile OCF now for further use as standalone static library # So we precompile OCF now for further use as standalone static library
@ -48,7 +48,7 @@ function ocf_precompile {
./configure $config_params ./configure $config_params
} }
function make_fail_cleanup { function make_fail_cleanup() {
if [ -d $out/scan-build-tmp ]; then if [ -d $out/scan-build-tmp ]; then
scanoutput=$(ls -1 $out/scan-build-tmp/) scanoutput=$(ls -1 $out/scan-build-tmp/)
mv $out/scan-build-tmp/$scanoutput $out/scan-build mv $out/scan-build-tmp/$scanoutput $out/scan-build
@ -58,7 +58,7 @@ function make_fail_cleanup {
false false
} }
function scanbuild_make { function scanbuild_make() {
pass=true pass=true
$scanbuild $MAKE $MAKEFLAGS > $out/build_output.txt && rm -rf $out/scan-build-tmp || make_fail_cleanup $scanbuild $MAKE $MAKEFLAGS > $out/build_output.txt && rm -rf $out/scan-build-tmp || make_fail_cleanup
xtrace_disable xtrace_disable
@ -92,7 +92,7 @@ function scanbuild_make {
$pass $pass
} }
function porcelain_check { function porcelain_check() {
if [ $(git status --porcelain --ignore-submodules | wc -l) -ne 0 ]; then if [ $(git status --porcelain --ignore-submodules | wc -l) -ne 0 ]; then
echo "Generated files missing from .gitignore:" echo "Generated files missing from .gitignore:"
git status --porcelain --ignore-submodules git status --porcelain --ignore-submodules
@ -103,7 +103,7 @@ function porcelain_check {
# Check that header file dependencies are working correctly by # Check that header file dependencies are working correctly by
# capturing a binary's stat data before and after touching a # capturing a binary's stat data before and after touching a
# header file and re-making. # header file and re-making.
function header_dependency_check { function header_dependency_check() {
STAT1=$(stat app/spdk_tgt/spdk_tgt) STAT1=$(stat app/spdk_tgt/spdk_tgt)
sleep 1 sleep 1
touch lib/nvme/nvme_internal.h touch lib/nvme/nvme_internal.h
@ -116,7 +116,7 @@ function header_dependency_check {
fi fi
} }
function test_make_uninstall { function test_make_uninstall() {
# Create empty file to check if it is not deleted by target uninstall # Create empty file to check if it is not deleted by target uninstall
touch "$SPDK_WORKSPACE/usr/lib/sample_xyz.a" touch "$SPDK_WORKSPACE/usr/lib/sample_xyz.a"
$MAKE $MAKEFLAGS uninstall DESTDIR="$SPDK_WORKSPACE" prefix=/usr $MAKE $MAKEFLAGS uninstall DESTDIR="$SPDK_WORKSPACE" prefix=/usr
@ -127,7 +127,7 @@ function test_make_uninstall {
fi fi
} }
function build_doc { function build_doc() {
$MAKE -C "$rootdir"/doc --no-print-directory $MAKEFLAGS &> "$out"/doxygen.log $MAKE -C "$rootdir"/doc --no-print-directory $MAKEFLAGS &> "$out"/doxygen.log
if [ -s "$out"/doxygen.log ]; then if [ -s "$out"/doxygen.log ]; then
cat "$out"/doxygen.log cat "$out"/doxygen.log
@ -149,7 +149,7 @@ function build_doc {
rm -rf "$rootdir"/doc/output rm -rf "$rootdir"/doc/output
} }
function autobuild_test_suite { function autobuild_test_suite() {
run_test "autobuild_check_format" ./scripts/check_format.sh run_test "autobuild_check_format" ./scripts/check_format.sh
run_test "autobuild_external_code" sudo -E $rootdir/test/external_code/test_make.sh $rootdir run_test "autobuild_external_code" sudo -E $rootdir/test/external_code/test_make.sh $rootdir
if [ "$SPDK_TEST_OCF" -eq 1 ]; then if [ "$SPDK_TEST_OCF" -eq 1 ]; then

View File

@ -82,9 +82,7 @@ if [ $(uname -s) = Linux ]; then
# If some OCSSD device is bound to other driver than nvme we won't be able to # If some OCSSD device is bound to other driver than nvme we won't be able to
# discover if it is OCSSD or not so load the kernel driver first. # discover if it is OCSSD or not so load the kernel driver first.
while IFS= read -r -d '' dev; do
while IFS= read -r -d '' dev
do
# Send Open Channel 2.0 Geometry opcode "0xe2" - not supported by NVMe device. # Send Open Channel 2.0 Geometry opcode "0xe2" - not supported by NVMe device.
if nvme admin-passthru $dev --namespace-id=1 --data-len=4096 --opcode=0xe2 --read > /dev/null; then if nvme admin-passthru $dev --namespace-id=1 --data-len=4096 --opcode=0xe2 --read > /dev/null; then
bdf="$(basename $(readlink -e /sys/class/nvme/${dev#/dev/}/device))" bdf="$(basename $(readlink -e /sys/class/nvme/${dev#/dev/}/device))"

View File

@ -65,8 +65,7 @@ fi
if hash astyle; then if hash astyle; then
echo -n "Checking coding style..." echo -n "Checking coding style..."
if [ "$(astyle -V)" \< "Artistic Style Version 3" ] if [ "$(astyle -V)" \< "Artistic Style Version 3" ]; then
then
echo -n " Your astyle version is too old so skipping coding style checks. Please update astyle to at least 3.0.1 version..." echo -n " Your astyle version is too old so skipping coding style checks. Please update astyle to at least 3.0.1 version..."
else else
rm -f astyle.log rm -f astyle.log
@ -75,9 +74,9 @@ if hash astyle; then
# as-is to enable ongoing work to synch with a generic upstream DPDK vhost library, # as-is to enable ongoing work to synch with a generic upstream DPDK vhost library,
# rather than making diffs more complicated by a lot of changes to follow SPDK # rather than making diffs more complicated by a lot of changes to follow SPDK
# coding standards. # coding standards.
git ls-files '*.[ch]' '*.cpp' '*.cc' '*.cxx' '*.hh' '*.hpp' | \ git ls-files '*.[ch]' '*.cpp' '*.cc' '*.cxx' '*.hh' '*.hpp' \
grep -v rte_vhost | grep -v cpp_headers | \ | grep -v rte_vhost | grep -v cpp_headers \
xargs -P$(nproc) -n10 astyle --options=.astylerc >> astyle.log | xargs -P$(nproc) -n10 astyle --options=.astylerc >> astyle.log
if grep -q "^Formatted" astyle.log; then if grep -q "^Formatted" astyle.log; then
echo " errors detected" echo " errors detected"
git diff git diff
@ -171,8 +170,8 @@ rm -f badcunit.log
echo -n "Checking blank lines at end of file..." echo -n "Checking blank lines at end of file..."
if ! git grep -I -l -e . -z './*' ':!*.patch' | \ if ! git grep -I -l -e . -z './*' ':!*.patch' \
xargs -0 -P$(nproc) -n1 scripts/eofnl > eofnl.log; then | xargs -0 -P$(nproc) -n1 scripts/eofnl > eofnl.log; then
echo " Incorrect end-of-file formatting detected" echo " Incorrect end-of-file formatting detected"
cat eofnl.log cat eofnl.log
rc=1 rc=1

View File

@ -40,11 +40,11 @@ cache_pci () {
local pci=$1 class=$2 vendor=$3 device=$4 local pci=$1 class=$2 vendor=$3 device=$4
if [[ -n $class ]]; then if [[ -n $class ]]; then
class=0x${class/0x} class=0x${class/0x/}
pci_bus_cache["$class"]="${pci_bus_cache["$class"]:+${pci_bus_cache["$class"]} }$pci" pci_bus_cache["$class"]="${pci_bus_cache["$class"]:+${pci_bus_cache["$class"]} }$pci"
fi fi
if [[ -n $vendor && -n $device ]]; then if [[ -n $vendor && -n $device ]]; then
vendor=0x${vendor/0x} device=0x${device/0x} vendor=0x${vendor/0x/} device=0x${device/0x/}
pci_bus_cache["$vendor"]="${pci_bus_cache["$vendor"]:+${pci_bus_cache["$vendor"]} }$pci" pci_bus_cache["$vendor"]="${pci_bus_cache["$vendor"]:+${pci_bus_cache["$vendor"]} }$pci"
pci_bus_cache["$device"]="${pci_bus_cache["$device"]:+${pci_bus_cache["$device"]} }$pci" pci_bus_cache["$device"]="${pci_bus_cache["$device"]:+${pci_bus_cache["$device"]} }$pci"
pci_bus_cache["$vendor:$device"]="${pci_bus_cache["$vendor:$device"]:+${pci_bus_cache["$vendor:$device"]} }$pci" pci_bus_cache["$vendor:$device"]="${pci_bus_cache["$vendor:$device"]:+${pci_bus_cache["$vendor:$device"]} }$pci"
@ -141,18 +141,18 @@ function iter_all_pci_class_code() {
if hash lspci &> /dev/null; then if hash lspci &> /dev/null; then
if [ "$progif" != "00" ]; then if [ "$progif" != "00" ]; then
lspci -mm -n -D | \ lspci -mm -n -D \
grep -i -- "-p${progif}" | \ | grep -i -- "-p${progif}" \
awk -v cc="\"${class}${subclass}\"" -F " " \ | awk -v cc="\"${class}${subclass}\"" -F " " \
'{if (cc ~ $2) print $1}' | tr -d '"' '{if (cc ~ $2) print $1}' | tr -d '"'
else else
lspci -mm -n -D | \ lspci -mm -n -D \
awk -v cc="\"${class}${subclass}\"" -F " " \ | awk -v cc="\"${class}${subclass}\"" -F " " \
'{if (cc ~ $2) print $1}' | tr -d '"' '{if (cc ~ $2) print $1}' | tr -d '"'
fi fi
elif hash pciconf &> /dev/null; then elif hash pciconf &> /dev/null; then
local addr=($(pciconf -l | grep -i "class=0x${class}${subclass}${progif}" | \ local addr=($(pciconf -l | grep -i "class=0x${class}${subclass}${progif}" \
cut -d$'\t' -f1 | sed -e 's/^[a-zA-Z0-9_]*@pci//g' | tr ':' ' ')) | cut -d$'\t' -f1 | sed -e 's/^[a-zA-Z0-9_]*@pci//g' | tr ':' ' '))
printf "%04x:%02x:%02x:%x\n" ${addr[0]} ${addr[1]} ${addr[2]} ${addr[3]} printf "%04x:%02x:%02x:%x\n" ${addr[0]} ${addr[1]} ${addr[2]} ${addr[3]}
elif iter_all_pci_sysfs "$(printf '0x%06x' $((0x$progif | 0x$subclass << 8 | 0x$class << 16)))"; then elif iter_all_pci_sysfs "$(printf '0x%06x' $((0x$progif | 0x$subclass << 8 | 0x$class << 16)))"; then
: :
@ -173,8 +173,8 @@ function iter_all_pci_dev_id() {
lspci -mm -n -D | awk -v ven="\"$ven_id\"" -v dev="\"${dev_id}\"" -F " " \ lspci -mm -n -D | awk -v ven="\"$ven_id\"" -v dev="\"${dev_id}\"" -F " " \
'{if (ven ~ $3 && dev ~ $4) print $1}' | tr -d '"' '{if (ven ~ $3 && dev ~ $4) print $1}' | tr -d '"'
elif hash pciconf &> /dev/null; then elif hash pciconf &> /dev/null; then
local addr=($(pciconf -l | grep -i "chip=0x${dev_id}${ven_id}" | \ local addr=($(pciconf -l | grep -i "chip=0x${dev_id}${ven_id}" \
cut -d$'\t' -f1 | sed -e 's/^[a-zA-Z0-9_]*@pci//g' | tr ':' ' ')) | cut -d$'\t' -f1 | sed -e 's/^[a-zA-Z0-9_]*@pci//g' | tr ':' ' '))
printf "%04x:%02x:%02x:%x\n" ${addr[0]} ${addr[1]} ${addr[2]} ${addr[3]} printf "%04x:%02x:%02x:%x\n" ${addr[0]} ${addr[1]} ${addr[2]} ${addr[3]}
elif iter_all_pci_sysfs "0x$ven_id:0x$dev_id"; then elif iter_all_pci_sysfs "0x$ven_id:0x$dev_id"; then
: :

View File

@ -2,13 +2,11 @@
set -e set -e
function err() function err() {
{
echo "$@" >&2 echo "$@" >&2
} }
function usage() function usage() {
{
err "Detect compiler and linker versions, generate mk/cc.mk" err "Detect compiler and linker versions, generate mk/cc.mk"
err "" err ""
err "Usage: ./detect_cc.sh [OPTION]..." err "Usage: ./detect_cc.sh [OPTION]..."
@ -24,8 +22,6 @@ function usage()
err " --cross-prefix=prefix Use the given prefix for the cross compiler toolchain" err " --cross-prefix=prefix Use the given prefix for the cross compiler toolchain"
} }
for i in "$@"; do for i in "$@"; do
case "$i" in case "$i" in
-h | --help) -h | --help)
@ -64,6 +60,7 @@ for i in "$@"; do
err "Unrecognized option $i" err "Unrecognized option $i"
usage usage
exit 1 exit 1
;;
esac esac
done done
@ -105,6 +102,7 @@ case "$LD_TYPE" in
*) *)
err "Unsupported linker: $LD" err "Unsupported linker: $LD"
exit 1 exit 1
;;
esac esac
CCAR="ar" CCAR="ar"

View File

@ -4,7 +4,7 @@ set -e
rootdir=$(readlink -f $(dirname $0))/.. rootdir=$(readlink -f $(dirname $0))/..
function usage { function usage() {
echo "Usage: [-j] $0 -n BDEV_NAME -d BASE_BDEV [-u UUID] [-c CACHE]" echo "Usage: [-j] $0 -n BDEV_NAME -d BASE_BDEV [-u UUID] [-c CACHE]"
echo "UUID is required when restoring device state" echo "UUID is required when restoring device state"
echo echo
@ -14,8 +14,7 @@ function usage {
echo "CACHE - name of the bdev to be used as write buffer cache" echo "CACHE - name of the bdev to be used as write buffer cache"
} }
function create_json_config() function create_json_config() {
{
echo "{" echo "{"
echo '"subsystem": "bdev",' echo '"subsystem": "bdev",'
echo '"config": [' echo '"config": ['
@ -44,10 +43,14 @@ while getopts ":c:d:hn:u:" arg; do
d) base_bdev=$OPTARG ;; d) base_bdev=$OPTARG ;;
u) uuid=$OPTARG ;; u) uuid=$OPTARG ;;
c) cache=$OPTARG ;; c) cache=$OPTARG ;;
h) usage h)
exit 0 ;; usage
*) usage exit 0
exit 1 ;; ;;
*)
usage
exit 1
;;
esac esac
done done

View File

@ -5,22 +5,18 @@ set -e
rootdir=$(readlink -f $(dirname $0))/.. rootdir=$(readlink -f $(dirname $0))/..
source "$rootdir/scripts/common.sh" source "$rootdir/scripts/common.sh"
function create_classic_config() function create_classic_config() {
{
echo "[Nvme]" echo "[Nvme]"
for (( i=0; i < ${#bdfs[@]}; i++)) for ((i = 0; i < ${#bdfs[@]}; i++)); do
do
echo " TransportID \"trtype:PCIe traddr:${bdfs[i]}\" Nvme$i" echo " TransportID \"trtype:PCIe traddr:${bdfs[i]}\" Nvme$i"
done done
} }
function create_json_config() function create_json_config() {
{
echo "{" echo "{"
echo '"subsystem": "bdev",' echo '"subsystem": "bdev",'
echo '"config": [' echo '"config": ['
for (( i=0; i < ${#bdfs[@]}; i++)) for ((i = 0; i < ${#bdfs[@]}; i++)); do
do
echo '{' echo '{'
echo '"params": {' echo '"params": {'
echo '"trtype": "PCIe",' echo '"trtype": "PCIe",'

View File

@ -3,8 +3,7 @@
set -e set -e
function usage() function usage() {
{
echo "" echo ""
echo "This script is intended to automate the installation of package dependencies to build SPDK." echo "This script is intended to automate the installation of package dependencies to build SPDK."
echo "Please run this script as root user or with sudo -E." echo "Please run this script as root user or with sudo -E."
@ -21,8 +20,7 @@ function usage()
exit 0 exit 0
} }
function install_all_dependencies () function install_all_dependencies() {
{
INSTALL_DEV_TOOLS=true INSTALL_DEV_TOOLS=true
INSTALL_PMEM=true INSTALL_PMEM=true
INSTALL_FUSE=true INSTALL_FUSE=true
@ -48,8 +46,10 @@ while getopts 'abdfhipr-:' optchar; do
fuse) INSTALL_FUSE=true ;; fuse) INSTALL_FUSE=true ;;
rdma) INSTALL_RDMA=true ;; rdma) INSTALL_RDMA=true ;;
docs) INSTALL_DOCS=true ;; docs) INSTALL_DOCS=true ;;
*) echo "Invalid argument '$OPTARG'" *)
usage;; echo "Invalid argument '$OPTARG'"
usage
;;
esac esac
;; ;;
h) usage ;; h) usage ;;
@ -59,8 +59,10 @@ while getopts 'abdfhipr-:' optchar; do
f) INSTALL_FUSE=true ;; f) INSTALL_FUSE=true ;;
r) INSTALL_RDMA=true ;; r) INSTALL_RDMA=true ;;
b) INSTALL_DOCS=true ;; b) INSTALL_DOCS=true ;;
*) echo "Invalid argument '$OPTARG'" *)
usage;; echo "Invalid argument '$OPTARG'"
usage
;;
esac esac
done done

View File

@ -5,15 +5,17 @@ set -e
rootdir=$(readlink -f $(dirname $0))/.. rootdir=$(readlink -f $(dirname $0))/..
source "$rootdir/scripts/common.sh" source "$rootdir/scripts/common.sh"
function usage() function usage() {
{
if [ $(uname) = Linux ]; then if [ $(uname) = Linux ]; then
options="[config|reset|status|cleanup|help]" options="[config|reset|status|cleanup|help]"
else else
options="[config|reset|help]" options="[config|reset|help]"
fi fi
[[ -n $2 ]] && ( echo "$2"; echo ""; ) [[ -n $2 ]] && (
echo "$2"
echo ""
)
echo "Helper script for allocating hugepages and binding NVMe, I/OAT, VMD and Virtio devices" echo "Helper script for allocating hugepages and binding NVMe, I/OAT, VMD and Virtio devices"
echo "to a generic VFIO kernel driver. If VFIO is not available on the system, this script" echo "to a generic VFIO kernel driver. If VFIO is not available on the system, this script"
echo "will fall back to UIO. NVMe and Virtio devices with active mountpoints will be ignored." echo "will fall back to UIO. NVMe and Virtio devices with active mountpoints will be ignored."
@ -63,15 +65,15 @@ function usage()
# back that with a /sys/modules. We also check # back that with a /sys/modules. We also check
# /sys/bus/pci/drivers/ as neither lsmod nor /sys/modules might # /sys/bus/pci/drivers/ as neither lsmod nor /sys/modules might
# contain needed info (like in Fedora-like OS). # contain needed info (like in Fedora-like OS).
function check_for_driver { function check_for_driver() {
if lsmod | grep -q ${1//-/_}; then if lsmod | grep -q ${1//-/_}; then
return 1 return 1
fi fi
if [[ -d /sys/module/${1} || \ if [[ -d /sys/module/${1} || -d \
-d /sys/module/${1//-/_} || \ /sys/module/${1//-/_} || -d \
-d /sys/bus/pci/drivers/${1} || \ /sys/bus/pci/drivers/${1} || -d \
-d /sys/bus/pci/drivers/${1//-/_} ]]; then /sys/bus/pci/drivers/${1//-/_} ]]; then
return 2 return 2
fi fi
return 0 return 0
@ -137,7 +139,7 @@ function linux_hugetlbfs_mounts() {
mount | grep ' type hugetlbfs ' | awk '{ print $3 }' mount | grep ' type hugetlbfs ' | awk '{ print $3 }'
} }
function get_nvme_name_from_bdf { function get_nvme_name_from_bdf() {
local blknames=() local blknames=()
set +e set +e
@ -157,7 +159,7 @@ function get_nvme_name_from_bdf {
printf '%s\n' "${blknames[@]}" printf '%s\n' "${blknames[@]}"
} }
function get_virtio_names_from_bdf { function get_virtio_names_from_bdf() {
blk_devs=$(lsblk --nodeps --output NAME) blk_devs=$(lsblk --nodeps --output NAME)
virtio_names=() virtio_names=()
@ -170,7 +172,7 @@ function get_virtio_names_from_bdf {
eval "$2=( " "${virtio_names[@]}" " )" eval "$2=( " "${virtio_names[@]}" " )"
} }
function configure_linux_pci { function configure_linux_pci() {
local driver_path="" local driver_path=""
driver_name="" driver_name=""
if [[ -n "${DRIVER_OVERRIDE}" ]]; then if [[ -n "${DRIVER_OVERRIDE}" ]]; then
@ -186,8 +188,8 @@ function configure_linux_pci {
if [[ "$driver_name" = "igb_uio" ]]; then if [[ "$driver_name" = "igb_uio" ]]; then
modprobe uio modprobe uio
fi fi
elif [[ -n "$(ls /sys/kernel/iommu_groups)" || \ elif [[ -n "$(ls /sys/kernel/iommu_groups)" || (-e \
(-e /sys/module/vfio/parameters/enable_unsafe_noiommu_mode && \ /sys/module/vfio/parameters/enable_unsafe_noiommu_mode && \
"$(cat /sys/module/vfio/parameters/enable_unsafe_noiommu_mode)" == "Y") ]]; then "$(cat /sys/module/vfio/parameters/enable_unsafe_noiommu_mode)" == "Y") ]]; then
driver_name=vfio-pci driver_name=vfio-pci
elif modinfo uio_pci_generic > /dev/null 2>&1; then elif modinfo uio_pci_generic > /dev/null 2>&1; then
@ -242,8 +244,7 @@ function configure_linux_pci {
grep "PCI_DEVICE_ID_INTEL_IOAT" $rootdir/include/spdk/pci_ids.h \ grep "PCI_DEVICE_ID_INTEL_IOAT" $rootdir/include/spdk/pci_ids.h \
| awk -F"x" '{print $2}' > $TMP | awk -F"x" '{print $2}' > $TMP
while IFS= read -r dev_id while IFS= read -r dev_id; do
do
for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do
if ! pci_can_use $bdf; then if ! pci_can_use $bdf; then
pci_dev_echo "$bdf" "Skipping un-whitelisted I/OAT device" pci_dev_echo "$bdf" "Skipping un-whitelisted I/OAT device"
@ -261,8 +262,7 @@ function configure_linux_pci {
grep "PCI_DEVICE_ID_INTEL_IDXD" $rootdir/include/spdk/pci_ids.h \ grep "PCI_DEVICE_ID_INTEL_IDXD" $rootdir/include/spdk/pci_ids.h \
| awk -F"x" '{print $2}' > $TMP | awk -F"x" '{print $2}' > $TMP
while IFS= read -r dev_id while IFS= read -r dev_id; do
do
for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do
if ! pci_can_use $bdf; then if ! pci_can_use $bdf; then
pci_dev_echo "$bdf" "Skipping un-whitelisted IDXD device" pci_dev_echo "$bdf" "Skipping un-whitelisted IDXD device"
@ -280,8 +280,7 @@ function configure_linux_pci {
grep "PCI_DEVICE_ID_VIRTIO" $rootdir/include/spdk/pci_ids.h \ grep "PCI_DEVICE_ID_VIRTIO" $rootdir/include/spdk/pci_ids.h \
| awk -F"x" '{print $2}' > $TMP | awk -F"x" '{print $2}' > $TMP
while IFS= read -r dev_id while IFS= read -r dev_id; do
do
for bdf in ${pci_bus_cache["0x1af4:0x$dev_id"]}; do for bdf in ${pci_bus_cache["0x1af4:0x$dev_id"]}; do
if ! pci_can_use $bdf; then if ! pci_can_use $bdf; then
pci_dev_echo "$bdf" "Skipping un-whitelisted Virtio device at $bdf" pci_dev_echo "$bdf" "Skipping un-whitelisted Virtio device at $bdf"
@ -307,8 +306,7 @@ function configure_linux_pci {
grep "PCI_DEVICE_ID_INTEL_VMD" $rootdir/include/spdk/pci_ids.h \ grep "PCI_DEVICE_ID_INTEL_VMD" $rootdir/include/spdk/pci_ids.h \
| awk -F"x" '{print $2}' > $TMP | awk -F"x" '{print $2}' > $TMP
while IFS= read -r dev_id while IFS= read -r dev_id; do
do
for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do
if [[ -z "$PCI_WHITELIST" ]] || ! pci_can_use $bdf; then if [[ -z "$PCI_WHITELIST" ]] || ! pci_can_use $bdf; then
echo "Skipping un-whitelisted VMD device at $bdf" echo "Skipping un-whitelisted VMD device at $bdf"
@ -324,7 +322,7 @@ function configure_linux_pci {
echo "1" > "/sys/bus/pci/rescan" echo "1" > "/sys/bus/pci/rescan"
} }
function cleanup_linux { function cleanup_linux() {
shopt -s extglob nullglob shopt -s extglob nullglob
dirs_to_clean="" dirs_to_clean=""
dirs_to_clean="$(echo {/var/run,/tmp}/dpdk/spdk{,_pid}+([0-9])) " dirs_to_clean="$(echo {/var/run,/tmp}/dpdk/spdk{,_pid}+([0-9])) "
@ -338,12 +336,12 @@ function cleanup_linux {
done done
shopt -u extglob nullglob shopt -u extglob nullglob
files_to_clean+="$(ls -1 /dev/shm/* | \ files_to_clean+="$(ls -1 /dev/shm/* \
grep -E '(spdk_tgt|iscsi|vhost|nvmf|rocksdb|bdevio|bdevperf|vhost_fuzz|nvme_fuzz)_trace|spdk_iscsi_conns' || true) " | grep -E '(spdk_tgt|iscsi|vhost|nvmf|rocksdb|bdevio|bdevperf|vhost_fuzz|nvme_fuzz)_trace|spdk_iscsi_conns' || true) "
files_to_clean="$(readlink -e assert_not_empty $files_to_clean || true)" files_to_clean="$(readlink -e assert_not_empty $files_to_clean || true)"
if [[ -z "$files_to_clean" ]]; then if [[ -z "$files_to_clean" ]]; then
echo "Clean" echo "Clean"
return 0; return 0
fi fi
shopt -s extglob shopt -s extglob
@ -380,7 +378,7 @@ function cleanup_linux {
unset dirs_to_clean files_to_clean opened_files unset dirs_to_clean files_to_clean opened_files
} }
function configure_linux { function configure_linux() {
configure_linux_pci configure_linux_pci
hugetlbfs_mounts=$(linux_hugetlbfs_mounts) hugetlbfs_mounts=$(linux_hugetlbfs_mounts)
@ -442,7 +440,7 @@ function configure_linux {
fi fi
} }
function reset_linux_pci { function reset_linux_pci() {
# NVMe # NVMe
set +e set +e
check_for_driver nvme check_for_driver nvme
@ -470,8 +468,7 @@ function reset_linux_pci {
check_for_driver ioatdma check_for_driver ioatdma
driver_loaded=$? driver_loaded=$?
set -e set -e
while IFS= read -r dev_id while IFS= read -r dev_id; do
do
for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do
if ! pci_can_use $bdf; then if ! pci_can_use $bdf; then
pci_dev_echo "$bdf" "Skipping un-whitelisted I/OAT device" pci_dev_echo "$bdf" "Skipping un-whitelisted I/OAT device"
@ -495,8 +492,7 @@ function reset_linux_pci {
check_for_driver idxd check_for_driver idxd
driver_loaded=$? driver_loaded=$?
set -e set -e
while IFS= read -r dev_id while IFS= read -r dev_id; do
do
for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do
if ! pci_can_use $bdf; then if ! pci_can_use $bdf; then
pci_dev_echo "$bdf" "Skipping un-whitelisted IDXD device" pci_dev_echo "$bdf" "Skipping un-whitelisted IDXD device"
@ -522,8 +518,7 @@ function reset_linux_pci {
# virtio-pci but just virtio_scsi instead. Also need to make sure we get the # virtio-pci but just virtio_scsi instead. Also need to make sure we get the
# underscore vs. dash right in the virtio_scsi name. # underscore vs. dash right in the virtio_scsi name.
modprobe virtio-pci || true modprobe virtio-pci || true
while IFS= read -r dev_id while IFS= read -r dev_id; do
do
for bdf in ${pci_bus_cache["0x1af4:0x$dev_id"]}; do for bdf in ${pci_bus_cache["0x1af4:0x$dev_id"]}; do
if ! pci_can_use $bdf; then if ! pci_can_use $bdf; then
pci_dev_echo "$bdf" "Skipping un-whitelisted Virtio device at" pci_dev_echo "$bdf" "Skipping un-whitelisted Virtio device at"
@ -544,8 +539,7 @@ function reset_linux_pci {
check_for_driver vmd check_for_driver vmd
driver_loaded=$? driver_loaded=$?
set -e set -e
while IFS= read -r dev_id while IFS= read -r dev_id; do
do
for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do
if ! pci_can_use $bdf; then if ! pci_can_use $bdf; then
echo "Skipping un-whitelisted VMD device at $bdf" echo "Skipping un-whitelisted VMD device at $bdf"
@ -563,7 +557,7 @@ function reset_linux_pci {
echo "1" > "/sys/bus/pci/rescan" echo "1" > "/sys/bus/pci/rescan"
} }
function reset_linux { function reset_linux() {
reset_linux_pci reset_linux_pci
for mount in $(linux_hugetlbfs_mounts); do for mount in $(linux_hugetlbfs_mounts); do
rm -f "$mount"/spdk*map_* rm -f "$mount"/spdk*map_*
@ -571,7 +565,7 @@ function reset_linux {
rm -f /run/.spdk* rm -f /run/.spdk*
} }
function status_linux { function status_linux() {
echo "Hugepages" echo "Hugepages"
printf "%-6s %10s %8s / %6s\n" "node" "hugesize" "free" "total" printf "%-6s %10s %8s / %6s\n" "node" "hugesize" "free" "total"
@ -615,11 +609,11 @@ function status_linux {
device=$(cat /sys/bus/pci/devices/$bdf/device) device=$(cat /sys/bus/pci/devices/$bdf/device)
vendor=$(cat /sys/bus/pci/devices/$bdf/vendor) vendor=$(cat /sys/bus/pci/devices/$bdf/vendor)
if [ "$driver" = "nvme" ] && [ -d /sys/bus/pci/devices/$bdf/nvme ]; then if [ "$driver" = "nvme" ] && [ -d /sys/bus/pci/devices/$bdf/nvme ]; then
name="\t"$(ls /sys/bus/pci/devices/$bdf/nvme); name="\t"$(ls /sys/bus/pci/devices/$bdf/nvme)
else else
name="-"; name="-"
fi fi
echo -e "$bdf\t${vendor#0x}\t${device#0x}\t$node\t${driver:--}\t\t$name"; echo -e "$bdf\t${vendor#0x}\t${device#0x}\t$node\t${driver:--}\t\t$name"
done done
echo "" echo ""
@ -696,13 +690,13 @@ function status_linux {
for dev_id in $TMP; do for dev_id in $TMP; do
for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do for bdf in ${pci_bus_cache["0x8086:0x$dev_id"]}; do
driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent | awk -F"=" '{print $2}') driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent | awk -F"=" '{print $2}')
node=$(cat /sys/bus/pci/devices/$bdf/numa_node); node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
echo -e "$bdf\t$node\t\t$driver" echo -e "$bdf\t$node\t\t$driver"
done done
done done
} }
function configure_freebsd_pci { function configure_freebsd_pci() {
local devs ids id local devs ids id
local BDFS local BDFS
@ -730,7 +724,7 @@ function configure_freebsd_pci {
kldload nic_uio.ko kldload nic_uio.ko
} }
function configure_freebsd { function configure_freebsd() {
configure_freebsd_pci configure_freebsd_pci
# If contigmem is already loaded but the HUGEMEM specified doesn't match the # If contigmem is already loaded but the HUGEMEM specified doesn't match the
# previous value, unload contigmem so that we can reload with the new value. # previous value, unload contigmem so that we can reload with the new value.
@ -746,7 +740,7 @@ function configure_freebsd {
fi fi
} }
function reset_freebsd { function reset_freebsd() {
kldunload contigmem.ko || true kldunload contigmem.ko || true
kldunload nic_uio.ko || true kldunload nic_uio.ko || true
} }

View File

@ -195,15 +195,15 @@ else
TMP="" TMP=""
for args in $NVME_FILE; do for args in $NVME_FILE; do
while IFS=, read -r path type namespace; do while IFS=, read -r path type namespace; do
TMP+="$path,"; TMP+="$path,"
if [ -z "$type" ]; then if [ -z "$type" ]; then
type="nvme" type="nvme"
fi fi
NVME_DISKS_TYPE+="$type,"; NVME_DISKS_TYPE+="$type,"
if [ -z "$namespace" ] && [ -n "$SPDK_QEMU_EMULATOR" ]; then if [ -z "$namespace" ] && [ -n "$SPDK_QEMU_EMULATOR" ]; then
namespace="1" namespace="1"
fi fi
NVME_DISKS_NAMESPACES+="$namespace,"; NVME_DISKS_NAMESPACES+="$namespace,"
if [ ${NVME_AUTO_CREATE} = 1 ]; then if [ ${NVME_AUTO_CREATE} = 1 ]; then
$SPDK_DIR/scripts/vagrant/create_nvme_img.sh -t $type -n $path $SPDK_DIR/scripts/vagrant/create_nvme_img.sh -t $type -n $path
fi fi
@ -309,8 +309,8 @@ EOF
vagrant ssh -c 'sudo spdk_repo/spdk/scripts/vagrant/update.sh' vagrant ssh -c 'sudo spdk_repo/spdk/scripts/vagrant/update.sh'
vagrant halt vagrant halt
vagrant package --output spdk_${SPDK_VAGRANT_DISTRO}.box vagrant package --output spdk_${SPDK_VAGRANT_DISTRO}.box
vagrant box add spdk/${SPDK_VAGRANT_DISTRO} spdk_${SPDK_VAGRANT_DISTRO}.box && vagrant box add spdk/${SPDK_VAGRANT_DISTRO} spdk_${SPDK_VAGRANT_DISTRO}.box \
rm spdk_${SPDK_VAGRANT_DISTRO}.box && rm spdk_${SPDK_VAGRANT_DISTRO}.box
vagrant destroy vagrant destroy
fi fi
echo "" echo ""

View File

@ -68,7 +68,6 @@ export SPDK_DIR
export SPDK_VAGRANT_HTTP_PROXY export SPDK_VAGRANT_HTTP_PROXY
export INSTALL_DEPS export INSTALL_DEPS
shift "$((OPTIND - 1))" # Discard the options and sentinel -- shift "$((OPTIND - 1))" # Discard the options and sentinel --
SPDK_VAGRANT_DISTRO="$*" SPDK_VAGRANT_DISTRO="$*"

View File

@ -73,18 +73,23 @@ V=1
OPTIND=1 # Reset in case getopts has been used previously in the shell. OPTIND=1 # Reset in case getopts has been used previously in the shell.
while getopts "d:qhn" opt; do while getopts "d:qhn" opt; do
case "$opt" in case "$opt" in
d) SPDK_SOURCE_PATH=$($READLINK -f $OPTARG) d)
SPDK_SOURCE_PATH=$($READLINK -f $OPTARG)
echo Using SPDK source at ${SPDK_SOURCE_PATH} echo Using SPDK source at ${SPDK_SOURCE_PATH}
METHOD=1 METHOD=1
;; ;;
q) V=0 q)
V=0
;; ;;
n) NOOP=1 n)
NOOP=1
;; ;;
h) display_help >&2 h)
display_help >&2
exit 0 exit 0
;; ;;
*) echo "Invalid option" *)
echo "Invalid option"
echo "" echo ""
display_help >&2 display_help >&2
exit 1 exit 1

View File

@ -69,7 +69,8 @@ function setup_gpt_conf() {
dev=/dev/${nvme_dev##*/} dev=/dev/${nvme_dev##*/}
if ! pt=$(parted "$dev" -ms print 2>&1); then if ! pt=$(parted "$dev" -ms print 2>&1); then
[[ $pt == *"$dev: unrecognised disk label"* ]] || continue [[ $pt == *"$dev: unrecognised disk label"* ]] || continue
gpt_nvme=$dev; break gpt_nvme=$dev
break
fi fi
done done
if [[ -n $gpt_nvme ]]; then if [[ -n $gpt_nvme ]]; then
@ -78,7 +79,7 @@ function setup_gpt_conf() {
# change the GUID to SPDK GUID value # change the GUID to SPDK GUID value
# FIXME: Hardcode this in some common place, this value should not be changed much # FIXME: Hardcode this in some common place, this value should not be changed much
IFS="()" read -r _ SPDK_GPT_GUID _ < <(grep SPDK_GPT_PART_TYPE_GUID module/bdev/gpt/gpt.h) IFS="()" read -r _ SPDK_GPT_GUID _ < <(grep SPDK_GPT_PART_TYPE_GUID module/bdev/gpt/gpt.h)
SPDK_GPT_GUID=${SPDK_GPT_GUID//, /-} SPDK_GPT_GUID=${SPDK_GPT_GUID//0x} SPDK_GPT_GUID=${SPDK_GPT_GUID//, /-} SPDK_GPT_GUID=${SPDK_GPT_GUID//0x/}
sgdisk -t "1:$SPDK_GPT_GUID" "$gpt_nvme" sgdisk -t "1:$SPDK_GPT_GUID" "$gpt_nvme"
sgdisk -t "2:$SPDK_GPT_GUID" "$gpt_nvme" sgdisk -t "2:$SPDK_GPT_GUID" "$gpt_nvme"
"$rootdir/scripts/setup.sh" "$rootdir/scripts/setup.sh"
@ -227,10 +228,9 @@ function get_io_result() {
iostat_result=$(awk '{print $6}' <<< $iostat_result) iostat_result=$(awk '{print $6}' <<< $iostat_result)
fi fi
echo ${iostat_result/.*} echo ${iostat_result/.*/}
} }
function run_qos_test() { function run_qos_test() {
local qos_limit=$1 local qos_limit=$1
local qos_result=0 local qos_result=0
@ -326,19 +326,26 @@ test_type=${1:-bdev}
start_spdk_tgt start_spdk_tgt
case "$test_type" in case "$test_type" in
bdev) bdev)
setup_bdev_conf;; setup_bdev_conf
;;
nvme) nvme)
setup_nvme_conf;; setup_nvme_conf
;;
gpt) gpt)
setup_gpt_conf;; setup_gpt_conf
;;
crypto_aesni) crypto_aesni)
setup_crypto_aesni_conf;; setup_crypto_aesni_conf
;;
crypto_qat) crypto_qat)
setup_crypto_qat_conf;; setup_crypto_qat_conf
;;
pmem) pmem)
setup_pmem_conf;; setup_pmem_conf
;;
rbd) rbd)
setup_rbd_conf;; setup_rbd_conf
;;
*) *)
echo "invalid test name" echo "invalid test name"
exit 1 exit 1
@ -352,7 +359,6 @@ cat <<-CONF >"$conf_file"
]} ]}
CONF CONF
bdevs=$("$rpc_py" bdev_get_bdevs | jq -r '.[] | select(.claimed == false)') bdevs=$("$rpc_py" bdev_get_bdevs | jq -r '.[] | select(.claimed == false)')
bdevs_name=$(echo $bdevs | jq -r '.name') bdevs_name=$(echo $bdevs | jq -r '.name')
bdev_list=($bdevs_name) bdev_list=($bdevs_name)

View File

@ -28,7 +28,7 @@ function cleanup() {
rm -f $conf_file rm -f $conf_file
} }
function blobfs_start_app { function blobfs_start_app() {
$rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -c ${conf_file} & $rootdir/test/app/bdev_svc/bdev_svc -r $rpc_server -c ${conf_file} &
blobfs_pid=$! blobfs_pid=$!

View File

@ -16,8 +16,8 @@ $rootdir/scripts/gen_nvme.sh > $testdir/blobcli.conf
# generate random data file for import/export diff # generate random data file for import/export diff
dd if=/dev/urandom of=$testdir/test.pattern bs=1M count=1 dd if=/dev/urandom of=$testdir/test.pattern bs=1M count=1
(cd $testdir && (cd $testdir \
$rootdir/examples/blob/cli/blobcli -c $testdir/blobcli.conf -b Nvme0n1 -T $testdir/test.bs > $testdir/btest.out) && $rootdir/examples/blob/cli/blobcli -c $testdir/blobcli.conf -b Nvme0n1 -T $testdir/test.bs > $testdir/btest.out)
# the test script will import the test pattern generated by dd and then export # the test script will import the test pattern generated by dd and then export
# it to a file so we can compare and confirm basic read and write # it to a file so we can compare and confirm basic read and write

View File

@ -39,8 +39,7 @@ function xtrace_enable() {
# Keep it as alias to avoid xtrace_enable backtrace always pointing to xtrace_restore. # Keep it as alias to avoid xtrace_enable backtrace always pointing to xtrace_restore.
# xtrace_enable will appear as called directly from the user script, from the same line # xtrace_enable will appear as called directly from the user script, from the same line
# that "called" xtrace_restore. # that "called" xtrace_restore.
alias xtrace_restore=\ alias xtrace_restore='if [ -z $XTRACE_NESTING_LEVEL ]; then
'if [ -z $XTRACE_NESTING_LEVEL ]; then
if [[ "$PREV_BASH_OPTS" == *"x"* ]]; then if [[ "$PREV_BASH_OPTS" == *"x"* ]]; then
XTRACE_DISABLED="no"; PREV_BASH_OPTS=""; set -x; xtrace_enable; XTRACE_DISABLED="no"; PREV_BASH_OPTS=""; set -x; xtrace_enable;
fi fi
@ -55,42 +54,78 @@ fi'
export RUN_NIGHTLY export RUN_NIGHTLY
# Set defaults for missing test config options # Set defaults for missing test config options
: ${SPDK_AUTOTEST_DEBUG_APPS:=0}; export SPDK_AUTOTEST_DEBUG_APPS : ${SPDK_AUTOTEST_DEBUG_APPS:=0}
: ${SPDK_RUN_VALGRIND=0}; export SPDK_RUN_VALGRIND export SPDK_AUTOTEST_DEBUG_APPS
: ${SPDK_RUN_FUNCTIONAL_TEST=0}; export SPDK_RUN_FUNCTIONAL_TEST : ${SPDK_RUN_VALGRIND=0}
: ${SPDK_TEST_UNITTEST=0}; export SPDK_TEST_UNITTEST export SPDK_RUN_VALGRIND
: ${SPDK_TEST_AUTOBUILD=0}; export SPDK_TEST_AUTOBUILD : ${SPDK_RUN_FUNCTIONAL_TEST=0}
: ${SPDK_TEST_ISAL=0}; export SPDK_TEST_ISAL export SPDK_RUN_FUNCTIONAL_TEST
: ${SPDK_TEST_ISCSI=0}; export SPDK_TEST_ISCSI : ${SPDK_TEST_UNITTEST=0}
: ${SPDK_TEST_ISCSI_INITIATOR=0}; export SPDK_TEST_ISCSI_INITIATOR export SPDK_TEST_UNITTEST
: ${SPDK_TEST_NVME=0}; export SPDK_TEST_NVME : ${SPDK_TEST_AUTOBUILD=0}
: ${SPDK_TEST_NVME_CLI=0}; export SPDK_TEST_NVME_CLI export SPDK_TEST_AUTOBUILD
: ${SPDK_TEST_NVME_CUSE=0}; export SPDK_TEST_NVME_CUSE : ${SPDK_TEST_ISAL=0}
: ${SPDK_TEST_NVMF=0}; export SPDK_TEST_NVMF export SPDK_TEST_ISAL
: ${SPDK_TEST_NVMF_TRANSPORT="rdma"}; export SPDK_TEST_NVMF_TRANSPORT : ${SPDK_TEST_ISCSI=0}
: ${SPDK_TEST_RBD=0}; export SPDK_TEST_RBD export SPDK_TEST_ISCSI
: ${SPDK_TEST_VHOST=0}; export SPDK_TEST_VHOST : ${SPDK_TEST_ISCSI_INITIATOR=0}
: ${SPDK_TEST_BLOCKDEV=0}; export SPDK_TEST_BLOCKDEV export SPDK_TEST_ISCSI_INITIATOR
: ${SPDK_TEST_IOAT=0}; export SPDK_TEST_IOAT : ${SPDK_TEST_NVME=0}
: ${SPDK_TEST_BLOBFS=0}; export SPDK_TEST_BLOBFS export SPDK_TEST_NVME
: ${SPDK_TEST_VHOST_INIT=0}; export SPDK_TEST_VHOST_INIT : ${SPDK_TEST_NVME_CLI=0}
: ${SPDK_TEST_PMDK=0}; export SPDK_TEST_PMDK export SPDK_TEST_NVME_CLI
: ${SPDK_TEST_LVOL=0}; export SPDK_TEST_LVOL : ${SPDK_TEST_NVME_CUSE=0}
: ${SPDK_TEST_JSON=0}; export SPDK_TEST_JSON export SPDK_TEST_NVME_CUSE
: ${SPDK_TEST_REDUCE=0}; export SPDK_TEST_REDUCE : ${SPDK_TEST_NVMF=0}
: ${SPDK_TEST_VPP=0}; export SPDK_TEST_VPP export SPDK_TEST_NVMF
: ${SPDK_RUN_ASAN=0}; export SPDK_RUN_ASAN : ${SPDK_TEST_NVMF_TRANSPORT="rdma"}
: ${SPDK_RUN_UBSAN=0}; export SPDK_RUN_UBSAN export SPDK_TEST_NVMF_TRANSPORT
: ${SPDK_RUN_INSTALLED_DPDK=0}; export SPDK_RUN_INSTALLED_DPDK : ${SPDK_TEST_RBD=0}
: ${SPDK_RUN_NON_ROOT=0}; export SPDK_RUN_NON_ROOT export SPDK_TEST_RBD
: ${SPDK_TEST_CRYPTO=0}; export SPDK_TEST_CRYPTO : ${SPDK_TEST_VHOST=0}
: ${SPDK_TEST_FTL=0}; export SPDK_TEST_FTL export SPDK_TEST_VHOST
: ${SPDK_TEST_OCF=0}; export SPDK_TEST_OCF : ${SPDK_TEST_BLOCKDEV=0}
: ${SPDK_TEST_FTL_EXTENDED=0}; export SPDK_TEST_FTL_EXTENDED export SPDK_TEST_BLOCKDEV
: ${SPDK_TEST_VMD=0}; export SPDK_TEST_VMD : ${SPDK_TEST_IOAT=0}
: ${SPDK_TEST_OPAL=0}; export SPDK_TEST_OPAL export SPDK_TEST_IOAT
: ${SPDK_AUTOTEST_X=true}; export SPDK_AUTOTEST_X : ${SPDK_TEST_BLOBFS=0}
: ${SPDK_TEST_RAID5=0}; export SPDK_TEST_RAID5 export SPDK_TEST_BLOBFS
: ${SPDK_TEST_VHOST_INIT=0}
export SPDK_TEST_VHOST_INIT
: ${SPDK_TEST_PMDK=0}
export SPDK_TEST_PMDK
: ${SPDK_TEST_LVOL=0}
export SPDK_TEST_LVOL
: ${SPDK_TEST_JSON=0}
export SPDK_TEST_JSON
: ${SPDK_TEST_REDUCE=0}
export SPDK_TEST_REDUCE
: ${SPDK_TEST_VPP=0}
export SPDK_TEST_VPP
: ${SPDK_RUN_ASAN=0}
export SPDK_RUN_ASAN
: ${SPDK_RUN_UBSAN=0}
export SPDK_RUN_UBSAN
: ${SPDK_RUN_INSTALLED_DPDK=0}
export SPDK_RUN_INSTALLED_DPDK
: ${SPDK_RUN_NON_ROOT=0}
export SPDK_RUN_NON_ROOT
: ${SPDK_TEST_CRYPTO=0}
export SPDK_TEST_CRYPTO
: ${SPDK_TEST_FTL=0}
export SPDK_TEST_FTL
: ${SPDK_TEST_OCF=0}
export SPDK_TEST_OCF
: ${SPDK_TEST_FTL_EXTENDED=0}
export SPDK_TEST_FTL_EXTENDED
: ${SPDK_TEST_VMD=0}
export SPDK_TEST_VMD
: ${SPDK_TEST_OPAL=0}
export SPDK_TEST_OPAL
: ${SPDK_AUTOTEST_X=true}
export SPDK_AUTOTEST_X
: ${SPDK_TEST_RAID5=0}
export SPDK_TEST_RAID5
# Export PYTHONPATH with addition of RPC framework. New scripts can be created # Export PYTHONPATH with addition of RPC framework. New scripts can be created
# specific use cases for tests. # specific use cases for tests.
@ -211,8 +246,8 @@ function get_config_params() {
xtrace_disable xtrace_disable
config_params='--enable-debug --enable-werror' config_params='--enable-debug --enable-werror'
if echo -e "#include <libunwind.h>\nint main(int argc, char *argv[]) {return 0;}\n" | \ if echo -e "#include <libunwind.h>\nint main(int argc, char *argv[]) {return 0;}\n" \
gcc -o /dev/null -lunwind -x c - 2>/dev/null; then | gcc -o /dev/null -lunwind -x c - 2> /dev/null; then
config_params+=' --enable-log-bt' config_params+=' --enable-log-bt'
fi fi
@ -439,8 +474,8 @@ function create_test_list() {
# Follow up with search in test directory recursively. # Follow up with search in test directory recursively.
completion+=$(grep -rshI --include="*.sh" --exclude="autotest_common.sh" -e "run_test " $rootdir/test) completion+=$(grep -rshI --include="*.sh" --exclude="autotest_common.sh" -e "run_test " $rootdir/test)
printf "%s" "$completion" | grep -v "#" \ printf "%s" "$completion" | grep -v "#" \
| sed 's/^.*run_test/run_test/' | awk '{print $2}' | \ | sed 's/^.*run_test/run_test/' | awk '{print $2}' \
sed 's/\"//g' | sort > $output_dir/all_tests.txt || true | sed 's/\"//g' | sort > $output_dir/all_tests.txt || true
xtrace_restore xtrace_restore
} }
@ -464,8 +499,7 @@ function gdb_attach() {
function process_core() { function process_core() {
ret=0 ret=0
while IFS= read -r -d '' core; while IFS= read -r -d '' core; do
do
exe=$(eu-readelf -n "$core" | grep psargs | sed "s/.*psargs: \([^ \'\" ]*\).*/\1/") exe=$(eu-readelf -n "$core" | grep psargs | sed "s/.*psargs: \([^ \'\" ]*\).*/\1/")
if [[ ! -f "$exe" ]]; then if [[ ! -f "$exe" ]]; then
exe=$(eu-readelf -n "$core" | grep -oP -m1 "$exe.+") exe=$(eu-readelf -n "$core" | grep -oP -m1 "$exe.+")
@ -811,8 +845,8 @@ function print_backtrace() {
local bt="" cmdline=() local bt="" cmdline=()
if [[ -f $src ]]; then if [[ -f $src ]]; then
bt=$(nl -w 4 -ba -nln $src | grep -B 5 -A 5 "^${line_nr}[^0-9]" | \ bt=$(nl -w 4 -ba -nln $src | grep -B 5 -A 5 "^${line_nr}[^0-9]" \
sed "s/^/ /g" | sed "s/^ $line_nr /=> $line_nr /g") | sed "s/^/ /g" | sed "s/^ $line_nr /=> $line_nr /g")
fi fi
# If extdebug set the BASH_ARGC[i], try to fetch all the args # If extdebug set the BASH_ARGC[i], try to fetch all the args
@ -825,7 +859,10 @@ function print_backtrace() {
args=("${args[@]:BASH_ARGC[i]}") args=("${args[@]:BASH_ARGC[i]}")
fi fi
echo "in $src:$line_nr -> $func($(IFS=","; printf '%s\n' "${cmdline[*]:-[]}"))" echo "in $src:$line_nr -> $func($(
IFS=","
printf '%s\n' "${cmdline[*]:-[]}"
))"
echo " ..." echo " ..."
echo "${bt:-backtrace unavailable}" echo "${bt:-backtrace unavailable}"
echo " ..." echo " ..."
@ -836,8 +873,7 @@ function print_backtrace() {
return 0 return 0
} }
function discover_bdevs() function discover_bdevs() {
{
local rootdir=$1 local rootdir=$1
local config_file=$2 local config_file=$2
local cfg_type=$3 local cfg_type=$3
@ -873,8 +909,7 @@ function discover_bdevs()
rm -f /var/run/spdk_bdev0 rm -f /var/run/spdk_bdev0
} }
function waitforserial() function waitforserial() {
{
local i=0 local i=0
local nvme_device_counter=1 local nvme_device_counter=1
if [[ -n "$2" ]]; then if [[ -n "$2" ]]; then
@ -895,8 +930,7 @@ function waitforserial()
return 0 return 0
} }
function waitforserial_disconnect() function waitforserial_disconnect() {
{
local i=0 local i=0
while lsblk -o NAME,SERIAL | grep -q -w $1; do while lsblk -o NAME,SERIAL | grep -q -w $1; do
[ $i -lt 15 ] || break [ $i -lt 15 ] || break
@ -912,8 +946,7 @@ function waitforserial_disconnect()
return 0 return 0
} }
function waitforblk() function waitforblk() {
{
local i=0 local i=0
while ! lsblk -l -o NAME | grep -q -w $1; do while ! lsblk -l -o NAME | grep -q -w $1; do
[ $i -lt 15 ] || break [ $i -lt 15 ] || break
@ -928,8 +961,7 @@ function waitforblk()
return 0 return 0
} }
function waitforblk_disconnect() function waitforblk_disconnect() {
{
local i=0 local i=0
while lsblk -l -o NAME | grep -q -w $1; do while lsblk -l -o NAME | grep -q -w $1; do
[ $i -lt 15 ] || break [ $i -lt 15 ] || break
@ -944,8 +976,7 @@ function waitforblk_disconnect()
return 0 return 0
} }
function waitforfile() function waitforfile() {
{
local i=0 local i=0
while [ ! -e $1 ]; do while [ ! -e $1 ]; do
[ $i -lt 200 ] || break [ $i -lt 200 ] || break
@ -960,8 +991,7 @@ function waitforfile()
return 0 return 0
} }
function fio_config_gen() function fio_config_gen() {
{
local config_file=$1 local config_file=$1
local workload=$2 local workload=$2
local bdev_type=$3 local bdev_type=$3
@ -1011,8 +1041,7 @@ EOL
fi fi
} }
function fio_bdev() function fio_bdev() {
{
# Setup fio binary cmd line # Setup fio binary cmd line
local fio_dir=$CONFIG_FIO_SOURCE_DIR local fio_dir=$CONFIG_FIO_SOURCE_DIR
local bdev_plugin="$rootdir/examples/bdev/fio_plugin/fio_plugin" local bdev_plugin="$rootdir/examples/bdev/fio_plugin/fio_plugin"
@ -1024,8 +1053,7 @@ function fio_bdev()
LD_PRELOAD="$asan_lib $bdev_plugin" "$fio_dir"/fio "$@" LD_PRELOAD="$asan_lib $bdev_plugin" "$fio_dir"/fio "$@"
} }
function fio_nvme() function fio_nvme() {
{
# Setup fio binary cmd line # Setup fio binary cmd line
local fio_dir=$CONFIG_FIO_SOURCE_DIR local fio_dir=$CONFIG_FIO_SOURCE_DIR
local nvme_plugin="$rootdir/examples/nvme/fio_plugin/fio_plugin" local nvme_plugin="$rootdir/examples/nvme/fio_plugin/fio_plugin"
@ -1036,8 +1064,7 @@ function fio_nvme()
LD_PRELOAD="$asan_lib $nvme_plugin" "$fio_dir"/fio "$@" LD_PRELOAD="$asan_lib $nvme_plugin" "$fio_dir"/fio "$@"
} }
function get_lvs_free_mb() function get_lvs_free_mb() {
{
local lvs_uuid=$1 local lvs_uuid=$1
local lvs_info local lvs_info
local fc local fc
@ -1051,8 +1078,7 @@ function get_lvs_free_mb()
echo "$free_mb" echo "$free_mb"
} }
function get_bdev_size() function get_bdev_size() {
{
local bdev_name=$1 local bdev_name=$1
local bdev_info local bdev_info
local bs local bs
@ -1066,8 +1092,7 @@ function get_bdev_size()
echo "$bdev_size" echo "$bdev_size"
} }
function autotest_cleanup() function autotest_cleanup() {
{
$rootdir/scripts/setup.sh reset $rootdir/scripts/setup.sh reset
$rootdir/scripts/setup.sh cleanup $rootdir/scripts/setup.sh cleanup
if [ $(uname -s) = "Linux" ]; then if [ $(uname -s) = "Linux" ]; then
@ -1080,8 +1105,7 @@ function autotest_cleanup()
rm -rf "$asan_suppression_file" rm -rf "$asan_suppression_file"
} }
function freebsd_update_contigmem_mod() function freebsd_update_contigmem_mod() {
{
if [ $(uname) = FreeBSD ]; then if [ $(uname) = FreeBSD ]; then
kldunload contigmem.ko || true kldunload contigmem.ko || true
if [ -n "$WITH_DPDK_DIR" ]; then if [ -n "$WITH_DPDK_DIR" ]; then
@ -1099,7 +1123,7 @@ function freebsd_update_contigmem_mod()
fi fi
} }
function get_nvme_name_from_bdf { function get_nvme_name_from_bdf() {
blkname=() blkname=()
nvme_devs=$(lsblk -d --output NAME | grep "^nvme") || true nvme_devs=$(lsblk -d --output NAME | grep "^nvme") || true
@ -1120,7 +1144,7 @@ function get_nvme_name_from_bdf {
printf '%s\n' "${blkname[@]}" printf '%s\n' "${blkname[@]}"
} }
function opal_revert_cleanup { function opal_revert_cleanup() {
$rootdir/app/spdk_tgt/spdk_tgt & $rootdir/app/spdk_tgt/spdk_tgt &
spdk_tgt_pid=$! spdk_tgt_pid=$!
waitforlisten $spdk_tgt_pid waitforlisten $spdk_tgt_pid

View File

@ -37,8 +37,7 @@ else
PACKAGEMNG='undefined' PACKAGEMNG='undefined'
fi fi
function install_rxe_cfg() function install_rxe_cfg() {
{
if echo $CONF | grep -q librxe; then if echo $CONF | grep -q librxe; then
# rxe_cfg is used in the NVMe-oF tests # rxe_cfg is used in the NVMe-oF tests
# The librxe-dev repository provides a command line tool called rxe_cfg which makes it # The librxe-dev repository provides a command line tool called rxe_cfg which makes it
@ -60,8 +59,7 @@ function install_rxe_cfg()
fi fi
} }
function install_iscsi_adm() function install_iscsi_adm() {
{
if echo $CONF | grep -q iscsi; then if echo $CONF | grep -q iscsi; then
# iscsiadm is used in the iscsi_tgt tests # iscsiadm is used in the iscsi_tgt tests
# The version of iscsiadm that ships with fedora 26 was broken as of November 3 2017. # The version of iscsiadm that ships with fedora 26 was broken as of November 3 2017.
@ -95,8 +93,7 @@ function install_iscsi_adm()
fi fi
} }
function install_qat() function install_qat() {
{
if [ "$PACKAGEMNG" = "dnf" ]; then if [ "$PACKAGEMNG" = "dnf" ]; then
sudo dnf install -y libudev-devel sudo dnf install -y libudev-devel
@ -136,8 +133,7 @@ function install_qat()
fi fi
} }
function install_rocksdb() function install_rocksdb() {
{
if echo $CONF | grep -q rocksdb; then if echo $CONF | grep -q rocksdb; then
# Rocksdb is installed for use with the blobfs tests. # Rocksdb is installed for use with the blobfs tests.
if [ ! -d /usr/src/rocksdb ]; then if [ ! -d /usr/src/rocksdb ]; then
@ -151,8 +147,7 @@ function install_rocksdb()
fi fi
} }
function install_fio() function install_fio() {
{
if echo $CONF | grep -q fio; then if echo $CONF | grep -q fio; then
# This version of fio is installed in /usr/src/fio to enable # This version of fio is installed in /usr/src/fio to enable
# building the spdk fio plugin. # building the spdk fio plugin.
@ -166,15 +161,15 @@ function install_fio()
sudo mv fio /usr/src/ sudo mv fio /usr/src/
fi fi
( (
git -C /usr/src/fio checkout master && git -C /usr/src/fio checkout master \
git -C /usr/src/fio pull && && git -C /usr/src/fio pull \
git -C /usr/src/fio checkout $fio_version && && git -C /usr/src/fio checkout $fio_version \
if [ $OSID == 'freebsd' ]; then && if [ $OSID == 'freebsd' ]; then
gmake -C /usr/src/fio -j${jobs} && gmake -C /usr/src/fio -j${jobs} \
sudo gmake -C /usr/src/fio install && sudo gmake -C /usr/src/fio install
else else
make -C /usr/src/fio -j${jobs} && make -C /usr/src/fio -j${jobs} \
sudo make -C /usr/src/fio install && sudo make -C /usr/src/fio install
fi fi
) )
else else
@ -183,8 +178,7 @@ function install_fio()
fi fi
} }
function install_flamegraph() function install_flamegraph() {
{
if echo $CONF | grep -q flamegraph; then if echo $CONF | grep -q flamegraph; then
# Flamegraph is used when printing out timing graphs for the tests. # Flamegraph is used when printing out timing graphs for the tests.
if [ ! -d /usr/local/FlameGraph ]; then if [ ! -d /usr/local/FlameGraph ]; then
@ -197,8 +191,7 @@ function install_flamegraph()
fi fi
} }
function install_qemu() function install_qemu() {
{
if echo $CONF | grep -q qemu; then if echo $CONF | grep -q qemu; then
# Two versions of QEMU are used in the tests. # Two versions of QEMU are used in the tests.
# Stock QEMU is used for vhost. A special fork # Stock QEMU is used for vhost. A special fork
@ -249,8 +242,7 @@ function install_qemu()
fi fi
} }
function install_vpp() function install_vpp() {
{
if echo $CONF | grep -q vpp; then if echo $CONF | grep -q vpp; then
if [ -d /usr/local/src/vpp ]; then if [ -d /usr/local/src/vpp ]; then
echo "vpp already cloned." echo "vpp already cloned."
@ -282,8 +274,7 @@ function install_vpp()
fi fi
} }
function install_nvmecli() function install_nvmecli() {
{
if echo $CONF | grep -q nvmecli; then if echo $CONF | grep -q nvmecli; then
SPDK_NVME_CLI_BRANCH=spdk-1.6 SPDK_NVME_CLI_BRANCH=spdk-1.6
if [ ! -d nvme-cli ]; then if [ ! -d nvme-cli ]; then
@ -300,9 +291,7 @@ function install_nvmecli()
fi fi
} }
function install_libiscsi() {
function install_libiscsi()
{
if echo $CONF | grep -q libiscsi; then if echo $CONF | grep -q libiscsi; then
# We currently don't make any changes to the libiscsi repository for our tests, but it is possible that we will need # We currently don't make any changes to the libiscsi repository for our tests, but it is possible that we will need
# to later. Cloning from git is just future proofing the machines. # to later. Cloning from git is just future proofing the machines.
@ -320,16 +309,15 @@ function install_libiscsi()
function install_git() { function install_git() {
sudo yum install -y zlib-devel curl-devel sudo yum install -y zlib-devel curl-devel
tar -xzof <(wget -qO- "$GIT_REPO_GIT") tar -xzof <(wget -qO- "$GIT_REPO_GIT")
(cd git-${GIT_VERSION} && \ (cd git-${GIT_VERSION} \
make configure && \ && make configure \
./configure --prefix=/usr/local/git && \ && ./configure --prefix=/usr/local/git \
sudo make -j${jobs} install) && sudo make -j${jobs} install)
sudo sh -c "echo 'export PATH=/usr/local/git/bin:$PATH' >> /etc/bashrc" sudo sh -c "echo 'export PATH=/usr/local/git/bin:$PATH' >> /etc/bashrc"
exec $SHELL exec $SHELL
} }
function usage() function usage() {
{
echo "This script is intended to automate the environment setup for a linux virtual machine." echo "This script is intended to automate the environment setup for a linux virtual machine."
echo "Please run this script as your regular user. The script will make calls to sudo as needed." echo "Please run this script as your regular user. The script will make calls to sudo as needed."
echo "" echo ""
@ -374,8 +362,10 @@ while getopts 'iuht:c:-:' optchar; do
install-deps) INSTALL=true ;; install-deps) INSTALL=true ;;
test-conf=*) CONF="${OPTARG#*=}" ;; test-conf=*) CONF="${OPTARG#*=}" ;;
conf-path=*) CONF_PATH="${OPTARG#*=}" ;; conf-path=*) CONF_PATH="${OPTARG#*=}" ;;
*) echo "Invalid argument '$OPTARG'" *)
usage;; echo "Invalid argument '$OPTARG'"
usage
;;
esac esac
;; ;;
h) usage ;; h) usage ;;
@ -383,8 +373,10 @@ while getopts 'iuht:c:-:' optchar; do
i) INSTALL=true ;; i) INSTALL=true ;;
t) CONF="$OPTARG" ;; t) CONF="$OPTARG" ;;
c) CONF_PATH="$OPTARG" ;; c) CONF_PATH="$OPTARG" ;;
*) echo "Invalid argument '$OPTARG'" *)
usage;; echo "Invalid argument '$OPTARG'"
usage
;;
esac esac
done done
@ -399,20 +391,34 @@ fi
cd ~ cd ~
GIT_VERSION=2.25.1 GIT_VERSION=2.25.1
: ${GIT_REPO_SPDK=https://github.com/spdk/spdk.git}; export GIT_REPO_SPDK : ${GIT_REPO_SPDK=https://github.com/spdk/spdk.git}
: ${GIT_REPO_DPDK=https://github.com/spdk/dpdk.git}; export GIT_REPO_DPDK export GIT_REPO_SPDK
: ${GIT_REPO_LIBRXE=https://github.com/SoftRoCE/librxe-dev.git}; export GIT_REPO_LIBRXE : ${GIT_REPO_DPDK=https://github.com/spdk/dpdk.git}
: ${GIT_REPO_OPEN_ISCSI=https://github.com/open-iscsi/open-iscsi}; export GIT_REPO_OPEN_ISCSI export GIT_REPO_DPDK
: ${GIT_REPO_ROCKSDB=https://review.spdk.io/spdk/rocksdb}; export GIT_REPO_ROCKSDB : ${GIT_REPO_LIBRXE=https://github.com/SoftRoCE/librxe-dev.git}
: ${GIT_REPO_FIO=http://git.kernel.dk/fio.git}; export GIT_REPO_FIO export GIT_REPO_LIBRXE
: ${GIT_REPO_FLAMEGRAPH=https://github.com/brendangregg/FlameGraph.git}; export GIT_REPO_FLAMEGRAPH : ${GIT_REPO_OPEN_ISCSI=https://github.com/open-iscsi/open-iscsi}
: ${GIT_REPO_QEMU=https://github.com/spdk/qemu}; export GIT_REPO_QEMU export GIT_REPO_OPEN_ISCSI
: ${GIT_REPO_VPP=https://gerrit.fd.io/r/vpp}; export GIT_REPO_VPP : ${GIT_REPO_ROCKSDB=https://review.spdk.io/spdk/rocksdb}
: ${GIT_REPO_LIBISCSI=https://github.com/sahlberg/libiscsi}; export GIT_REPO_LIBISCSI export GIT_REPO_ROCKSDB
: ${GIT_REPO_SPDK_NVME_CLI=https://github.com/spdk/nvme-cli}; export GIT_REPO_SPDK_NVME_CLI : ${GIT_REPO_FIO=http://git.kernel.dk/fio.git}
: ${GIT_REPO_INTEL_IPSEC_MB=https://github.com/spdk/intel-ipsec-mb.git}; export GIT_REPO_INTEL_IPSEC_MB export GIT_REPO_FIO
: ${DRIVER_LOCATION_QAT=https://01.org/sites/default/files/downloads//qat1.7.l.4.9.0-00008.tar.gz}; export DRIVER_LOCATION_QAT : ${GIT_REPO_FLAMEGRAPH=https://github.com/brendangregg/FlameGraph.git}
: ${GIT_REPO_GIT=https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz}; export GIT_REPO_GIT export GIT_REPO_FLAMEGRAPH
: ${GIT_REPO_QEMU=https://github.com/spdk/qemu}
export GIT_REPO_QEMU
: ${GIT_REPO_VPP=https://gerrit.fd.io/r/vpp}
export GIT_REPO_VPP
: ${GIT_REPO_LIBISCSI=https://github.com/sahlberg/libiscsi}
export GIT_REPO_LIBISCSI
: ${GIT_REPO_SPDK_NVME_CLI=https://github.com/spdk/nvme-cli}
export GIT_REPO_SPDK_NVME_CLI
: ${GIT_REPO_INTEL_IPSEC_MB=https://github.com/spdk/intel-ipsec-mb.git}
export GIT_REPO_INTEL_IPSEC_MB
: ${DRIVER_LOCATION_QAT=https://01.org/sites/default/files/downloads//qat1.7.l.4.9.0-00008.tar.gz}
export DRIVER_LOCATION_QAT
: ${GIT_REPO_GIT=https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz}
export GIT_REPO_GIT
if [ $PACKAGEMNG == 'pkg' ]; then if [ $PACKAGEMNG == 'pkg' ]; then
jobs=$(($(sysctl -n hw.ncpu) * 2)) jobs=$(($(sysctl -n hw.ncpu) * 2))
@ -474,8 +480,7 @@ if $INSTALL; then
libtool \ libtool \
libmount-devel \ libmount-devel \
iscsi-initiator-utils \ iscsi-initiator-utils \
isns-utils-devel\ isns-utils-devel pmempool \
pmempool \
perl-open \ perl-open \
glib2-devel \ glib2-devel \
pixman-devel \ pixman-devel \

View File

@ -64,9 +64,11 @@ function run_bdevperf() {
test_type=$1 test_type=$1
case "$test_type" in case "$test_type" in
qat) qat)
pmd=1;; pmd=1
;;
isal) isal)
pmd=2;; pmd=2
;;
*) *)
echo "invalid pmd name" echo "invalid pmd name"
exit 1 exit 1

View File

@ -10,7 +10,7 @@ device=$1
use_append=$2 use_append=$2
rpc_py=$rootdir/scripts/rpc.py rpc_py=$rootdir/scripts/rpc.py
for (( i=0; i<${#tests[@]}; i++ )) do for ((i = 0; i < ${#tests[@]}; i++)); do
timing_enter "${tests[$i]}" timing_enter "${tests[$i]}"
"$rootdir/test/bdev/bdevperf/bdevperf" -z -T ftl0 ${tests[$i]} --json <(gen_ftl_nvme_conf) & "$rootdir/test/bdev/bdevperf/bdevperf" -z -T ftl0 ${tests[$i]} --json <(gen_ftl_nvme_conf) &
bdevperf_pid=$! bdevperf_pid=$!

View File

@ -1,24 +1,24 @@
# Common utility functions to be sourced by the libftl test scripts # Common utility functions to be sourced by the libftl test scripts
function get_chunk_size() { function get_chunk_size() {
$rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" | $rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" \
grep 'Logical blks per chunk' | sed 's/[^0-9]//g' | grep 'Logical blks per chunk' | sed 's/[^0-9]//g'
} }
function get_num_group() { function get_num_group() {
$rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" | $rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" \
grep 'Groups' | sed 's/[^0-9]//g' | grep 'Groups' | sed 's/[^0-9]//g'
} }
function get_num_pu() { function get_num_pu() {
$rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" | $rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" \
grep 'PUs' | sed 's/[^0-9]//g' | grep 'PUs' | sed 's/[^0-9]//g'
} }
function has_separate_md() { function has_separate_md() {
local md_type local md_type
md_type=$($rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" | \ md_type=$($rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:$1" \
grep 'Metadata Transferred' | cut -d: -f2) | grep 'Metadata Transferred' | cut -d: -f2)
if [[ "$md_type" =~ Separate ]]; then if [[ "$md_type" =~ Separate ]]; then
return 0 return 0
else else

View File

@ -37,7 +37,8 @@ pu_count=$((num_group * num_pu))
# Write one band worth of data + one extra chunk # Write one band worth of data + one extra chunk
data_size=$((chunk_size * (pu_count + 1))) data_size=$((chunk_size * (pu_count + 1)))
"$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) & svcpid=$! "$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) &
svcpid=$!
waitforlisten $svcpid waitforlisten $svcpid
if [ -n "$nv_cache" ]; then if [ -n "$nv_cache" ]; then
@ -69,7 +70,8 @@ $rpc_py nbd_stop_disk /dev/nbd0
kill -9 $svcpid kill -9 $svcpid
rm -f /dev/shm/spdk_tgt_trace.pid$svcpid rm -f /dev/shm/spdk_tgt_trace.pid$svcpid
"$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) -L ftl_init & svcpid=$! "$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) -L ftl_init &
svcpid=$!
waitforlisten $svcpid waitforlisten $svcpid
$rpc_py load_config < $testdir/config/ftl.json $rpc_py load_config < $testdir/config/ftl.json

View File

@ -35,7 +35,8 @@ export FTL_JSON_CONF=$testdir/config/ftl.json
trap "fio_kill; exit 1" SIGINT SIGTERM EXIT trap "fio_kill; exit 1" SIGINT SIGTERM EXIT
"$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) & svcpid=$! "$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) &
svcpid=$!
waitforlisten $svcpid waitforlisten $svcpid
$rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie $rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie
@ -50,7 +51,7 @@ fi
waitforbdev ftl0 waitforbdev ftl0
( (
echo '{"subsystems": ['; echo '{"subsystems": ['
$rpc_py save_subsystem_config -n bdev $rpc_py save_subsystem_config -n bdev
echo ']}' echo ']}'
) > $FTL_JSON_CONF ) > $FTL_JSON_CONF

View File

@ -62,7 +62,8 @@ run_test "ftl_json" $testdir/json.sh $device
if [ $SPDK_TEST_FTL_EXTENDED -eq 1 ]; then if [ $SPDK_TEST_FTL_EXTENDED -eq 1 ]; then
run_test "ftl_fio_basic" $testdir/fio.sh $device basic run_test "ftl_fio_basic" $testdir/fio.sh $device basic
"$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) & svcpid=$! "$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) &
svcpid=$!
trap 'killprocess $svcpid; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $svcpid; exit 1' SIGINT SIGTERM EXIT

View File

@ -15,7 +15,8 @@ json_kill() {
trap "json_kill; exit 1" SIGINT SIGTERM EXIT trap "json_kill; exit 1" SIGINT SIGTERM EXIT
"$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) & svcpid=$! "$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) &
svcpid=$!
waitforlisten $svcpid waitforlisten $svcpid
# Create new bdev from json configuration # Create new bdev from json configuration

View File

@ -37,7 +37,8 @@ restore_kill() {
trap "restore_kill; exit 1" SIGINT SIGTERM EXIT trap "restore_kill; exit 1" SIGINT SIGTERM EXIT
"$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) & svcpid=$! "$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) &
svcpid=$!
# Wait until spdk_tgt starts # Wait until spdk_tgt starts
waitforlisten $svcpid waitforlisten $svcpid
@ -73,7 +74,8 @@ md5sum $mount_dir/testfile > $testdir/testfile.md5
umount $mount_dir umount $mount_dir
killprocess $svcpid killprocess $svcpid
"$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) -L ftl_init & svcpid=$! "$rootdir/app/spdk_tgt/spdk_tgt" --json <(gen_ftl_nvme_conf) -L ftl_init &
svcpid=$!
# Wait until spdk_tgt starts # Wait until spdk_tgt starts
waitforlisten $svcpid waitforlisten $svcpid

View File

@ -33,6 +33,7 @@ for i in "$@"; do
case "$i" in case "$i" in
--timeout=*) --timeout=*)
TEST_TIMEOUT="${i#*=}" TEST_TIMEOUT="${i#*=}"
;;
esac esac
done done

View File

@ -14,6 +14,7 @@ for i in "$@"; do
case "$i" in case "$i" in
--timeout=*) --timeout=*)
TEST_TIMEOUT="${i#*=}" TEST_TIMEOUT="${i#*=}"
;;
esac esac
done done

View File

@ -19,6 +19,7 @@ for i in "$@"; do
case "$i" in case "$i" in
--timeout=*) --timeout=*)
TEST_TIMEOUT="${i#*=}" TEST_TIMEOUT="${i#*=}"
;;
esac esac
done done

View File

@ -75,7 +75,7 @@ parted -s /dev/$dev mklabel msdos
parted -s /dev/$dev mkpart primary '0%' '100%' parted -s /dev/$dev mkpart primary '0%' '100%'
sleep 1 sleep 1
function filesystem_test { function filesystem_test() {
fstype=$1 fstype=$1
make_filesystem ${fstype} /dev/${dev}1 make_filesystem ${fstype} /dev/${dev}1

View File

@ -131,7 +131,6 @@ $rpc_py bdev_malloc_delete ${bdev}
fio_status=0 fio_status=0
wait $fio_pid || fio_status=$? wait $fio_pid || fio_status=$?
if [ $fio_status -eq 0 ]; then if [ $fio_status -eq 0 ]; then
echo "iscsi hotplug test: fio successful - expected failure" echo "iscsi hotplug test: fio successful - expected failure"
exit 1 exit 1

View File

@ -47,12 +47,12 @@ function rpc_validate_ip() {
echo "Add new IP succeeded." echo "Add new IP succeeded."
else else
echo "Add new IP failed. Expected to succeed..." echo "Add new IP failed. Expected to succeed..."
exit 1; exit 1
fi fi
# Add same IP again # Add same IP again
if $cmd; then if $cmd; then
echo "Same IP existed. Expected to fail..." echo "Same IP existed. Expected to fail..."
exit 1; exit 1
fi fi
cmd="$rpc_py -s $1 net_interface_delete_ip_address 1 $MIGRATION_ADDRESS" cmd="$rpc_py -s $1 net_interface_delete_ip_address 1 $MIGRATION_ADDRESS"
@ -60,12 +60,12 @@ function rpc_validate_ip() {
echo "Delete existing IP succeeded." echo "Delete existing IP succeeded."
else else
echo "Delete existing IP failed. Expected to succeed..." echo "Delete existing IP failed. Expected to succeed..."
exit 1; exit 1
fi fi
# Delete same IP again # Delete same IP again
if $cmd; then if $cmd; then
echo "No required IP existed. Expected to fail..." echo "No required IP existed. Expected to fail..."
exit 1; exit 1
fi fi
} }

View File

@ -23,8 +23,7 @@ iscsiadm -m node --login -p $IP_T:$ISCSI_PORT
waitforiscsidevices 1 waitforiscsidevices 1
disks=($(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}')) disks=($(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}'))
for (( i=0; i < ${#disks[@]}; i++ )) for ((i = 0; i < ${#disks[@]}; i++)); do
do
filename+=$(printf /dev/%s: "${disks[i]}") filename+=$(printf /dev/%s: "${disks[i]}")
waitforfile $filename waitforfile $filename
echo noop > /sys/block/${disks[i]}/queue/scheduler echo noop > /sys/block/${disks[i]}/queue/scheduler

View File

@ -20,9 +20,11 @@ NUM_JOBS=1
ISCSI_TGT_CM=0x02 ISCSI_TGT_CM=0x02
# Performance test for iscsi_tgt, run on devices with proper hardware support (target and inititator) # Performance test for iscsi_tgt, run on devices with proper hardware support (target and inititator)
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Usage: $(basename $1) [options]" echo "Usage: $(basename $1) [options]"
echo "-h, --help Print help and exit" echo "-h, --help Print help and exit"
echo " --fiopath=PATH Path to fio directory on initiator. [default=$FIO_PATH]" echo " --fiopath=PATH Path to fio directory on initiator. [default=$FIO_PATH]"
@ -37,18 +39,30 @@ while getopts 'h-:' optchar; do
case "$optchar" in case "$optchar" in
-) -)
case "$OPTARG" in case "$OPTARG" in
help) usage $0; exit 0 ;; help)
usage $0
exit 0
;;
fiopath=*) FIO_BIN="${OPTARG#*=}" ;; fiopath=*) FIO_BIN="${OPTARG#*=}" ;;
disk_no=*) DISKNO="${OPTARG#*=}" ;; disk_no=*) DISKNO="${OPTARG#*=}" ;;
target_ip=*) TARGET_IP="${OPTARG#*=}" ;; target_ip=*) TARGET_IP="${OPTARG#*=}" ;;
initiator_ip=*) INITIATOR_IP="${OPTARG#*=}" ;; initiator_ip=*) INITIATOR_IP="${OPTARG#*=}" ;;
init_mgmnt_ip=*) IP_I_SSH="${OPTARG#*=}" ;; init_mgmnt_ip=*) IP_I_SSH="${OPTARG#*=}" ;;
iscsi_tgt_mask=*) ISCSI_TGT_CM="${OPTARG#*=}" ;; iscsi_tgt_mask=*) ISCSI_TGT_CM="${OPTARG#*=}" ;;
*) usage $0 echo "Invalid argument '$OPTARG'"; exit 1 ;; *)
usage $0 echo "Invalid argument '$OPTARG'"
exit 1
;;
esac esac
;; ;;
h) usage $0; exit 0 ;; h)
*) usage $0 "Invalid argument '$optchar'"; exit 1 ;; usage $0
exit 0
;;
*)
usage $0 "Invalid argument '$optchar'"
exit 1
;;
esac esac
done done
@ -100,8 +114,7 @@ fi
$rpc_py iscsi_create_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT $rpc_py iscsi_create_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
$rpc_py iscsi_create_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK $rpc_py iscsi_create_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
for (( i=0; i < DISKNO; i++ )) for ((i = 0; i < DISKNO; i++)); do
do
$rpc_py iscsi_create_target_node Target${i} Target${i}_alias "${bdevs[i]}:0" "$PORTAL_TAG:$INITIATOR_TAG" 64 -d $rpc_py iscsi_create_target_node Target${i} Target${i}_alias "${bdevs[i]}:0" "$PORTAL_TAG:$INITIATOR_TAG" 64 -d
done done
@ -110,7 +123,7 @@ rm -f $testdir/perf.job
timing_exit iscsi_config timing_exit iscsi_config
timing_enter iscsi_initiator timing_enter iscsi_initiator
ssh_initiator bash -s - < $testdir/iscsi_initiator.sh $FIO_PATH $TARGET_IP ssh_initiator bash -s - $FIO_PATH $TARGET_IP < $testdir/iscsi_initiator.sh
timing_exit iscsi_initiator timing_exit iscsi_initiator
ssh_initiator "cat perf_output/iscsi_fio.json" > $iscsi_fio_results ssh_initiator "cat perf_output/iscsi_fio.json" > $iscsi_fio_results

View File

@ -36,8 +36,8 @@ function verify_qos_limits() {
local result=$1 local result=$1
local limit=$2 local limit=$2
[ "$(bc <<< "$result > $limit*0.85")" -eq 1 ] && \ [ "$(bc <<< "$result > $limit*0.85")" -eq 1 ] \
[ "$(bc <<< "$result < $limit*1.05")" -eq 1 ] && [ "$(bc <<< "$result < $limit*1.05")" -eq 1 ]
} }
if [ -z "$TARGET_IP" ]; then if [ -z "$TARGET_IP" ]; then

View File

@ -94,7 +94,8 @@ timing_enter sock_client
echo "Testing client path" echo "Testing client path"
# start echo server using socat # start echo server using socat
$SOCAT_APP tcp-l:$ISCSI_PORT,fork,bind=$INITIATOR_IP exec:'/bin/cat' & server_pid=$! $SOCAT_APP tcp-l:$ISCSI_PORT,fork,bind=$INITIATOR_IP exec:'/bin/cat' &
server_pid=$!
trap 'killprocess $server_pid;iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $server_pid;iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT
waitfortcp $server_pid $INITIATOR_IP:$ISCSI_PORT waitfortcp $server_pid $INITIATOR_IP:$ISCSI_PORT
@ -120,7 +121,8 @@ timing_exit sock_client
timing_enter sock_server timing_enter sock_server
# start echo server using hello_sock echo server # start echo server using hello_sock echo server
$HELLO_SOCK_APP -H $TARGET_IP -P $ISCSI_PORT -S -N $TEST_TYPE & server_pid=$! $HELLO_SOCK_APP -H $TARGET_IP -P $ISCSI_PORT -S -N $TEST_TYPE &
server_pid=$!
trap 'killprocess $server_pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $server_pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT
waitforlisten $server_pid waitforlisten $server_pid

View File

@ -15,11 +15,11 @@ if [[ $SPDK_TEST_VHOST -ne 1 && $SPDK_TEST_VHOST_INIT -eq 1 ]]; then
fi fi
if ((SPDK_TEST_BLOCKDEV + \ if ((SPDK_TEST_BLOCKDEV + \
SPDK_TEST_ISCSI + SPDK_TEST_ISCSI + \
SPDK_TEST_NVMF + SPDK_TEST_NVMF + \
SPDK_TEST_VHOST + SPDK_TEST_VHOST + \
SPDK_TEST_VHOST_INIT + SPDK_TEST_VHOST_INIT + \
SPDK_TEST_PMDK + SPDK_TEST_PMDK + \
SPDK_TEST_RBD == 0)); then SPDK_TEST_RBD == 0)); then
echo "WARNING: No tests are enabled so not running JSON configuration tests" echo "WARNING: No tests are enabled so not running JSON configuration tests"
exit 0 exit 0
@ -331,9 +331,7 @@ function create_virtio_initiator_config() {
timing_exit "${FUNCNAME[0]}" timing_exit "${FUNCNAME[0]}"
} }
function json_config_test_init() {
function json_config_test_init()
{
timing_enter "${FUNCNAME[0]}" timing_enter "${FUNCNAME[0]}"
timing_enter json_config_setup_target timing_enter json_config_setup_target
@ -343,7 +341,7 @@ function json_config_test_init()
# Load nvme configuration. The load_config will issue framework_start_init automatically # Load nvme configuration. The load_config will issue framework_start_init automatically
( (
echo '{"subsystems": ['; echo '{"subsystems": ['
$rootdir/scripts/gen_nvme.sh --json | jq -r "del(.config[] | select(.params.name!=\"Nvme0\"))" $rootdir/scripts/gen_nvme.sh --json | jq -r "del(.config[] | select(.params.name!=\"Nvme0\"))"
echo ']}' echo ']}'
) | tgt_rpc load_config ) | tgt_rpc load_config

View File

@ -77,7 +77,6 @@ function test_snapshot_compare_with_lvol_bdev() {
check_leftover_devices check_leftover_devices
} }
# Check that when writing to lvol bdev # Check that when writing to lvol bdev
# creating snapshot ends with success # creating snapshot ends with success
function test_create_snapshot_with_io() { function test_create_snapshot_with_io() {
@ -111,7 +110,6 @@ function test_create_snapshot_with_io() {
check_leftover_devices check_leftover_devices
} }
# Check that creating snapshot of snapshot will fail # Check that creating snapshot of snapshot will fail
function test_create_snapshot_of_snapshot() { function test_create_snapshot_of_snapshot() {
malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS) malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)

View File

@ -224,7 +224,10 @@ if grep -q 'CONFIG_VHOST_INTERNAL_LIB?=n' $rootdir/mk/config.mk; then
IGNORED_LIBS+=("rte_vhost") IGNORED_LIBS+=("rte_vhost")
fi fi
( for lib in $SPDK_LIBS; do confirm_deps $lib & done; wait ) (
for lib in $SPDK_LIBS; do confirm_deps $lib & done
wait
)
$MAKE $MAKEFLAGS clean $MAKE $MAKEFLAGS clean
git checkout "$rootdir/mk/spdk.lib.mk" git checkout "$rootdir/mk/spdk.lib.mk"

View File

@ -110,7 +110,10 @@ ssh_vm 'echo ready'
timing_exit wait_for_vm timing_exit wait_for_vm
timing_enter copy_repo timing_enter copy_repo
(cd "$rootdir"; tar -cf - .) | (ssh_vm 'tar -xf -') (
cd "$rootdir"
tar -cf - .
) | (ssh_vm 'tar -xf -')
timing_exit copy_repo timing_exit copy_repo
devices_initialization devices_initialization

View File

@ -5,7 +5,7 @@ rootdir=$(readlink -f $testdir/../..)
source $rootdir/scripts/common.sh source $rootdir/scripts/common.sh
source $rootdir/test/common/autotest_common.sh source $rootdir/test/common/autotest_common.sh
function nvme_identify { function nvme_identify() {
$rootdir/examples/nvme/identify/identify -i 0 $rootdir/examples/nvme/identify/identify -i 0
for bdf in $(get_nvme_bdfs); do for bdf in $(get_nvme_bdfs); do
$rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:${bdf}" -i 0 $rootdir/examples/nvme/identify/identify -r "trtype:PCIe traddr:${bdf}" -i 0
@ -13,7 +13,7 @@ function nvme_identify {
timing_exit identify timing_exit identify
} }
function nvme_perf { function nvme_perf() {
# enable no shutdown notification option # enable no shutdown notification option
$rootdir/examples/nvme/perf/perf -q 128 -w read -o 12288 -t 1 -LL -i 0 -N $rootdir/examples/nvme/perf/perf -q 128 -w read -o 12288 -t 1 -LL -i 0 -N
$rootdir/examples/nvme/perf/perf -q 128 -w write -o 12288 -t 1 -LL -i 0 $rootdir/examples/nvme/perf/perf -q 128 -w write -o 12288 -t 1 -LL -i 0
@ -23,7 +23,7 @@ function nvme_perf {
fi fi
} }
function nvme_fio_test { function nvme_fio_test() {
PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin
for bdf in $(get_nvme_bdfs); do for bdf in $(get_nvme_bdfs); do
for blkname in $(get_nvme_name_from_bdf $bdf); do for blkname in $(get_nvme_name_from_bdf $bdf); do
@ -32,7 +32,7 @@ function nvme_fio_test {
done done
} }
function nvme_multi_secondary { function nvme_multi_secondary() {
$rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x1 & $rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x1 &
pid0=$! pid0=$!
$rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x2 & $rootdir/examples/nvme/perf/perf -i 0 -q 16 -w read -o 4096 -t 3 -c 0x2 &

View File

@ -118,8 +118,7 @@ function get_disks_on_numa(){
local disks_on_numa="" local disks_on_numa=""
local i local i
for (( i=0; i<${#devs[@]}; i++ )) for ((i = 0; i < ${#devs[@]}; i++)); do
do
if [ ${numas[$i]} = $numa_no ]; then if [ ${numas[$i]} = $numa_no ]; then
disks_on_numa=$((disks_on_numa + 1)) disks_on_numa=$((disks_on_numa + 1))
fi fi
@ -144,14 +143,12 @@ function create_fio_config(){
# For kernel dirver, each disk will be alligned with all cpus on the same NUMA node # For kernel dirver, each disk will be alligned with all cpus on the same NUMA node
if [[ "$plugin" =~ "kernel" ]]; then if [[ "$plugin" =~ "kernel" ]]; then
for (( i=0; i<disk_no; i++ )) for ((i = 0; i < disk_no; i++)); do
do
sed -i -e "\$a[filename${i}]" $BASE_DIR/config.fio sed -i -e "\$a[filename${i}]" $BASE_DIR/config.fio
filename="/dev/${disks[$i]}" filename="/dev/${disks[$i]}"
sed -i -e "\$afilename=$filename" $BASE_DIR/config.fio sed -i -e "\$afilename=$filename" $BASE_DIR/config.fio
cpu_used="" cpu_used=""
for (( j=0; j<no_cores; j++ )) for ((j = 0; j < no_cores; j++)); do
do
core_numa=${cores_numa[$j]} core_numa=${cores_numa[$j]}
if [ "${disks_numa[$i]}" = "$core_numa" ]; then if [ "${disks_numa[$i]}" = "$core_numa" ]; then
cpu_used+="${cores[$j]}," cpu_used+="${cores[$j]},"
@ -161,8 +158,7 @@ function create_fio_config(){
echo "" >> $BASE_DIR/config.fio echo "" >> $BASE_DIR/config.fio
done done
else else
for (( i=0; i<no_cores; i++ )) for ((i = 0; i < no_cores; i++)); do
do
core_numa=${cores_numa[$i]} core_numa=${cores_numa[$i]}
total_disks_per_core=$disks_per_core total_disks_per_core=$disks_per_core
if [ "$disks_per_core_mod" -gt "0" ]; then if [ "$disks_per_core_mod" -gt "0" ]; then
@ -318,11 +314,9 @@ function run_spdk_nvme_fio(){
local plugin=$1 local plugin=$1
echo "** Running fio test, this can take a while, depending on the run-time and ramp-time setting." echo "** Running fio test, this can take a while, depending on the run-time and ramp-time setting."
if [[ "$plugin" = "spdk-plugin-nvme" ]]; then if [[ "$plugin" = "spdk-plugin-nvme" ]]; then
LD_PRELOAD=$PLUGIN_DIR_NVME/fio_plugin $FIO_BIN $BASE_DIR/config.fio --output-format=json\ LD_PRELOAD=$PLUGIN_DIR_NVME/fio_plugin $FIO_BIN $BASE_DIR/config.fio --output-format=json "${@:2}" --ioengine=spdk
"${@:2}" --ioengine=spdk
elif [[ "$plugin" = "spdk-plugin-bdev" ]]; then elif [[ "$plugin" = "spdk-plugin-bdev" ]]; then
LD_PRELOAD=$PLUGIN_DIR_BDEV/fio_plugin $FIO_BIN $BASE_DIR/config.fio --output-format=json\ LD_PRELOAD=$PLUGIN_DIR_BDEV/fio_plugin $FIO_BIN $BASE_DIR/config.fio --output-format=json "${@:2}" --ioengine=spdk_bdev --spdk_json_conf=$BASE_DIR/bdev.conf --spdk_mem=4096
"${@:2}" --ioengine=spdk_bdev --spdk_json_conf=$BASE_DIR/bdev.conf --spdk_mem=4096
fi fi
sleep 1 sleep 1
@ -390,10 +384,12 @@ function verify_disk_number() {
fi fi
} }
function usage() function usage() {
{
set +x set +x
[[ -n $2 ]] && ( echo "$2"; echo ""; ) [[ -n $2 ]] && (
echo "$2"
echo ""
)
echo "Run NVMe PMD/BDEV performance test. Change options for easier debug and setup configuration" echo "Run NVMe PMD/BDEV performance test. Change options for easier debug and setup configuration"
echo "Usage: $(basename $1) [options]" echo "Usage: $(basename $1) [options]"
echo "-h, --help Print help and exit" echo "-h, --help Print help and exit"
@ -437,7 +433,10 @@ while getopts 'h-:' optchar; do
case "$optchar" in case "$optchar" in
-) -)
case "$OPTARG" in case "$OPTARG" in
help) usage $0; exit 0 ;; help)
usage $0
exit 0
;;
rw=*) RW="${OPTARG#*=}" ;; rw=*) RW="${OPTARG#*=}" ;;
rwmixread=*) MIX="${OPTARG#*=}" ;; rwmixread=*) MIX="${OPTARG#*=}" ;;
iodepth=*) IODEPTH="${OPTARG#*=}" ;; iodepth=*) IODEPTH="${OPTARG#*=}" ;;
@ -448,15 +447,27 @@ while getopts 'h-:' optchar; do
repeat-no=*) REPEAT_NO="${OPTARG#*=}" ;; repeat-no=*) REPEAT_NO="${OPTARG#*=}" ;;
fio-bin=*) FIO_BIN="${OPTARG#*=}" ;; fio-bin=*) FIO_BIN="${OPTARG#*=}" ;;
driver=*) PLUGIN="${OPTARG#*=}" ;; driver=*) PLUGIN="${OPTARG#*=}" ;;
disk-no=*) DISKNO="${OPTARG#*=}"; ONEWORKLOAD=true ;; disk-no=*)
DISKNO="${OPTARG#*=}"
ONEWORKLOAD=true
;;
max-disk=*) DISKNO="${OPTARG#*=}" ;; max-disk=*) DISKNO="${OPTARG#*=}" ;;
cpu-allowed=*) CPUS_ALLOWED="${OPTARG#*=}" ;; cpu-allowed=*) CPUS_ALLOWED="${OPTARG#*=}" ;;
no-preconditioning) PRECONDITIONING=false ;; no-preconditioning) PRECONDITIONING=false ;;
no-io-scaling) NOIOSCALING=true ;; no-io-scaling) NOIOSCALING=true ;;
*) usage $0 echo "Invalid argument '$OPTARG'"; exit 1 ;; *)
usage $0 echo "Invalid argument '$OPTARG'"
exit 1
;;
esac esac
;; ;;
h) usage $0; exit 0 ;; h)
*) usage $0 "Invalid argument '$optchar'"; exit 1 ;; usage $0
exit 0
;;
*)
usage $0 "Invalid argument '$optchar'"
exit 1
;;
esac esac
done done

View File

@ -96,11 +96,9 @@ echo "run-time,ramp-time,fio-plugin,QD,block-size,num-cpu-cores,workload,workloa
printf "%s,%s,%s,%s,%s,%s,%s,%s\n" $RUNTIME $RAMP_TIME $PLUGIN $IODEPTH $BLK_SIZE $NO_CORES $RW $MIX >> $result_file printf "%s,%s,%s,%s,%s,%s,%s,%s\n" $RUNTIME $RAMP_TIME $PLUGIN $IODEPTH $BLK_SIZE $NO_CORES $RW $MIX >> $result_file
echo "num_of_disks,iops,avg_lat[usec],p99[usec],p99.99[usec],stdev[usec],avg_slat[usec],avg_clat[usec],bw[Kib/s]" >> $result_file echo "num_of_disks,iops,avg_lat[usec],p99[usec],p99.99[usec],stdev[usec],avg_slat[usec],avg_clat[usec],bw[Kib/s]" >> $result_file
#Run each workolad $REPEAT_NO times #Run each workolad $REPEAT_NO times
for (( j=0; j < REPEAT_NO; j++ )) for ((j = 0; j < REPEAT_NO; j++)); do
do
#Start with $DISKNO disks and remove 2 disks for each run to avoid preconditioning before each run. #Start with $DISKNO disks and remove 2 disks for each run to avoid preconditioning before each run.
for (( k=DISKNO; k >= 1; k-=2 )) for ((k = DISKNO; k >= 1; k -= 2)); do
do
cp $BASE_DIR/config.fio.tmp $BASE_DIR/config.fio cp $BASE_DIR/config.fio.tmp $BASE_DIR/config.fio
echo "" >> $BASE_DIR/config.fio echo "" >> $BASE_DIR/config.fio
#The SPDK fio plugin supports submitting/completing I/Os to multiple SSDs from a single thread. #The SPDK fio plugin supports submitting/completing I/Os to multiple SSDs from a single thread.
@ -177,8 +175,7 @@ do
done done
done done
#Write results to csv file #Write results to csv file
for (( k=DISKNO; k >= 1; k-=2 )) for ((k = DISKNO; k >= 1; k -= 2)); do
do
iops_disks[$k]=$((${iops_disks[$k]} / REPEAT_NO)) iops_disks[$k]=$((${iops_disks[$k]} / REPEAT_NO))
if [[ "$PLUGIN" =~ "plugin" ]]; then if [[ "$PLUGIN" =~ "plugin" ]]; then

View File

@ -5,8 +5,7 @@ NVMF_TCP_IP_ADDRESS="127.0.0.1"
NVMF_TRANSPORT_OPTS="" NVMF_TRANSPORT_OPTS=""
NVMF_SERIAL=SPDK00000000000001 NVMF_SERIAL=SPDK00000000000001
function build_nvmf_app_args() function build_nvmf_app_args() {
{
if [ $SPDK_RUN_NON_ROOT -eq 1 ]; then if [ $SPDK_RUN_NON_ROOT -eq 1 ]; then
NVMF_APP=(sudo -u "$USER" "${NVMF_APP[@]}") NVMF_APP=(sudo -u "$USER" "${NVMF_APP[@]}")
NVMF_APP+=(-i "$NVMF_APP_SHM_ID" -e 0xFFFF) NVMF_APP+=(-i "$NVMF_APP_SHM_ID" -e 0xFFFF)
@ -15,13 +14,13 @@ function build_nvmf_app_args()
fi fi
} }
: ${NVMF_APP_SHM_ID="0"}; export NVMF_APP_SHM_ID : ${NVMF_APP_SHM_ID="0"}
export NVMF_APP_SHM_ID
build_nvmf_app_args build_nvmf_app_args
have_pci_nics=0 have_pci_nics=0
function load_ib_rdma_modules() function load_ib_rdma_modules() {
{
if [ $(uname) != Linux ]; then if [ $(uname) != Linux ]; then
return 0 return 0
fi fi
@ -37,9 +36,7 @@ function load_ib_rdma_modules()
modprobe rdma_ucm modprobe rdma_ucm
} }
function detect_soft_roce_nics() {
function detect_soft_roce_nics()
{
if hash rxe_cfg; then if hash rxe_cfg; then
rxe_cfg start rxe_cfg start
rdma_nics=$(get_rdma_if_list) rdma_nics=$(get_rdma_if_list)
@ -54,12 +51,10 @@ function detect_soft_roce_nics()
fi fi
} }
# args 1 and 2 represent the grep filters for finding our NICS. # args 1 and 2 represent the grep filters for finding our NICS.
# subsequent args are all drivers that should be loaded if we find these NICs. # subsequent args are all drivers that should be loaded if we find these NICs.
# Those drivers should be supplied in the correct order. # Those drivers should be supplied in the correct order.
function detect_nics_and_probe_drivers() function detect_nics_and_probe_drivers() {
{
NIC_VENDOR="$1" NIC_VENDOR="$1"
NIC_CLASS="$2" NIC_CLASS="$2"
@ -80,9 +75,7 @@ function detect_nics_and_probe_drivers()
fi fi
} }
function detect_pci_nics() {
function detect_pci_nics()
{
if ! hash lspci; then if ! hash lspci; then
return 0 return 0
@ -101,16 +94,14 @@ function detect_pci_nics()
sleep 5 sleep 5
} }
function detect_rdma_nics() function detect_rdma_nics() {
{
detect_pci_nics detect_pci_nics
if [ "$have_pci_nics" -eq "0" ]; then if [ "$have_pci_nics" -eq "0" ]; then
detect_soft_roce_nics detect_soft_roce_nics
fi fi
} }
function allocate_nic_ips() function allocate_nic_ips() {
{
((count = NVMF_IP_LEAST_ADDR)) ((count = NVMF_IP_LEAST_ADDR))
for nic_name in $(get_rdma_if_list); do for nic_name in $(get_rdma_if_list); do
ip="$(get_ip_address $nic_name)" ip="$(get_ip_address $nic_name)"
@ -124,15 +115,13 @@ function allocate_nic_ips()
done done
} }
function get_available_rdma_ips() function get_available_rdma_ips() {
{
for nic_name in $(get_rdma_if_list); do for nic_name in $(get_rdma_if_list); do
get_ip_address $nic_name get_ip_address $nic_name
done done
} }
function get_rdma_if_list() function get_rdma_if_list() {
{
for nic_type in /sys/class/infiniband/*; do for nic_type in /sys/class/infiniband/*; do
[[ -e "$nic_type" ]] || break [[ -e "$nic_type" ]] || break
for nic_name in /sys/class/infiniband/"$(basename ${nic_type})"/device/net/*; do for nic_name in /sys/class/infiniband/"$(basename ${nic_type})"/device/net/*; do
@ -142,14 +131,12 @@ function get_rdma_if_list()
done done
} }
function get_ip_address() function get_ip_address() {
{
interface=$1 interface=$1
ip -o -4 addr show $interface | awk '{print $4}' | cut -d"/" -f1 ip -o -4 addr show $interface | awk '{print $4}' | cut -d"/" -f1
} }
function nvmfcleanup() function nvmfcleanup() {
{
sync sync
set +e set +e
for i in {1..20}; do for i in {1..20}; do
@ -170,8 +157,7 @@ function nvmfcleanup()
modprobe -v -r nvme-fabrics modprobe -v -r nvme-fabrics
} }
function nvmftestinit() function nvmftestinit() {
{
if [ -z $TEST_TRANSPORT ]; then if [ -z $TEST_TRANSPORT ]; then
echo "transport not specified - use --transport= to specify" echo "transport not specified - use --transport= to specify"
return 1 return 1
@ -205,8 +191,7 @@ function nvmftestinit()
modprobe nvme-$TEST_TRANSPORT || true modprobe nvme-$TEST_TRANSPORT || true
} }
function nvmfappstart() function nvmfappstart() {
{
timing_enter start_nvmf_tgt timing_enter start_nvmf_tgt
"${NVMF_APP[@]}" $1 & "${NVMF_APP[@]}" $1 &
nvmfpid=$! nvmfpid=$!
@ -215,8 +200,7 @@ function nvmfappstart()
timing_exit start_nvmf_tgt timing_exit start_nvmf_tgt
} }
function nvmftestfini() function nvmftestfini() {
{
nvmfcleanup || : nvmfcleanup || :
if [ -n "$nvmfpid" ]; then if [ -n "$nvmfpid" ]; then
killprocess $nvmfpid killprocess $nvmfpid
@ -229,15 +213,13 @@ function nvmftestfini()
fi fi
} }
function rdma_device_init() function rdma_device_init() {
{
load_ib_rdma_modules load_ib_rdma_modules
detect_rdma_nics detect_rdma_nics
allocate_nic_ips allocate_nic_ips
} }
function revert_soft_roce() function revert_soft_roce() {
{
if hash rxe_cfg; then if hash rxe_cfg; then
interfaces="$(ip -o link | awk '{print $2}' | cut -d":" -f1)" interfaces="$(ip -o link | awk '{print $2}' | cut -d":" -f1)"
for interface in $interfaces; do for interface in $interfaces; do
@ -247,8 +229,7 @@ function revert_soft_roce()
fi fi
} }
function check_ip_is_soft_roce() function check_ip_is_soft_roce() {
{
IP=$1 IP=$1
if hash rxe_cfg; then if hash rxe_cfg; then
dev=$(ip -4 -o addr show | grep $IP | cut -d" " -f2) dev=$(ip -4 -o addr show | grep $IP | cut -d" " -f2)
@ -262,8 +243,7 @@ function check_ip_is_soft_roce()
fi fi
} }
function nvme_connect() function nvme_connect() {
{
local init_count local init_count
init_count=$(nvme list | wc -l) init_count=$(nvme list | wc -l)
@ -279,8 +259,7 @@ function nvme_connect()
return 1 return 1
} }
function get_nvme_devs() function get_nvme_devs() {
{
local dev rest local dev rest
nvmes=() nvmes=()
@ -296,8 +275,7 @@ function get_nvme_devs()
echo "${#nvmes[@]}" >&2 echo "${#nvmes[@]}" >&2
} }
function gen_nvmf_target_json() function gen_nvmf_target_json() {
{
local subsystem config=() local subsystem config=()
for subsystem in "${@:-1}"; do for subsystem in "${@:-1}"; do
@ -325,7 +303,10 @@ function gen_nvmf_target_json()
{ {
"subsystem": "bdev", "subsystem": "bdev",
"config": [ "config": [
$(IFS=","; printf '%s\n' "${config[*]}") $(
IFS=","
printf '%s\n' "${config[*]}"
)
] ]
} }
] ]

View File

@ -10,8 +10,7 @@ MALLOC_BLOCK_SIZE=512
rpc_py="$rootdir/scripts/rpc.py" rpc_py="$rootdir/scripts/rpc.py"
function tgt_init() function tgt_init() {
{
nvmfappstart "-m 0xF" nvmfappstart "-m 0xF"
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192 $rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
@ -29,7 +28,6 @@ if [ $TEST_TRANSPORT == "rdma" ] && check_ip_is_soft_roce $NVMF_FIRST_TARGET_IP;
exit 0 exit 0
fi fi
tgt_init tgt_init
"$rootdir/test/bdev/bdevperf/bdevperf" --json <(gen_nvmf_target_json) -q 128 -o 4096 -w verify -t 1 "$rootdir/test/bdev/bdevperf/bdevperf" --json <(gen_nvmf_target_json) -q 128 -o 4096 -w verify -t 1

View File

@ -12,8 +12,7 @@ MALLOC_BLOCK_SIZE=512
rpc_py="$rootdir/scripts/rpc.py" rpc_py="$rootdir/scripts/rpc.py"
function disconnect_init() function disconnect_init() {
{
nvmfappstart "-m 0xF0" nvmfappstart "-m 0xF0"
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc0 $rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc0
@ -27,7 +26,7 @@ function disconnect_init()
# Test to make sure we don't segfault or access null pointers when we try to connect to # Test to make sure we don't segfault or access null pointers when we try to connect to
# a discovery controller that doesn't exist yet. # a discovery controller that doesn't exist yet.
function nvmf_target_disconnect_tc1 { function nvmf_target_disconnect_tc1() {
set +e set +e
$rootdir/examples/nvme/reconnect/reconnect -q 32 -o 4096 -w randrw -M 50 -t 10 -c 0xF \ $rootdir/examples/nvme/reconnect/reconnect -q 32 -o 4096 -w randrw -M 50 -t 10 -c 0xF \
-r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" -r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT"
@ -40,7 +39,7 @@ function nvmf_target_disconnect_tc1 {
set -e set -e
} }
function nvmf_target_disconnect_tc2 { function nvmf_target_disconnect_tc2() {
disconnect_init $NVMF_FIRST_TARGET_IP disconnect_init $NVMF_FIRST_TARGET_IP
# If perf doesn't shut down, this test will time out. # If perf doesn't shut down, this test will time out.
@ -58,7 +57,7 @@ function nvmf_target_disconnect_tc2 {
sync sync
} }
function nvmf_target_disconnect_tc3 { function nvmf_target_disconnect_tc3() {
$rootdir/examples/nvme/reconnect/reconnect -q 32 -o 4096 -w randrw -M 50 -t 10 -c 0xF \ $rootdir/examples/nvme/reconnect/reconnect -q 32 -o 4096 -w randrw -M 50 -t 10 -c 0xF \
-r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT alt_traddr:$NVMF_SECOND_TARGET_IP" & -r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT alt_traddr:$NVMF_SECOND_TARGET_IP" &
reconnectpid=$! reconnectpid=$!
@ -86,6 +85,5 @@ else
fi fi
fi fi
trap - SIGINT SIGTERM EXIT trap - SIGINT SIGTERM EXIT
nvmftestfini nvmftestfini

View File

@ -12,7 +12,7 @@ rpc_py="$rootdir/scripts/rpc.py"
nvmftestinit nvmftestinit
function nvmf_filesystem_create { function nvmf_filesystem_create() {
fstype=$1 fstype=$1
nvme_name=$2 nvme_name=$2
@ -41,7 +41,7 @@ function nvmf_filesystem_create {
lsblk -l -o NAME | grep -q -w "${nvme_name}p1" lsblk -l -o NAME | grep -q -w "${nvme_name}p1"
} }
function nvmf_filesystem_part { function nvmf_filesystem_part() {
incapsule=$1 incapsule=$1
nvmfappstart "-m 0xF" nvmfappstart "-m 0xF"

View File

@ -12,7 +12,6 @@ target=foobar
# pre-seed the rng to generate predictive values across different test runs # pre-seed the rng to generate predictive values across different test runs
RANDOM=0 RANDOM=0
gen_random_s() { gen_random_s() {
local length=$1 ll local length=$1 ll
# generate ascii table which nvme supports # generate ascii table which nvme supports
@ -34,7 +33,6 @@ nvmfappstart "-m 0xF"
trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini $1; exit 1' SIGINT SIGTERM EXIT
# Attempt to create subsystem with non-existing target # Attempt to create subsystem with non-existing target
out=$("$rpc" nvmf_create_subsystem -t "$target" "$nqn$RANDOM" 2>&1) && false out=$("$rpc" nvmf_create_subsystem -t "$target" "$nqn$RANDOM" 2>&1) && false
[[ $out == *"Unable to find target"* ]] [[ $out == *"Unable to find target"* ]]

View File

@ -25,8 +25,7 @@ fi
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192 $rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
for i in $(seq 1 $NVMF_SUBSYS) for i in $(seq 1 $NVMF_SUBSYS); do
do
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc$i $rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc$i
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i $rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i Malloc$i $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i Malloc$i

View File

@ -10,8 +10,7 @@ rpc_py="$rootdir/scripts/rpc.py"
MALLOC_BDEV_SIZE=64 MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512 MALLOC_BLOCK_SIZE=512
function build_nvmf_example_args() function build_nvmf_example_args() {
{
if [ $SPDK_RUN_NON_ROOT -eq 1 ]; then if [ $SPDK_RUN_NON_ROOT -eq 1 ]; then
echo "sudo -u $(logname) ./examples/nvmf/nvmf/nvmf -i $NVMF_APP_SHM_ID" echo "sudo -u $(logname) ./examples/nvmf/nvmf/nvmf -i $NVMF_APP_SHM_ID"
else else
@ -21,8 +20,7 @@ function build_nvmf_example_args()
NVMF_EXAMPLE="$(build_nvmf_example_args)" NVMF_EXAMPLE="$(build_nvmf_example_args)"
function nvmfexamplestart() function nvmfexamplestart() {
{
timing_enter start_nvmf_example timing_enter start_nvmf_example
$NVMF_EXAMPLE $1 & $NVMF_EXAMPLE $1 &
nvmfpid=$! nvmfpid=$!

View File

@ -7,14 +7,12 @@ source $rootdir/test/nvmf/common.sh
rpc_py="$rootdir/scripts/rpc.py" rpc_py="$rootdir/scripts/rpc.py"
function jcount() function jcount() {
{
local filter=$1 local filter=$1
jq "$filter" | wc -l jq "$filter" | wc -l
} }
function jsum() function jsum() {
{
local filter=$1 local filter=$1
jq "$filter" | awk '{s+=$1}END{print s}' jq "$filter" | awk '{s+=$1}END{print s}'
} }
@ -82,8 +80,7 @@ nvme disconnect -n nqn.2016-06.io.spdk:cnode1
$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1 $rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
# do frequent add delete of namespaces with different nsid. # do frequent add delete of namespaces with different nsid.
for i in $(seq 1 $times) for i in $(seq 1 $times); do
do
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -s $NVMF_SERIAL $rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -s $NVMF_SERIAL
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc1 -n 5 $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc1 -n 5
@ -100,8 +97,7 @@ do
done done
# do frequent add delete. # do frequent add delete.
for i in $(seq 1 $times) for i in $(seq 1 $times); do
do
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -s $NVMF_SERIAL $rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -s $NVMF_SERIAL
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc1 $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc1

View File

@ -73,7 +73,7 @@ function waitforio() {
} }
# Test 1: Kill the initiator unexpectedly with no I/O outstanding # Test 1: Kill the initiator unexpectedly with no I/O outstanding
function nvmf_shutdown_tc1 { function nvmf_shutdown_tc1() {
starttarget starttarget
# Run bdev_svc, which connects but does not issue I/O # Run bdev_svc, which connects but does not issue I/O
@ -97,7 +97,7 @@ function nvmf_shutdown_tc1 {
} }
# Test 2: Kill initiator unexpectedly with I/O outstanding # Test 2: Kill initiator unexpectedly with I/O outstanding
function nvmf_shutdown_tc2 { function nvmf_shutdown_tc2() {
starttarget starttarget
# Run bdevperf # Run bdevperf
@ -119,7 +119,7 @@ function nvmf_shutdown_tc2 {
} }
# Test 3: Kill the target unexpectedly with I/O outstanding # Test 3: Kill the target unexpectedly with I/O outstanding
function nvmf_shutdown_tc3 { function nvmf_shutdown_tc3() {
starttarget starttarget
# Run bdevperf # Run bdevperf

View File

@ -1,4 +1,3 @@
source $rootdir/scripts/common.sh source $rootdir/scripts/common.sh
source $rootdir/test/common/autotest_common.sh source $rootdir/test/common/autotest_common.sh
@ -11,8 +10,7 @@ function nvme_cfg() {
echo "$ocf_nvme_cfg" echo "$ocf_nvme_cfg"
} }
function clear_nvme() function clear_nvme() {
{
mapfile -t bdf < <(iter_all_pci_class_code 01 08 02) mapfile -t bdf < <(iter_all_pci_class_code 01 08 02)
# Clear metadata on NVMe device # Clear metadata on NVMe device

View File

@ -6,12 +6,11 @@ source $rootdir/test/common/autotest_common.sh
rpc_py=$rootdir/scripts/rpc.py rpc_py=$rootdir/scripts/rpc.py
function bdev_check_claimed() function bdev_check_claimed() {
{
if [ "$($rpc_py get_bdevs -b "$@" | jq '.[0].claimed')" = "true" ]; then if [ "$($rpc_py get_bdevs -b "$@" | jq '.[0].claimed')" = "true" ]; then
return 0; return 0
else else
return 1; return 1
fi fi
} }
@ -34,13 +33,13 @@ $rpc_py bdev_ocf_get_bdevs NonExisting | jq -e \
'.[0] | .name == "PartCache"' '.[0] | .name == "PartCache"'
if ! bdev_check_claimed Malloc0; then if ! bdev_check_claimed Malloc0; then
>&2 echo "Base device expected to be claimed now" echo >&2 "Base device expected to be claimed now"
exit 1 exit 1
fi fi
$rpc_py bdev_ocf_delete PartCache $rpc_py bdev_ocf_delete PartCache
if bdev_check_claimed Malloc0; then if bdev_check_claimed Malloc0; then
>&2 echo "Base device is not expected to be claimed now" echo >&2 "Base device is not expected to be claimed now"
exit 1 exit 1
fi fi
@ -50,34 +49,34 @@ $rpc_py bdev_ocf_get_bdevs FullCache | jq -e \
'.[0] | .started and .cache.attached and .core.attached' '.[0] | .started and .cache.attached and .core.attached'
if ! (bdev_check_claimed Malloc0 && bdev_check_claimed Malloc1); then if ! (bdev_check_claimed Malloc0 && bdev_check_claimed Malloc1); then
>&2 echo "Base devices expected to be claimed now" echo >&2 "Base devices expected to be claimed now"
exit 1 exit 1
fi fi
$rpc_py bdev_ocf_delete FullCache $rpc_py bdev_ocf_delete FullCache
if bdev_check_claimed Malloc0 && bdev_check_claimed Malloc1; then if bdev_check_claimed Malloc0 && bdev_check_claimed Malloc1; then
>&2 echo "Base devices are not expected to be claimed now" echo >&2 "Base devices are not expected to be claimed now"
exit 1 exit 1
fi fi
$rpc_py bdev_ocf_create HotCache wt Malloc0 Malloc1 $rpc_py bdev_ocf_create HotCache wt Malloc0 Malloc1
if ! (bdev_check_claimed Malloc0 && bdev_check_claimed Malloc1); then if ! (bdev_check_claimed Malloc0 && bdev_check_claimed Malloc1); then
>&2 echo "Base devices expected to be claimed now" echo >&2 "Base devices expected to be claimed now"
exit 1 exit 1
fi fi
$rpc_py bdev_malloc_delete Malloc0 $rpc_py bdev_malloc_delete Malloc0
if bdev_check_claimed Malloc1; then if bdev_check_claimed Malloc1; then
>&2 echo "Base device is not expected to be claimed now" echo >&2 "Base device is not expected to be claimed now"
exit 1 exit 1
fi fi
status=$($rpc_py get_bdevs) status=$($rpc_py get_bdevs)
gone=$(echo $status | jq 'map(select(.name == "HotCache")) == []') gone=$(echo $status | jq 'map(select(.name == "HotCache")) == []')
if [[ $gone == false ]]; then if [[ $gone == false ]]; then
>&2 echo "OCF bdev is expected to unregister" echo >&2 "OCF bdev is expected to unregister"
exit 1 exit 1
fi fi

View File

@ -7,15 +7,13 @@ source $rootdir/test/common/autotest_common.sh
rpc_py=$rootdir/scripts/rpc.py rpc_py=$rootdir/scripts/rpc.py
spdk_pid='?' spdk_pid='?'
function start_spdk() function start_spdk() {
{
$rootdir/app/iscsi_tgt/iscsi_tgt & $rootdir/app/iscsi_tgt/iscsi_tgt &
spdk_pid=$! spdk_pid=$!
trap 'killprocess $spdk_pid; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $spdk_pid; exit 1' SIGINT SIGTERM EXIT
waitforlisten $spdk_pid waitforlisten $spdk_pid
} }
function stop_spdk() function stop_spdk() {
{
killprocess $spdk_pid killprocess $spdk_pid
trap - SIGINT SIGTERM EXIT trap - SIGINT SIGTERM EXIT
} }

View File

@ -3,9 +3,11 @@
testdir=$(readlink -f $(dirname $0)) testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../..) rootdir=$(readlink -f $testdir/../..)
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Devstack installation script" echo "Devstack installation script"
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
echo "--branch=BRANCH Define which version of openstack" echo "--branch=BRANCH Define which version of openstack"
@ -15,7 +17,6 @@ function usage()
exit 0 exit 0
} }
branch="master" branch="master"
while getopts 'h-:' optchar; do while getopts 'h-:' optchar; do
case "$optchar" in case "$optchar" in
@ -26,7 +27,7 @@ while getopts 'h-:' optchar; do
esac esac
;; ;;
h) usage $0 ;; h) usage $0 ;;
*) usage $0 "Invalid argument '$OPTARG'" *) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
done done

View File

@ -9,7 +9,7 @@ TEST_TRANSPORT='rdma'
nvmftestinit nvmftestinit
function finish_test { function finish_test() {
{ {
"$rpc_py" bdev_lvol_delete_lvstore -l lvs0 "$rpc_py" bdev_lvol_delete_lvstore -l lvs0
kill -9 $rpc_proxy_pid kill -9 $rpc_proxy_pid

View File

@ -1,8 +1,7 @@
# Prints error message and return error code, closes vhost app and remove # Prints error message and return error code, closes vhost app and remove
# pmem pool file # pmem pool file
# input: error message, error code # input: error message, error code
function error() function error() {
{
local error_code=${2:-1} local error_code=${2:-1}
echo "===========" echo "==========="
echo -e "ERROR: $1" echo -e "ERROR: $1"
@ -16,8 +15,7 @@ function error()
# check if there is pool file & remove it # check if there is pool file & remove it
# input: path to pool file # input: path to pool file
# default: $default_pool_file # default: $default_pool_file
function pmem_clean_pool_file() function pmem_clean_pool_file() {
{
local pool_file=${1:-$default_pool_file} local pool_file=${1:-$default_pool_file}
if [ -f $pool_file ]; then if [ -f $pool_file ]; then
@ -29,8 +27,7 @@ function pmem_clean_pool_file()
# create new pmem file # create new pmem file
# input: path to pool file, size in MB, block_size # input: path to pool file, size in MB, block_size
# default: $default_pool_file 32 512 # default: $default_pool_file 32 512
function pmem_create_pool_file() function pmem_create_pool_file() {
{
local pool_file=${1:-$default_pool_file} local pool_file=${1:-$default_pool_file}
local size=${2:-32} local size=${2:-32}
local block_size=${3:-512} local block_size=${3:-512}
@ -46,8 +43,7 @@ function pmem_create_pool_file()
fi fi
} }
function pmem_unmount_ramspace function pmem_unmount_ramspace() {
{
if [ -d "$testdir/ramspace" ]; then if [ -d "$testdir/ramspace" ]; then
if mount | grep -q "$testdir/ramspace"; then if mount | grep -q "$testdir/ramspace"; then
umount $testdir/ramspace umount $testdir/ramspace
@ -57,16 +53,14 @@ function pmem_unmount_ramspace
fi fi
} }
function pmem_print_tc_name function pmem_print_tc_name() {
{
echo "" echo ""
echo "===============================================================" echo "==============================================================="
echo "Now running: $1" echo "Now running: $1"
echo "===============================================================" echo "==============================================================="
} }
function vhost_start() function vhost_start() {
{
local vhost_pid local vhost_pid
$rootdir/app/vhost/vhost & $rootdir/app/vhost/vhost &
@ -76,8 +70,7 @@ function vhost_start()
waitforlisten $vhost_pid waitforlisten $vhost_pid
} }
function vhost_kill() function vhost_kill() {
{
local vhost_pid_file="$testdir/vhost.pid" local vhost_pid_file="$testdir/vhost.pid"
local vhost_pid local vhost_pid
vhost_pid="$(cat $vhost_pid_file)" vhost_pid="$(cat $vhost_pid_file)"

View File

@ -19,9 +19,11 @@ default_pool_file="$testdir/pool_file"
obj_pool_file="$testdir/obj_pool_file" obj_pool_file="$testdir/obj_pool_file"
bdev_name=pmem0 bdev_name=pmem0
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Shortcut script for automated RPC tests for PMEM" echo "Shortcut script for automated RPC tests for PMEM"
echo echo
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
@ -42,18 +44,33 @@ while getopts 'xh-:' optchar; do
-) -)
case "$OPTARG" in case "$OPTARG" in
help) usage $0 ;; help) usage $0 ;;
info) test_info=true; test_all=false;; info)
create) test_create=true; test_all=false;; test_info=true
delete) test_delete=true; test_all=false;; test_all=false
construct_bdev) test_construct_bdev=true; test_all=false;; ;;
delete_bdev) test_delete_bdev=true; test_all=false;; create)
test_create=true
test_all=false
;;
delete)
test_delete=true
test_all=false
;;
construct_bdev)
test_construct_bdev=true
test_all=false
;;
delete_bdev)
test_delete_bdev=true
test_all=false
;;
all) test_all_get=true ;; all) test_all_get=true ;;
*) usage $0 "Invalid argument '$OPTARG'" ;; *) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
;; ;;
h) usage $0 ;; h) usage $0 ;;
x) enable_script_debug=true ;; x) enable_script_debug=true ;;
*) usage $0 "Invalid argument '$OPTARG'" *) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
done done
@ -69,8 +86,7 @@ fi
#================================================ #================================================
# bdev_pmem_get_pool_info tests # bdev_pmem_get_pool_info tests
#================================================ #================================================
function bdev_pmem_get_pool_info_tc1() function bdev_pmem_get_pool_info_tc1() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
if $rpc_py bdev_pmem_get_pool_info; then if $rpc_py bdev_pmem_get_pool_info; then
@ -80,8 +96,7 @@ function bdev_pmem_get_pool_info_tc1()
return 0 return 0
} }
function bdev_pmem_get_pool_info_tc2() function bdev_pmem_get_pool_info_tc2() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
if $rpc_py bdev_pmem_get_pool_info $rootdir/non/existing/path/non_existent_file; then if $rpc_py bdev_pmem_get_pool_info $rootdir/non/existing/path/non_existent_file; then
@ -91,8 +106,7 @@ function bdev_pmem_get_pool_info_tc2()
return 0 return 0
} }
function bdev_pmem_get_pool_info_tc3() function bdev_pmem_get_pool_info_tc3() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file $obj_pool_file pmem_clean_pool_file $obj_pool_file
@ -113,8 +127,7 @@ function bdev_pmem_get_pool_info_tc3()
return 0 return 0
} }
function bdev_pmem_get_pool_info_tc4() function bdev_pmem_get_pool_info_tc4() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -130,8 +143,7 @@ function bdev_pmem_get_pool_info_tc4()
#================================================ #================================================
# bdev_pmem_create_pool tests # bdev_pmem_create_pool tests
#================================================ #================================================
function bdev_pmem_create_pool_tc1() function bdev_pmem_create_pool_tc1() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -159,8 +171,7 @@ function bdev_pmem_create_pool_tc1()
return 0 return 0
} }
function bdev_pmem_create_pool_tc2() function bdev_pmem_create_pool_tc2() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -176,8 +187,7 @@ function bdev_pmem_create_pool_tc2()
return 0 return 0
} }
function bdev_pmem_create_pool_tc3() function bdev_pmem_create_pool_tc3() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -205,8 +215,7 @@ function bdev_pmem_create_pool_tc3()
return 0 return 0
} }
function bdev_pmem_create_pool_tc4() function bdev_pmem_create_pool_tc4() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_unmount_ramspace pmem_unmount_ramspace
@ -236,8 +245,7 @@ function bdev_pmem_create_pool_tc4()
return 0 return 0
} }
function bdev_pmem_create_pool_tc5() function bdev_pmem_create_pool_tc5() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
local pmem_block_size local pmem_block_size
@ -278,14 +286,12 @@ function bdev_pmem_create_pool_tc5()
return 0 return 0
} }
function bdev_pmem_create_pool_tc6() function bdev_pmem_create_pool_tc6() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
local created_pmem_block_size local created_pmem_block_size
for i in 511 512 1024 2048 4096 131072 262144 for i in 511 512 1024 2048 4096 131072 262144; do
do
if ! $rpc_py bdev_pmem_create_pool $default_pool_file 256 $i; then if ! $rpc_py bdev_pmem_create_pool $default_pool_file 256 $i; then
error "Failed to create pmem pool!" error "Failed to create pmem pool!"
fi fi
@ -307,8 +313,7 @@ function bdev_pmem_create_pool_tc6()
return 0 return 0
} }
function bdev_pmem_create_pool_tc7() function bdev_pmem_create_pool_tc7() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -324,8 +329,7 @@ function bdev_pmem_create_pool_tc7()
return 0 return 0
} }
function bdev_pmem_create_pool_tc8() function bdev_pmem_create_pool_tc8() {
{
pmem_print_tc_name "bdev_pmem_create_pool_tc8" pmem_print_tc_name "bdev_pmem_create_pool_tc8"
pmem_clean_pool_file pmem_clean_pool_file
@ -341,8 +345,7 @@ function bdev_pmem_create_pool_tc8()
return 0 return 0
} }
function bdev_pmem_create_pool_tc9() function bdev_pmem_create_pool_tc9() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -369,8 +372,7 @@ function bdev_pmem_create_pool_tc9()
#================================================ #================================================
# bdev_pmem_delete_pool tests # bdev_pmem_delete_pool tests
#================================================ #================================================
function bdev_pmem_delete_pool_tc1() function bdev_pmem_delete_pool_tc1() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -381,8 +383,7 @@ function bdev_pmem_delete_pool_tc1()
return 0 return 0
} }
function bdev_pmem_delete_pool_tc2() function bdev_pmem_delete_pool_tc2() {
{
pmem_print_tc_name "bdev_pmem_delete_pool_tc2" pmem_print_tc_name "bdev_pmem_delete_pool_tc2"
pmem_clean_pool_file $obj_pool_file pmem_clean_pool_file $obj_pool_file
@ -403,8 +404,7 @@ function bdev_pmem_delete_pool_tc2()
return 0 return 0
} }
function bdev_pmem_delete_pool_tc3() function bdev_pmem_delete_pool_tc3() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -424,8 +424,7 @@ function bdev_pmem_delete_pool_tc3()
return 0 return 0
} }
function bdev_pmem_delete_pool_tc4() function bdev_pmem_delete_pool_tc4() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
bdev_pmem_delete_pool_tc3 bdev_pmem_delete_pool_tc3
@ -439,8 +438,7 @@ function bdev_pmem_delete_pool_tc4()
#================================================ #================================================
# bdev_pmem_create tests # bdev_pmem_create tests
#================================================ #================================================
function bdev_pmem_create_tc1() function bdev_pmem_create_tc1() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -453,8 +451,7 @@ function bdev_pmem_create_tc1()
return 0 return 0
} }
function bdev_pmem_create_tc2() function bdev_pmem_create_tc2() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
@ -471,8 +468,7 @@ function bdev_pmem_create_tc2()
return 0 return 0
} }
function bdev_pmem_create_tc3() function bdev_pmem_create_tc3() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
truncate -s 32M $rootdir/test/pmem/random_file truncate -s 32M $rootdir/test/pmem/random_file
@ -488,8 +484,7 @@ function bdev_pmem_create_tc3()
return 0 return 0
} }
function bdev_pmem_create_tc4() function bdev_pmem_create_tc4() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file $obj_pool_file pmem_clean_pool_file $obj_pool_file
@ -510,8 +505,7 @@ function bdev_pmem_create_tc4()
return 0 return 0
} }
function bdev_pmem_create_tc5() function bdev_pmem_create_tc5() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
pmem_create_pool_file pmem_create_pool_file
@ -541,8 +535,7 @@ function bdev_pmem_create_tc5()
return 0 return 0
} }
function bdev_pmem_create_tc6() function bdev_pmem_create_tc6() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
local pmem_bdev_name local pmem_bdev_name
pmem_clean_pool_file pmem_clean_pool_file
@ -579,8 +572,7 @@ function bdev_pmem_create_tc6()
#================================================ #================================================
# bdev_pmem_delete tests # bdev_pmem_delete tests
#================================================ #================================================
function delete_bdev_tc1() function delete_bdev_tc1() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
local pmem_bdev_name local pmem_bdev_name
local bdevs_names local bdevs_names
@ -612,8 +604,7 @@ function delete_bdev_tc1()
return 0 return 0
} }
function delete_bdev_tc2() function delete_bdev_tc2() {
{
pmem_print_tc_name ${FUNCNAME[0]} pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file pmem_clean_pool_file
pmem_create_pool_file $default_pool_file 256 512 pmem_create_pool_file $default_pool_file 256 512

View File

@ -12,7 +12,7 @@ source "$rootdir/test/common/autotest_common.sh"
cd "$rootdir" cd "$rootdir"
function unittest_bdev { function unittest_bdev() {
$valgrind $testdir/lib/bdev/bdev.c/bdev_ut $valgrind $testdir/lib/bdev/bdev.c/bdev_ut
$valgrind $testdir/lib/bdev/bdev_ocssd.c/bdev_ocssd_ut $valgrind $testdir/lib/bdev/bdev_ocssd.c/bdev_ocssd_ut
$valgrind $testdir/lib/bdev/raid/bdev_raid.c/bdev_raid_ut $valgrind $testdir/lib/bdev/raid/bdev_raid.c/bdev_raid_ut
@ -25,7 +25,7 @@ function unittest_bdev {
$valgrind $testdir/lib/bdev/mt/bdev.c/bdev_ut $valgrind $testdir/lib/bdev/mt/bdev.c/bdev_ut
} }
function unittest_blob { function unittest_blob() {
$valgrind $testdir/lib/blob/blob.c/blob_ut $valgrind $testdir/lib/blob/blob.c/blob_ut
$valgrind $testdir/lib/blobfs/tree.c/tree_ut $valgrind $testdir/lib/blobfs/tree.c/tree_ut
$valgrind $testdir/lib/blobfs/blobfs_async_ut/blobfs_async_ut $valgrind $testdir/lib/blobfs/blobfs_async_ut/blobfs_async_ut
@ -34,13 +34,13 @@ function unittest_blob {
$valgrind $testdir/lib/blobfs/blobfs_bdev.c/blobfs_bdev_ut $valgrind $testdir/lib/blobfs/blobfs_bdev.c/blobfs_bdev_ut
} }
function unittest_event { function unittest_event() {
$valgrind $testdir/lib/event/subsystem.c/subsystem_ut $valgrind $testdir/lib/event/subsystem.c/subsystem_ut
$valgrind $testdir/lib/event/app.c/app_ut $valgrind $testdir/lib/event/app.c/app_ut
$valgrind $testdir/lib/event/reactor.c/reactor_ut $valgrind $testdir/lib/event/reactor.c/reactor_ut
} }
function unittest_ftl { function unittest_ftl() {
$valgrind $testdir/lib/ftl/ftl_ppa/ftl_ppa_ut $valgrind $testdir/lib/ftl/ftl_ppa/ftl_ppa_ut
$valgrind $testdir/lib/ftl/ftl_band.c/ftl_band_ut $valgrind $testdir/lib/ftl/ftl_band.c/ftl_band_ut
$valgrind $testdir/lib/ftl/ftl_reloc.c/ftl_reloc_ut $valgrind $testdir/lib/ftl/ftl_reloc.c/ftl_reloc_ut
@ -49,7 +49,7 @@ function unittest_ftl {
$valgrind $testdir/lib/ftl/ftl_io.c/ftl_io_ut $valgrind $testdir/lib/ftl/ftl_io.c/ftl_io_ut
} }
function unittest_iscsi { function unittest_iscsi() {
$valgrind $testdir/lib/iscsi/conn.c/conn_ut $valgrind $testdir/lib/iscsi/conn.c/conn_ut
$valgrind $testdir/lib/iscsi/param.c/param_ut $valgrind $testdir/lib/iscsi/param.c/param_ut
$valgrind $testdir/lib/iscsi/tgt_node.c/tgt_node_ut $testdir/lib/iscsi/tgt_node.c/tgt_node.conf $valgrind $testdir/lib/iscsi/tgt_node.c/tgt_node_ut $testdir/lib/iscsi/tgt_node.c/tgt_node.conf
@ -58,14 +58,14 @@ function unittest_iscsi {
$valgrind $testdir/lib/iscsi/portal_grp.c/portal_grp_ut $testdir/lib/iscsi/portal_grp.c/portal_grp.conf $valgrind $testdir/lib/iscsi/portal_grp.c/portal_grp_ut $testdir/lib/iscsi/portal_grp.c/portal_grp.conf
} }
function unittest_json { function unittest_json() {
$valgrind $testdir/lib/json/json_parse.c/json_parse_ut $valgrind $testdir/lib/json/json_parse.c/json_parse_ut
$valgrind $testdir/lib/json/json_util.c/json_util_ut $valgrind $testdir/lib/json/json_util.c/json_util_ut
$valgrind $testdir/lib/json/json_write.c/json_write_ut $valgrind $testdir/lib/json/json_write.c/json_write_ut
$valgrind $testdir/lib/jsonrpc/jsonrpc_server.c/jsonrpc_server_ut $valgrind $testdir/lib/jsonrpc/jsonrpc_server.c/jsonrpc_server_ut
} }
function unittest_nvme { function unittest_nvme() {
$valgrind $testdir/lib/nvme/nvme.c/nvme_ut $valgrind $testdir/lib/nvme/nvme.c/nvme_ut
$valgrind $testdir/lib/nvme/nvme_ctrlr.c/nvme_ctrlr_ut $valgrind $testdir/lib/nvme/nvme_ctrlr.c/nvme_ctrlr_ut
$valgrind $testdir/lib/nvme/nvme_ctrlr_cmd.c/nvme_ctrlr_cmd_ut $valgrind $testdir/lib/nvme/nvme_ctrlr_cmd.c/nvme_ctrlr_cmd_ut
@ -81,7 +81,7 @@ function unittest_nvme {
$valgrind $testdir/lib/nvme/nvme_uevent.c/nvme_uevent_ut $valgrind $testdir/lib/nvme/nvme_uevent.c/nvme_uevent_ut
} }
function unittest_nvmf { function unittest_nvmf() {
$valgrind $testdir/lib/nvmf/ctrlr.c/ctrlr_ut $valgrind $testdir/lib/nvmf/ctrlr.c/ctrlr_ut
$valgrind $testdir/lib/nvmf/ctrlr_bdev.c/ctrlr_bdev_ut $valgrind $testdir/lib/nvmf/ctrlr_bdev.c/ctrlr_bdev_ut
$valgrind $testdir/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut $valgrind $testdir/lib/nvmf/ctrlr_discovery.c/ctrlr_discovery_ut
@ -89,7 +89,7 @@ function unittest_nvmf {
$valgrind $testdir/lib/nvmf/tcp.c/tcp_ut $valgrind $testdir/lib/nvmf/tcp.c/tcp_ut
} }
function unittest_scsi { function unittest_scsi() {
$valgrind $testdir/lib/scsi/dev.c/dev_ut $valgrind $testdir/lib/scsi/dev.c/dev_ut
$valgrind $testdir/lib/scsi/lun.c/lun_ut $valgrind $testdir/lib/scsi/lun.c/lun_ut
$valgrind $testdir/lib/scsi/scsi.c/scsi_ut $valgrind $testdir/lib/scsi/scsi.c/scsi_ut
@ -97,12 +97,12 @@ function unittest_scsi {
$valgrind $testdir/lib/scsi/scsi_pr.c/scsi_pr_ut $valgrind $testdir/lib/scsi/scsi_pr.c/scsi_pr_ut
} }
function unittest_sock { function unittest_sock() {
$valgrind $testdir/lib/sock/sock.c/sock_ut $valgrind $testdir/lib/sock/sock.c/sock_ut
$valgrind $testdir/lib/sock/posix.c/posix_ut $valgrind $testdir/lib/sock/posix.c/posix_ut
} }
function unittest_util { function unittest_util() {
$valgrind $testdir/lib/util/base64.c/base64_ut $valgrind $testdir/lib/util/base64.c/base64_ut
$valgrind $testdir/lib/util/bit_array.c/bit_array_ut $valgrind $testdir/lib/util/bit_array.c/bit_array_ut
$valgrind $testdir/lib/util/cpuset.c/cpuset_ut $valgrind $testdir/lib/util/cpuset.c/cpuset_ut

View File

@ -25,8 +25,7 @@ mkdir -p $TARGET_DIR
# #
source $rootdir/test/vhost/common/autotest.config source $rootdir/test/vhost/common/autotest.config
function vhosttestinit() function vhosttestinit() {
{
if [ "$TEST_MODE" == "iso" ]; then if [ "$TEST_MODE" == "iso" ]; then
$rootdir/scripts/setup.sh $rootdir/scripts/setup.sh
@ -48,15 +47,13 @@ function vhosttestinit()
fi fi
} }
function vhosttestfini() function vhosttestfini() {
{
if [ "$TEST_MODE" == "iso" ]; then if [ "$TEST_MODE" == "iso" ]; then
$rootdir/scripts/setup.sh reset $rootdir/scripts/setup.sh reset
fi fi
} }
function message() function message() {
{
local verbose_out local verbose_out
if ! $SPDK_VHOST_VERBOSE; then if ! $SPDK_VHOST_VERBOSE; then
verbose_out="" verbose_out=""
@ -71,16 +68,14 @@ function message()
echo -e "${msg_type}${verbose_out}: $*" echo -e "${msg_type}${verbose_out}: $*"
} }
function fail() function fail() {
{
echo "===========" >&2 echo "===========" >&2
message "FAIL" "$@" >&2 message "FAIL" "$@" >&2
echo "===========" >&2 echo "===========" >&2
exit 1 exit 1
} }
function error() function error() {
{
echo "===========" >&2 echo "===========" >&2
message "ERROR" "$@" >&2 message "ERROR" "$@" >&2
echo "===========" >&2 echo "===========" >&2
@ -88,18 +83,15 @@ function error()
false false
} }
function warning() function warning() {
{
message "WARN" "$@" >&2 message "WARN" "$@" >&2
} }
function notice() function notice() {
{
message "INFO" "$@" message "INFO" "$@"
} }
function get_vhost_dir() function get_vhost_dir() {
{
local vhost_name="$1" local vhost_name="$1"
if [[ -z "$vhost_name" ]]; then if [[ -z "$vhost_name" ]]; then
@ -110,8 +102,7 @@ function get_vhost_dir()
echo "$TARGET_DIR/${vhost_name}" echo "$TARGET_DIR/${vhost_name}"
} }
function vhost_run() function vhost_run() {
{
local vhost_name="$1" local vhost_name="$1"
local run_gen_nvme=true local run_gen_nvme=true
@ -150,7 +141,8 @@ function vhost_run()
notice "Command: $cmd" notice "Command: $cmd"
timing_enter vhost_start timing_enter vhost_start
cd $vhost_dir; $cmd & cd $vhost_dir
$cmd &
vhost_pid=$! vhost_pid=$!
echo $vhost_pid > $vhost_pid_file echo $vhost_pid > $vhost_pid_file
@ -158,16 +150,14 @@ function vhost_run()
waitforlisten "$vhost_pid" "$vhost_dir/rpc.sock" waitforlisten "$vhost_pid" "$vhost_dir/rpc.sock"
#do not generate nvmes if pci access is disabled #do not generate nvmes if pci access is disabled
if [[ "$cmd" != *"--no-pci"* ]] && [[ "$cmd" != *"-u"* ]] && $run_gen_nvme; then if [[ "$cmd" != *"--no-pci"* ]] && [[ "$cmd" != *"-u"* ]] && $run_gen_nvme; then
$rootdir/scripts/gen_nvme.sh "--json" | $rootdir/scripts/rpc.py\ $rootdir/scripts/gen_nvme.sh "--json" | $rootdir/scripts/rpc.py -s $vhost_dir/rpc.sock load_subsystem_config
-s $vhost_dir/rpc.sock load_subsystem_config
fi fi
notice "vhost started - pid=$vhost_pid" notice "vhost started - pid=$vhost_pid"
timing_exit vhost_start timing_exit vhost_start
} }
function vhost_kill() function vhost_kill() {
{
local rc=0 local rc=0
local vhost_name="$1" local vhost_name="$1"
@ -227,8 +217,7 @@ function vhost_kill()
return $rc return $rc
} }
function vhost_rpc function vhost_rpc() {
{
local vhost_name="$1" local vhost_name="$1"
if [[ -z "$vhost_name" ]]; then if [[ -z "$vhost_name" ]]; then
@ -244,20 +233,18 @@ function vhost_rpc
# Mgmt functions # Mgmt functions
### ###
function assert_number() function assert_number() {
{
[[ "$1" =~ [0-9]+ ]] && return 0 [[ "$1" =~ [0-9]+ ]] && return 0
error "Invalid or missing paramter: need number but got '$1'" error "Invalid or missing paramter: need number but got '$1'"
return 1; return 1
} }
# Run command on vm with given password # Run command on vm with given password
# First argument - vm number # First argument - vm number
# Second argument - ssh password for vm # Second argument - ssh password for vm
# #
function vm_sshpass() function vm_sshpass() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local ssh_cmd local ssh_cmd
@ -271,32 +258,27 @@ function vm_sshpass()
$ssh_cmd "$@" $ssh_cmd "$@"
} }
# Helper to validate VM number # Helper to validate VM number
# param $1 VM number # param $1 VM number
# #
function vm_num_is_valid() function vm_num_is_valid() {
{
[[ "$1" =~ ^[0-9]+$ ]] && return 0 [[ "$1" =~ ^[0-9]+$ ]] && return 0
error "Invalid or missing paramter: vm number '$1'" error "Invalid or missing paramter: vm number '$1'"
return 1; return 1
} }
# Print network socket for given VM number # Print network socket for given VM number
# param $1 virtual machine number # param $1 virtual machine number
# #
function vm_ssh_socket() function vm_ssh_socket() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local vm_dir="$VM_DIR/$1" local vm_dir="$VM_DIR/$1"
cat $vm_dir/ssh_socket cat $vm_dir/ssh_socket
} }
function vm_fio_socket() function vm_fio_socket() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local vm_dir="$VM_DIR/$1" local vm_dir="$VM_DIR/$1"
@ -306,8 +288,7 @@ function vm_fio_socket()
# Execute command on given VM # Execute command on given VM
# param $1 virtual machine number # param $1 virtual machine number
# #
function vm_exec() function vm_exec() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local vm_num="$1" local vm_num="$1"
@ -324,8 +305,7 @@ function vm_exec()
# Execute scp command on given VM # Execute scp command on given VM
# param $1 virtual machine number # param $1 virtual machine number
# #
function vm_scp() function vm_scp() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local vm_num="$1" local vm_num="$1"
@ -339,11 +319,9 @@ function vm_scp()
"$@" "$@"
} }
# check if specified VM is running # check if specified VM is running
# param $1 VM num # param $1 VM num
function vm_is_running() function vm_is_running() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local vm_dir="$VM_DIR/$1" local vm_dir="$VM_DIR/$1"
@ -370,8 +348,7 @@ function vm_is_running()
# check if specified VM is running # check if specified VM is running
# param $1 VM num # param $1 VM num
function vm_os_booted() function vm_os_booted() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local vm_dir="$VM_DIR/$1" local vm_dir="$VM_DIR/$1"
@ -389,12 +366,10 @@ function vm_os_booted()
return 0 return 0
} }
# Shutdown given VM # Shutdown given VM
# param $1 virtual machine number # param $1 virtual machine number
# return non-zero in case of error. # return non-zero in case of error.
function vm_shutdown() function vm_shutdown() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local vm_dir="$VM_DIR/$1" local vm_dir="$VM_DIR/$1"
if [[ ! -d "$vm_dir" ]]; then if [[ ! -d "$vm_dir" ]]; then
@ -419,8 +394,7 @@ function vm_shutdown()
# Kill given VM # Kill given VM
# param $1 virtual machine number # param $1 virtual machine number
# #
function vm_kill() function vm_kill() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local vm_dir="$VM_DIR/$1" local vm_dir="$VM_DIR/$1"
@ -445,10 +419,12 @@ function vm_kill()
# List all VM numbers in VM_DIR # List all VM numbers in VM_DIR
# #
function vm_list_all() function vm_list_all() {
{
local vms local vms
vms="$(shopt -s nullglob; echo $VM_DIR/[0-9]*)" vms="$(
shopt -s nullglob
echo $VM_DIR/[0-9]*
)"
if [[ -n "$vms" ]]; then if [[ -n "$vms" ]]; then
basename --multiple $vms basename --multiple $vms
fi fi
@ -456,8 +432,7 @@ function vm_list_all()
# Kills all VM in $VM_DIR # Kills all VM in $VM_DIR
# #
function vm_kill_all() function vm_kill_all() {
{
local vm local vm
for vm in $(vm_list_all); do for vm in $(vm_list_all); do
vm_kill $vm vm_kill $vm
@ -468,8 +443,7 @@ function vm_kill_all()
# Shutdown all VM in $VM_DIR # Shutdown all VM in $VM_DIR
# #
function vm_shutdown_all() function vm_shutdown_all() {
{
# XXX: temporarily disable to debug shutdown issue # XXX: temporarily disable to debug shutdown issue
# xtrace_disable # xtrace_disable
@ -507,8 +481,7 @@ function vm_shutdown_all()
xtrace_restore xtrace_restore
} }
function vm_setup() function vm_setup() {
{
xtrace_disable xtrace_disable
local OPTIND optchar vm_num local OPTIND optchar vm_num
@ -548,6 +521,7 @@ function vm_setup()
*) *)
error "unknown argument $OPTARG" error "unknown argument $OPTARG"
return 1 return 1
;;
esac esac
;; ;;
*) *)
@ -712,8 +686,8 @@ function vm_setup()
fi fi
# Create disk file if it not exist or it is smaller than 1G # Create disk file if it not exist or it is smaller than 1G
if { [[ -f $raw_disk ]] && [[ $(stat --printf="%s" $raw_disk) -lt $((1024 * 1024 * 1024)) ]]; } || \ if { [[ -f $raw_disk ]] && [[ $(stat --printf="%s" $raw_disk) -lt $((1024 * 1024 * 1024)) ]]; } \
[[ ! -e $raw_disk ]]; then || [[ ! -e $raw_disk ]]; then
if [[ $raw_disk =~ /dev/.* ]]; then if [[ $raw_disk =~ /dev/.* ]]; then
error \ error \
"ERROR: Virtio disk point to missing device ($raw_disk) -\n" \ "ERROR: Virtio disk point to missing device ($raw_disk) -\n" \
@ -819,8 +793,7 @@ function vm_setup()
[[ -z $vm_migrate_to ]] || ln -fs $VM_DIR/$vm_migrate_to $vm_dir/vm_migrate_to [[ -z $vm_migrate_to ]] || ln -fs $VM_DIR/$vm_migrate_to $vm_dir/vm_migrate_to
} }
function vm_run() function vm_run() {
{
local OPTIND optchar vm local OPTIND optchar vm
local run_all=false local run_all=false
local vms_to_run="" local vms_to_run=""
@ -863,8 +836,7 @@ function vm_run()
done done
} }
function vm_print_logs() function vm_print_logs() {
{
vm_num=$1 vm_num=$1
warning "================" warning "================"
warning "QEMU LOG:" warning "QEMU LOG:"
@ -892,8 +864,7 @@ function vm_print_logs()
# Wait for all created VMs to boot. # Wait for all created VMs to boot.
# param $1 max wait time # param $1 max wait time
function vm_wait_for_boot() function vm_wait_for_boot() {
{
assert_number $1 assert_number $1
xtrace_disable xtrace_disable
@ -957,8 +928,7 @@ function vm_wait_for_boot()
return 0 return 0
} }
function vm_start_fio_server() function vm_start_fio_server() {
{
local OPTIND optchar local OPTIND optchar
local readonly='' local readonly=''
while getopts ':-:' optchar; do while getopts ':-:' optchar; do
@ -986,8 +956,7 @@ function vm_start_fio_server()
done done
} }
function vm_check_scsi_location() function vm_check_scsi_location() {
{
# Script to find wanted disc # Script to find wanted disc
local script='shopt -s nullglob; local script='shopt -s nullglob;
for entry in /sys/block/sd*; do for entry in /sys/block/sd*; do
@ -1009,8 +978,7 @@ function vm_check_scsi_location()
# Note: to use this function your VM should be run with # Note: to use this function your VM should be run with
# appropriate memory and with SPDK source already cloned # appropriate memory and with SPDK source already cloned
# and compiled in /root/spdk. # and compiled in /root/spdk.
function vm_check_virtio_location() function vm_check_virtio_location() {
{
vm_exec $1 NRHUGE=512 /root/spdk/scripts/setup.sh vm_exec $1 NRHUGE=512 /root/spdk/scripts/setup.sh
vm_exec $1 "cat > /root/bdev.conf" <<- EOF vm_exec $1 "cat > /root/bdev.conf" <<- EOF
[VirtioPci] [VirtioPci]
@ -1037,16 +1005,14 @@ EOF
# Script to perform scsi device reset on all disks in VM # Script to perform scsi device reset on all disks in VM
# param $1 VM num # param $1 VM num
# param $2..$n Disks to perform reset on # param $2..$n Disks to perform reset on
function vm_reset_scsi_devices() function vm_reset_scsi_devices() {
{
for disk in "${@:2}"; do for disk in "${@:2}"; do
notice "VM$1 Performing device reset on disk $disk" notice "VM$1 Performing device reset on disk $disk"
vm_exec $1 sg_reset /dev/$disk -vNd vm_exec $1 sg_reset /dev/$disk -vNd
done done
} }
function vm_check_blk_location() function vm_check_blk_location() {
{
local script='shopt -s nullglob; cd /sys/block; echo vd*' local script='shopt -s nullglob; cd /sys/block; echo vd*'
SCSI_DISK="$(echo "$script" | vm_exec $1 bash -s)" SCSI_DISK="$(echo "$script" | vm_exec $1 bash -s)"
@ -1056,8 +1022,7 @@ function vm_check_blk_location()
fi fi
} }
function run_fio() function run_fio() {
{
local arg local arg
local job_file="" local job_file=""
local fio_bin="" local fio_bin=""
@ -1083,7 +1048,8 @@ function run_fio()
--plugin) --plugin)
notice "Using plugin mode. Disabling server mode." notice "Using plugin mode. Disabling server mode."
run_plugin_mode=true run_plugin_mode=true
run_server_mode=false ;; run_server_mode=false
;;
--json) fio_output_format="json" ;; --json) fio_output_format="json" ;;
--hide-results) hide_results=true ;; --hide-results) hide_results=true ;;
--no-wait-for-fio) wait_for_fio=false ;; --no-wait-for-fio) wait_for_fio=false ;;
@ -1162,8 +1128,7 @@ function run_fio()
# Shutdown or kill any running VM and SPDK APP. # Shutdown or kill any running VM and SPDK APP.
# #
function at_app_exit() function at_app_exit() {
{
local vhost_name local vhost_name
notice "APP EXITING" notice "APP EXITING"
@ -1179,8 +1144,7 @@ function at_app_exit()
notice "EXIT DONE" notice "EXIT DONE"
} }
function error_exit() function error_exit() {
{
trap - ERR trap - ERR
print_backtrace print_backtrace
set +e set +e

View File

@ -17,9 +17,11 @@ used_vms=""
x="" x=""
readonly="" readonly=""
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Shortcut script for doing automated test" echo "Shortcut script for doing automated test"
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
echo echo
@ -62,9 +64,11 @@ while getopts 'xh-:' optchar; do
esac esac
;; ;;
h) usage $0 ;; h) usage $0 ;;
x) set -x x)
x="-x" ;; set -x
*) usage $0 "Invalid argument '$OPTARG'" x="-x"
;;
*) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
@ -153,7 +157,7 @@ for vm_conf in "${vms[@]}"; do
fi fi
done done
done <<< "${conf[2]}" done <<< "${conf[2]}"
unset IFS; unset IFS
$rpc_py vhost_get_controllers $rpc_py vhost_get_controllers
fi fi
@ -188,7 +192,7 @@ if [[ $test_type == "spdk_vhost_scsi" ]]; then
$rpc_py vhost_scsi_controller_add_target naa.$disk.${conf[0]} 0 $based_disk $rpc_py vhost_scsi_controller_add_target naa.$disk.${conf[0]} 0 $based_disk
done done
done <<< "${conf[2]}" done <<< "${conf[2]}"
unset IFS; unset IFS
done done
fi fi

View File

@ -17,9 +17,11 @@ scsi_hot_remove_test=0
blk_hot_remove_test=0 blk_hot_remove_test=0
readonly="" readonly=""
function usage() { function usage() {
[[ -n $2 ]] && ( echo "$2"; echo ""; ) [[ -n $2 ]] && (
echo "$2"
echo ""
)
echo "Shortcut script for doing automated hotattach/hotdetach test" echo "Shortcut script for doing automated hotattach/hotdetach test"
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
echo echo
@ -57,9 +59,11 @@ while getopts 'xh-:' optchar; do
esac esac
;; ;;
h) usage $0 ;; h) usage $0 ;;
x) set -x x)
x="-x" ;; set -x
*) usage $0 "Invalid argument '$OPTARG'" x="-x"
;;
*) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
done done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
@ -176,7 +180,6 @@ function wait_for_finish() {
wait $wait_for_pid wait $wait_for_pid
} }
function reboot_all_and_prepare() { function reboot_all_and_prepare() {
vms_reboot_all "$1" vms_reboot_all "$1"
vms_prepare "$1" vms_prepare "$1"

View File

@ -74,7 +74,6 @@ function prepare_fio_cmd_tc2_iter2() {
done done
} }
function prepare_fio_cmd_tc3_iter1() { function prepare_fio_cmd_tc3_iter1() {
print_test_fio_header print_test_fio_header

View File

@ -14,8 +14,7 @@ function run_spdk_fio() {
fio_bdev --ioengine=spdk_bdev "$@" --spdk_mem=1024 --spdk_single_seg=1 fio_bdev --ioengine=spdk_bdev "$@" --spdk_mem=1024 --spdk_single_seg=1
} }
function create_bdev_config() function create_bdev_config() {
{
if [ -z "$($RPC_PY bdev_get_bdevs | jq '.[] | select(.name=="Nvme0n1")')" ]; then if [ -z "$($RPC_PY bdev_get_bdevs | jq '.[] | select(.name=="Nvme0n1")')" ]; then
error "Nvme0n1 bdev not found!" error "Nvme0n1 bdev not found!"
fi fi

View File

@ -8,9 +8,11 @@ source $rootdir/test/vhost/common.sh
ctrl_type="spdk_vhost_scsi" ctrl_type="spdk_vhost_scsi"
vm_fs="ext4" vm_fs="ext4"
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Shortcut script for doing automated test" echo "Shortcut script for doing automated test"
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
echo echo
@ -25,8 +27,7 @@ function usage()
exit 0 exit 0
} }
function clean_lvol_cfg() function clean_lvol_cfg() {
{
notice "Removing lvol bdev and lvol store" notice "Removing lvol bdev and lvol store"
$rpc_py bdev_lvol_delete lvol_store/lvol_bdev $rpc_py bdev_lvol_delete lvol_store/lvol_bdev
$rpc_py bdev_lvol_delete_lvstore -l lvol_store $rpc_py bdev_lvol_delete_lvstore -l lvol_store
@ -43,9 +44,11 @@ while getopts 'xh-:' optchar; do
esac esac
;; ;;
h) usage $0 ;; h) usage $0 ;;
x) set -x x)
x="-x" ;; set -x
*) usage $0 "Invalid argument '$OPTARG'" x="-x"
;;
*) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
done done

View File

@ -11,7 +11,10 @@ if [[ $1 == "spdk_vhost_scsi" ]]; then
fi fi
done done
elif [[ $1 == "spdk_vhost_blk" ]]; then elif [[ $1 == "spdk_vhost_blk" ]]; then
devs=$(cd /sys/block; echo vd*) devs=$(
cd /sys/block
echo vd*
)
fi fi
fs=$2 fs=$2

View File

@ -15,9 +15,11 @@ use_fs=false
nested_lvol=false nested_lvol=false
distribute_cores=false distribute_cores=false
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Shortcut script for doing automated test" echo "Shortcut script for doing automated test"
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
echo echo
@ -47,8 +49,7 @@ function usage()
exit 0 exit 0
} }
function clean_lvol_cfg() function clean_lvol_cfg() {
{
notice "Removing nested lvol bdevs" notice "Removing nested lvol bdevs"
for lvol_bdev in "${nest_lvol_bdevs[@]}"; do for lvol_bdev in "${nest_lvol_bdevs[@]}"; do
$rpc_py bdev_lvol_delete $lvol_bdev $rpc_py bdev_lvol_delete $lvol_bdev
@ -91,9 +92,11 @@ while getopts 'xh-:' optchar; do
esac esac
;; ;;
h) usage $0 ;; h) usage $0 ;;
x) set -x x)
x="-x" ;; set -x
*) usage $0 "Invalid argument '$OPTARG'" x="-x"
;;
*) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
done done

View File

@ -25,7 +25,7 @@ case $1 in
echo "" echo ""
echo "Tests are performed only on Linux machine. For other OS no action is performed." echo "Tests are performed only on Linux machine. For other OS no action is performed."
echo "" echo ""
exit 0; exit 0
;; ;;
esac esac

View File

@ -1,5 +1,4 @@
function migration_tc1_clean_vhost_config() function migration_tc1_clean_vhost_config() {
{
# Restore trap # Restore trap
trap 'error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT trap 'error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
@ -14,8 +13,7 @@ function migration_tc1_clean_vhost_config()
unset -v incoming_vm target_vm incoming_vm_ctrlr target_vm_ctrlr rpc unset -v incoming_vm target_vm incoming_vm_ctrlr target_vm_ctrlr rpc
} }
function migration_tc1_configure_vhost() function migration_tc1_configure_vhost() {
{
# Those are global intentionally - they will be unset in cleanup handler # Those are global intentionally - they will be unset in cleanup handler
incoming_vm=0 incoming_vm=0
target_vm=1 target_vm=1
@ -36,8 +34,7 @@ function migration_tc1_configure_vhost()
$rpc vhost_scsi_controller_add_target $target_vm_ctrlr 0 Malloc0 $rpc vhost_scsi_controller_add_target $target_vm_ctrlr 0 Malloc0
} }
function migration_tc1_error_handler() function migration_tc1_error_handler() {
{
trap - SIGINT ERR EXIT trap - SIGINT ERR EXIT
warning "Migration TC1 ERROR HANDLER" warning "Migration TC1 ERROR HANDLER"
print_backtrace print_backtrace
@ -49,8 +46,7 @@ function migration_tc1_error_handler()
warning "Migration TC1 FAILED" warning "Migration TC1 FAILED"
} }
function migration_tc1() function migration_tc1() {
{
# Use 2 VMs: # Use 2 VMs:
# incoming VM - the one we want to migrate # incoming VM - the one we want to migrate
# targe VM - the one which will accept migration # targe VM - the one which will accept migration

View File

@ -1,7 +1,6 @@
source $rootdir/test/nvmf/common.sh source $rootdir/test/nvmf/common.sh
function migration_tc2_cleanup_nvmf_tgt() function migration_tc2_cleanup_nvmf_tgt() {
{
local i local i
if [[ ! -r "$nvmf_dir/nvmf_tgt.pid" ]]; then if [[ ! -r "$nvmf_dir/nvmf_tgt.pid" ]]; then
@ -34,8 +33,7 @@ function migration_tc2_cleanup_nvmf_tgt()
unset -v nvmf_dir rpc_nvmf unset -v nvmf_dir rpc_nvmf
} }
function migration_tc2_cleanup_vhost_config() function migration_tc2_cleanup_vhost_config() {
{
timing_enter migration_tc2_cleanup_vhost_config timing_enter migration_tc2_cleanup_vhost_config
trap 'migration_tc2_cleanup_nvmf_tgt SIGKILL; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT trap 'migration_tc2_cleanup_nvmf_tgt SIGKILL; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
@ -64,8 +62,7 @@ function migration_tc2_cleanup_vhost_config()
timing_exit migration_tc2_cleanup_vhost_config timing_exit migration_tc2_cleanup_vhost_config
} }
function migration_tc2_configure_vhost() function migration_tc2_configure_vhost() {
{
timing_enter migration_tc2_configure_vhost timing_enter migration_tc2_configure_vhost
# Those are global intentionally - they will be unset in cleanup handler # Those are global intentionally - they will be unset in cleanup handler
@ -146,8 +143,7 @@ function migration_tc2_configure_vhost()
timing_exit migration_tc2_configure_vhost timing_exit migration_tc2_configure_vhost
} }
function migration_tc2_error_cleanup() function migration_tc2_error_cleanup() {
{
trap - SIGINT ERR EXIT trap - SIGINT ERR EXIT
set -x set -x
@ -156,8 +152,7 @@ function migration_tc2_error_cleanup()
notice "Migration TC2 FAILED" notice "Migration TC2 FAILED"
} }
function migration_tc2() function migration_tc2() {
{
# Use 2 VMs: # Use 2 VMs:
# incoming VM - the one we want to migrate # incoming VM - the one we want to migrate
# targe VM - the one which will accept migration # targe VM - the one which will accept migration

View File

@ -26,8 +26,7 @@ if [ -z "$RDMA_INITIATOR_IP" ]; then
error "No IP address of initiators RDMA capable NIC is given" error "No IP address of initiators RDMA capable NIC is given"
fi fi
function ssh_remote() function ssh_remote() {
{
local ssh_cmd="sshpass -p root ssh \ local ssh_cmd="sshpass -p root ssh \
-o UserKnownHostsFile=/dev/null \ -o UserKnownHostsFile=/dev/null \
-o StrictHostKeyChecking=no \ -o StrictHostKeyChecking=no \
@ -39,8 +38,7 @@ function ssh_remote()
$ssh_cmd "$@" $ssh_cmd "$@"
} }
function wait_for_remote() function wait_for_remote() {
{
local timeout=40 local timeout=40
set +x set +x
while [[ ! -f $share_dir/DONE ]]; do while [[ ! -f $share_dir/DONE ]]; do
@ -54,8 +52,7 @@ function wait_for_remote()
rm -f $share_dir/DONE rm -f $share_dir/DONE
} }
function check_rdma_connection() function check_rdma_connection() {
{
local nic_name local nic_name
nic_name=$(ip -4 -o addr show to $RDMA_TARGET_IP up | cut -d' ' -f2) nic_name=$(ip -4 -o addr show to $RDMA_TARGET_IP up | cut -d' ' -f2)
if [[ -z $nic_name ]]; then if [[ -z $nic_name ]]; then
@ -68,8 +65,7 @@ function check_rdma_connection()
} }
function host1_cleanup_nvmf() function host1_cleanup_nvmf() {
{
notice "Shutting down nvmf_tgt on local server" notice "Shutting down nvmf_tgt on local server"
if [[ -n "$1" ]]; then if [[ -n "$1" ]]; then
pkill --signal $1 -F $nvmf_dir/nvmf_tgt.pid pkill --signal $1 -F $nvmf_dir/nvmf_tgt.pid
@ -79,8 +75,7 @@ function host1_cleanup_nvmf()
rm -f $nvmf_dir/nvmf_tgt.pid rm -f $nvmf_dir/nvmf_tgt.pid
} }
function host1_cleanup_vhost() function host1_cleanup_vhost() {
{
trap 'host1_cleanup_nvmf SIGKILL; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT trap 'host1_cleanup_nvmf SIGKILL; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
notice "Shutting down VM $incoming_vm" notice "Shutting down VM $incoming_vm"
vm_kill $incoming_vm vm_kill $incoming_vm
@ -95,8 +90,7 @@ function host1_cleanup_vhost()
host1_cleanup_nvmf host1_cleanup_nvmf
} }
function host1_start_nvmf() function host1_start_nvmf() {
{
nvmf_dir="$TEST_DIR/nvmf_tgt" nvmf_dir="$TEST_DIR/nvmf_tgt"
rpc_nvmf="$rootdir/scripts/rpc.py -s $nvmf_dir/nvmf_rpc.sock" rpc_nvmf="$rootdir/scripts/rpc.py -s $nvmf_dir/nvmf_rpc.sock"
@ -118,8 +112,7 @@ function host1_start_nvmf()
$rpc_nvmf nvmf_subsystem_add_listener nqn.2018-02.io.spdk:cnode1 -t rdma -a $RDMA_TARGET_IP -s 4420 $rpc_nvmf nvmf_subsystem_add_listener nqn.2018-02.io.spdk:cnode1 -t rdma -a $RDMA_TARGET_IP -s 4420
} }
function host1_start_vhost() function host1_start_vhost() {
{
rpc_0="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock" rpc_0="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
notice "Starting vhost0 instance on local server" notice "Starting vhost0 instance on local server"
@ -140,8 +133,7 @@ function host1_start_vhost()
vm_wait_for_boot 300 $incoming_vm vm_wait_for_boot 300 $incoming_vm
} }
function cleanup_share() function cleanup_share() {
{
set +e set +e
notice "Cleaning up share directory on remote and local server" notice "Cleaning up share directory on remote and local server"
ssh_remote $MGMT_INITIATOR_IP "umount $VM_BASE_DIR" ssh_remote $MGMT_INITIATOR_IP "umount $VM_BASE_DIR"
@ -151,8 +143,7 @@ function cleanup_share()
set -e set -e
} }
function host_1_create_share() function host_1_create_share() {
{
notice "Creating share directory on local server to re-use on remote" notice "Creating share directory on local server to re-use on remote"
mkdir -p $share_dir mkdir -p $share_dir
mkdir -p $VM_BASE_DIR # This dir would've been created later but we need it now mkdir -p $VM_BASE_DIR # This dir would've been created later but we need it now
@ -161,8 +152,7 @@ function host_1_create_share()
tar --exclude="*.o" --exclude="*.d" --exclude="*.git" -C $rootdir -zcf $share_dir/spdk.tar.gz . tar --exclude="*.o" --exclude="*.d" --exclude="*.git" -C $rootdir -zcf $share_dir/spdk.tar.gz .
} }
function host_2_create_share() function host_2_create_share() {
{
# Copy & compile the sources for later use on remote server. # Copy & compile the sources for later use on remote server.
ssh_remote $MGMT_INITIATOR_IP "uname -a" ssh_remote $MGMT_INITIATOR_IP "uname -a"
ssh_remote $MGMT_INITIATOR_IP "mkdir -p $share_dir" ssh_remote $MGMT_INITIATOR_IP "mkdir -p $share_dir"
@ -179,8 +169,7 @@ function host_2_create_share()
ssh_remote $MGMT_INITIATOR_IP "cd $spdk_repo_share_dir/spdk; make clean; ./configure --with-rdma --enable-debug; make -j40" ssh_remote $MGMT_INITIATOR_IP "cd $spdk_repo_share_dir/spdk; make clean; ./configure --with-rdma --enable-debug; make -j40"
} }
function host_2_start_vhost() function host_2_start_vhost() {
{
ssh_remote $MGMT_INITIATOR_IP "nohup $spdk_repo_share_dir/spdk/test/vhost/migration/migration.sh\ ssh_remote $MGMT_INITIATOR_IP "nohup $spdk_repo_share_dir/spdk/test/vhost/migration/migration.sh\
--test-cases=3b --os=$share_dir/migration.qcow2\ --test-cases=3b --os=$share_dir/migration.qcow2\
--rdma-tgt-ip=$RDMA_TARGET_IP &>$share_dir/output.log &" --rdma-tgt-ip=$RDMA_TARGET_IP &>$share_dir/output.log &"
@ -188,15 +177,13 @@ function host_2_start_vhost()
wait_for_remote wait_for_remote
} }
function setup_share() function setup_share() {
{
trap 'cleanup_share; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT trap 'cleanup_share; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
host_1_create_share host_1_create_share
host_2_create_share host_2_create_share
} }
function migration_tc3() function migration_tc3() {
{
check_rdma_connection check_rdma_connection
setup_share setup_share
host1_start_nvmf host1_start_nvmf

View File

@ -10,8 +10,7 @@ target_vm_ctrl=naa.VhostScsi0.$target_vm
rpc="$rootdir/scripts/rpc.py -s $(get_vhost_dir 1)/rpc.sock" rpc="$rootdir/scripts/rpc.py -s $(get_vhost_dir 1)/rpc.sock"
share_dir=$VHOST_DIR/share share_dir=$VHOST_DIR/share
function host_2_cleanup_vhost() function host_2_cleanup_vhost() {
{
notice "Shutting down VM $target_vm" notice "Shutting down VM $target_vm"
vm_kill $target_vm vm_kill $target_vm
@ -24,8 +23,7 @@ function host_2_cleanup_vhost()
sleep 1 sleep 1
} }
function host_2_start_vhost() function host_2_start_vhost() {
{
echo "BASE DIR $VHOST_DIR" echo "BASE DIR $VHOST_DIR"
vhost_work_dir=$VHOST_DIR/vhost1 vhost_work_dir=$VHOST_DIR/vhost1
mkdir -p $vhost_work_dir mkdir -p $vhost_work_dir

View File

@ -7,7 +7,6 @@ source $rootdir/test/vhost/common.sh
source $testdir/migration-tc1.sh source $testdir/migration-tc1.sh
source $testdir/migration-tc2.sh source $testdir/migration-tc2.sh
vms=() vms=()
declare -A vms_os declare -A vms_os
declare -A vms_raw_disks declare -A vms_raw_disks
@ -20,9 +19,11 @@ MGMT_TARGET_IP=""
MGMT_INITIATOR_IP="" MGMT_INITIATOR_IP=""
RDMA_TARGET_IP="" RDMA_TARGET_IP=""
RDMA_INITIATOR_IP="" RDMA_INITIATOR_IP=""
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Shortcut script for doing automated test of live migration." echo "Shortcut script for doing automated test of live migration."
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
echo echo
@ -51,7 +52,8 @@ for param in "$@"; do
-v) SPDK_VHOST_VERBOSE=true ;; -v) SPDK_VHOST_VERBOSE=true ;;
*) *)
usage $0 "Invalid argument '$param'" usage $0 "Invalid argument '$param'"
exit 1;; exit 1
;;
esac esac
done done
@ -59,8 +61,7 @@ vhosttestinit
trap 'error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT trap 'error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
function vm_monitor_send() function vm_monitor_send() {
{
local vm_num=$1 local vm_num=$1
local cmd_result_file="$2" local cmd_result_file="$2"
local vm_dir="$VM_DIR/$1" local vm_dir="$VM_DIR/$1"
@ -74,8 +75,7 @@ function vm_monitor_send()
} }
# Migrate VM $1 # Migrate VM $1
function vm_migrate() function vm_migrate() {
{
local from_vm_dir="$VM_DIR/$1" local from_vm_dir="$VM_DIR/$1"
local target_vm_dir local target_vm_dir
local target_vm local target_vm
@ -122,8 +122,7 @@ function vm_migrate()
timing_exit vm_migrate timing_exit vm_migrate
} }
function is_fio_running() function is_fio_running() {
{
xtrace_disable xtrace_disable
if vm_exec $1 'kill -0 $(cat /root/fio.pid)'; then if vm_exec $1 'kill -0 $(cat /root/fio.pid)'; then

View File

@ -5,9 +5,11 @@ rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh source $rootdir/test/common/autotest_common.sh
source $rootdir/test/vhost/common.sh source $rootdir/test/vhost/common.sh
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Shortcut script for running vhost app." echo "Shortcut script for running vhost app."
echo "Usage: $(basename $1) [-x] [-h|--help] [--clean-build]" echo "Usage: $(basename $1) [-x] [-h|--help] [--clean-build]"
echo "-h, --help print help and exit" echo "-h, --help print help and exit"

View File

@ -34,9 +34,11 @@ disk_cfg_splits=()
disk_cfg_vms=() disk_cfg_vms=()
disk_cfg_kernel_names=() disk_cfg_kernel_names=()
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Shortcut script for doing automated test" echo "Shortcut script for doing automated test"
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
echo echo
@ -77,8 +79,7 @@ function usage()
exit 0 exit 0
} }
function cleanup_lvol_cfg() function cleanup_lvol_cfg() {
{
notice "Removing lvol bdevs" notice "Removing lvol bdevs"
for lvol_bdev in "${lvol_bdevs[@]}"; do for lvol_bdev in "${lvol_bdevs[@]}"; do
$rpc_py bdev_lvol_delete $lvol_bdev $rpc_py bdev_lvol_delete $lvol_bdev
@ -92,24 +93,21 @@ function cleanup_lvol_cfg()
done done
} }
function cleanup_split_cfg() function cleanup_split_cfg() {
{
notice "Removing split vbdevs" notice "Removing split vbdevs"
for disk in "${disk_cfg_spdk_names[@]}"; do for disk in "${disk_cfg_spdk_names[@]}"; do
$rpc_py bdev_split_delete ${disk}n1 $rpc_py bdev_split_delete ${disk}n1
done done
} }
function cleanup_parted_config() function cleanup_parted_config() {
{
notice "Removing parted disk configuration" notice "Removing parted disk configuration"
for disk in "${disk_cfg_kernel_names[@]}"; do for disk in "${disk_cfg_kernel_names[@]}"; do
parted -s /dev/${disk}n1 rm 1 parted -s /dev/${disk}n1 rm 1
done done
} }
function cleanup_kernel_vhost() function cleanup_kernel_vhost() {
{
notice "Cleaning kernel vhost configration" notice "Cleaning kernel vhost configration"
targetcli clearconfig confirm=True targetcli clearconfig confirm=True
cleanup_parted_config cleanup_parted_config
@ -172,9 +170,11 @@ while getopts 'xh-:' optchar; do
esac esac
;; ;;
h) usage $0 ;; h) usage $0 ;;
x) set -x x)
x="-x" ;; set -x
*) usage $0 "Invalid argument '$OPTARG'" x="-x"
;;
*) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
done done
@ -239,7 +239,6 @@ done
unset IFS unset IFS
set -x set -x
if [[ "$ctrl_type" == "kernel_vhost" ]]; then if [[ "$ctrl_type" == "kernel_vhost" ]]; then
notice "Configuring kernel vhost..." notice "Configuring kernel vhost..."
trap 'vm_kill_all; sleep 1; cleanup_kernel_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR trap 'vm_kill_all; sleep 1; cleanup_kernel_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR

View File

@ -8,8 +8,7 @@ disk_name="vda"
test_folder_name="readonly_test" test_folder_name="readonly_test"
test_file_name="some_test_file" test_file_name="some_test_file"
function error() function error() {
{
echo "===========" echo "==========="
echo -e "ERROR: $*" echo -e "ERROR: $*"
echo "===========" echo "==========="

View File

@ -8,8 +8,7 @@ disk_name="vda"
test_folder_name="readonly_test" test_folder_name="readonly_test"
test_file_name="some_test_file" test_file_name="some_test_file"
function error() function error() {
{
echo "===========" echo "==========="
echo -e "ERROR: $*" echo -e "ERROR: $*"
echo "===========" echo "==========="

View File

@ -8,8 +8,7 @@ disk_name="vda"
test_folder_name="readonly_test" test_folder_name="readonly_test"
test_file_name="some_test_file" test_file_name="some_test_file"
function error() function error() {
{
echo "===========" echo "==========="
echo -e "ERROR: $*" echo -e "ERROR: $*"
echo "===========" echo "==========="

View File

@ -11,9 +11,11 @@ vm_img=""
disk="Nvme0n1" disk="Nvme0n1"
x="" x=""
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Shortcut script for automated readonly test for vhost-block" echo "Shortcut script for automated readonly test for vhost-block"
echo "For test details check test_plan.md" echo "For test details check test_plan.md"
echo echo
@ -34,13 +36,15 @@ while getopts 'xh-:' optchar; do
help) usage $0 && exit 0 ;; help) usage $0 && exit 0 ;;
vm_image=*) vm_img="${OPTARG#*=}" ;; vm_image=*) vm_img="${OPTARG#*=}" ;;
disk=*) disk="${OPTARG#*=}" ;; disk=*) disk="${OPTARG#*=}" ;;
*) usage $0 "Invalid argument '$OPTARG'" && exit 1 *) usage $0 "Invalid argument '$OPTARG'" && exit 1 ;;
esac esac
;; ;;
h) usage $0 && exit 0 ;; h) usage $0 && exit 0 ;;
x) set -x x)
x="-x" ;; set -x
*) usage $0 "Invalid argument '$OPTARG'" && exit 1 x="-x"
;;
*) usage $0 "Invalid argument '$OPTARG'" && exit 1 ;;
esac esac
done done
@ -52,16 +56,14 @@ if [[ $EUID -ne 0 ]]; then
fail "Go away user come back as root" fail "Go away user come back as root"
fi fi
function print_tc_name() function print_tc_name() {
{
notice "" notice ""
notice "===============================================================" notice "==============================================================="
notice "Now running: $1" notice "Now running: $1"
notice "===============================================================" notice "==============================================================="
} }
function blk_ro_tc1() function blk_ro_tc1() {
{
print_tc_name ${FUNCNAME[0]} print_tc_name ${FUNCNAME[0]}
local vm_no="0" local vm_no="0"
local disk_name=$disk local disk_name=$disk

View File

@ -10,8 +10,7 @@ source $rootdir/test/bdev/nbd_common.sh
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock" rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
vm_no="0" vm_no="0"
function err_clean function err_clean() {
{
trap - ERR trap - ERR
print_backtrace print_backtrace
set +e set +e
@ -25,9 +24,11 @@ function err_clean
exit 1 exit 1
} }
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Usage: $(basename $1) vm_image=PATH [-h|--help]" echo "Usage: $(basename $1) vm_image=PATH [-h|--help]"
echo "-h, --help Print help and exit" echo "-h, --help Print help and exit"
echo " --vm_image=PATH Path to VM image used in these tests" echo " --vm_image=PATH Path to VM image used in these tests"

View File

@ -11,9 +11,11 @@ ssh_pass=""
vm_num="0" vm_num="0"
vm_image="/home/sys_sgsw/windows_server.qcow2" vm_image="/home/sys_sgsw/windows_server.qcow2"
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Windows Server automated test" echo "Windows Server automated test"
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
echo "--vm-ssh-pass=PASSWORD Text password for the VM" echo "--vm-ssh-pass=PASSWORD Text password for the VM"
@ -38,9 +40,11 @@ while getopts 'xh-:' optchar; do
esac esac
;; ;;
h) usage $0 ;; h) usage $0 ;;
x) set -x x)
x="-x" ;; set -x
*) usage $0 "Invalid argument '$OPTARG'" x="-x"
;;
*) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
done done
@ -53,8 +57,7 @@ done
# But they apply to rather old Windows distributions. # But they apply to rather old Windows distributions.
# Potentially using Windows Server 2016 and newer may solve the issue # Potentially using Windows Server 2016 and newer may solve the issue
# due to OpenSSH being available directly from Windows Store. # due to OpenSSH being available directly from Windows Store.
function vm_sshpass() function vm_sshpass() {
{
vm_num_is_valid $1 || return 1 vm_num_is_valid $1 || return 1
local ssh_cmd local ssh_cmd

View File

@ -16,9 +16,11 @@ vm_num=1
keep_results_dir=false keep_results_dir=false
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock" rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
function usage() function usage() {
{ [[ -n $2 ]] && (
[[ -n $2 ]] && ( echo "$2"; echo ""; ) echo "$2"
echo ""
)
echo "Windows Server scsi compliance test" echo "Windows Server scsi compliance test"
echo "Usage: $(basename $1) [OPTIONS]" echo "Usage: $(basename $1) [OPTIONS]"
echo " --vm-ssh-pass=PASSWORD Text password for the VM" echo " --vm-ssh-pass=PASSWORD Text password for the VM"
@ -39,7 +41,7 @@ while getopts 'h-:' optchar; do
esac esac
;; ;;
h) usage $0 ;; h) usage $0 ;;
*) usage $0 "Invalid argument '$OPTARG'" *) usage $0 "Invalid argument '$OPTARG'" ;;
esac esac
done done

View File

@ -8,27 +8,28 @@ source $rootdir/test/common/autotest_common.sh
rpc_py=$rootdir/scripts/rpc.py rpc_py=$rootdir/scripts/rpc.py
VMD_WHITELIST=() VMD_WHITELIST=()
function vmd_identify { function vmd_identify() {
for bdf in $pci_devs; do for bdf in $pci_devs; do
$rootdir/examples/nvme/identify/identify -i 0 -V -r "trtype:PCIe traddr:$bdf" $rootdir/examples/nvme/identify/identify -i 0 -V -r "trtype:PCIe traddr:$bdf"
done done
} }
function vmd_perf { function vmd_perf() {
for bdf in $pci_devs; do for bdf in $pci_devs; do
$rootdir/examples/nvme/perf/perf -q 128 -w read -o 12288 -t 1 -LL -i 0 -V -r "trtype:PCIe traddr:$bdf" $rootdir/examples/nvme/perf/perf -q 128 -w read -o 12288 -t 1 -LL -i 0 -V -r "trtype:PCIe traddr:$bdf"
done done
} }
function vmd_fio { function vmd_fio() {
PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin
for bdf in $pci_devs; do for bdf in $pci_devs; do
fio_nvme $testdir/config/config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=1" fio_nvme $testdir/config/config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=1"
done done
} }
function vmd_bdev_svc { function vmd_bdev_svc() {
$rootdir/test/app/bdev_svc/bdev_svc --wait-for-rpc & svcpid=$! $rootdir/test/app/bdev_svc/bdev_svc --wait-for-rpc &
svcpid=$!
trap 'killprocess $svcpid; exit 1' SIGINT SIGTERM EXIT trap 'killprocess $svcpid; exit 1' SIGINT SIGTERM EXIT
# Wait until bdev_svc starts # Wait until bdev_svc starts
@ -45,7 +46,6 @@ function vmd_bdev_svc {
killprocess $svcpid killprocess $svcpid
} }
# Re-run setup.sh script and only attach VMD devices to uio/vfio. # Re-run setup.sh script and only attach VMD devices to uio/vfio.
$rootdir/scripts/setup.sh reset $rootdir/scripts/setup.sh reset