test/nvme: fix wrong exit commands.
Issue reports: return: can only `return' from a function or sourced script. Use "exit 1" instead, and ignore changes to json.power_on_time.hours. Issue link: https://github.com/spdk/spdk/issues/1111 This is to fix issue #1111 Signed-off-by: dongx.yi <dongx.yi@intel.com> Change-Id: I90198e8237cb587fbeb7777f6b2da783fd15ba04 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478014 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
dda7375177
commit
0edc874f85
@ -22,7 +22,7 @@ $rpc_py bdev_nvme_cuse_register -n Nvme0
|
||||
sleep 5
|
||||
|
||||
if [ ! -c /dev/spdk/nvme0 ]; then
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$rpc_py bdev_get_bdevs
|
||||
@ -46,26 +46,26 @@ for ctrlr in $(ls /dev/spdk/nvme?); do
|
||||
done
|
||||
|
||||
if [ ! -c /dev/spdk/nvme0 ]; then
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$rpc_py bdev_nvme_cuse_unregister -n Nvme0
|
||||
sleep 1
|
||||
if [ -c /dev/spdk/nvme0 ]; then
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$rpc_py bdev_nvme_cuse_register -n Nvme0
|
||||
sleep 1
|
||||
|
||||
if [ ! -c /dev/spdk/nvme0 ]; then
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$rpc_py bdev_nvme_detach_controller Nvme0
|
||||
sleep 1
|
||||
if [ -c /dev/spdk/nvme0 ]; then
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
|
@ -17,7 +17,7 @@ sleep 1
|
||||
bdf_sysfs_path=$( readlink -f /sys/class/nvme/nvme* | grep "$bdf/nvme/nvme" )
|
||||
if [ -z "$bdf_sysfs_path" ]; then
|
||||
echo "setup.sh failed bind kernel driver to ${bdf}"
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
nvme_name=$( basename $bdf_sysfs_path )
|
||||
|
||||
@ -42,7 +42,7 @@ $rpc_py bdev_nvme_cuse_register -n Nvme0
|
||||
sleep 5
|
||||
|
||||
if [ ! -c /dev/spdk/nvme0 ]; then
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CUSE_SMART_JSON=$( ${SMARTCTL_CMD} --json=g -a /dev/spdk/nvme0 | grep -v "/dev/spdk/nvme0" | sort || true )
|
||||
@ -50,17 +50,17 @@ CUSE_SMART_JSON=$( ${SMARTCTL_CMD} --json=g -a /dev/spdk/nvme0 | grep -v "/dev/s
|
||||
DIFF_SMART_JSON=$( diff --changed-group-format='%<' --unchanged-group-format='' <(echo "$KERNEL_SMART_JSON") <(echo "$CUSE_SMART_JSON") || true)
|
||||
|
||||
# Mask values can change
|
||||
ERR_SMART_JSON=$( grep -v "json\.nvme_smart_health_information_log\.\|json\.local_time\.\|json\.temperature\." <<< $DIFF_SMART_JSON || true )
|
||||
ERR_SMART_JSON=$( grep -v "json\.nvme_smart_health_information_log\.\|json\.local_time\.\|json\.temperature\.\|json\.power_on_time\.hours" <<< $DIFF_SMART_JSON || true )
|
||||
|
||||
if [ -n "$ERR_SMART_JSON" ] ; then
|
||||
echo "Wrong values for: $ERR_SMART_JSON"
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CUSE_SMART_ERRLOG=$( ${SMARTCTL_CMD} -l error /dev/spdk/nvme0 )
|
||||
if [ "$CUSE_SMART_ERRLOG" != "$KERNEL_SMART_ERRLOG" ]; then
|
||||
echo "Wrong values in NVMe Error log"
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Data integity was checked before, now make sure other commads didn't fail
|
||||
@ -75,7 +75,7 @@ ${SMARTCTL_CMD} -H /dev/spdk/nvme0 || true
|
||||
$rpc_py bdev_nvme_detach_controller Nvme0
|
||||
sleep 1
|
||||
if [ -c /dev/spdk/nvme1 ]; then
|
||||
return 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
|
Loading…
x
Reference in New Issue
Block a user