Add example setup, open-iscsi, libiscsi test scripts

This commit is contained in:
T.Paul Lee
2017-10-04 17:56:56 +08:00
parent b1a5b5344c
commit 58d5eb9810
8 changed files with 367 additions and 1 deletions

26
test/test-cleanup.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
# Trying our best to clean up the test environment to repeat the test.
[ ! -n "$LIBISCSIPATH" ] && echo "Need LIBISCSIPATH defintion" && exit 1
[ ! -d $LIBISCSIPATH ] && echo "Need $LIBISCSIPATH directory" && exit 3
[ ! -x /sbin/iscsiadm ] && echo "/sbin/iscsiadm not built" && exit 9
# kill off daemon
#killall gotgt
# empty backend file
echo > /var/tmp/disk.img
# empty config file
echo > ${HOME}/.gotgt/config.jason
# Delete existing /dev/sdb1 partition if found
sudo lsblk -l | grep sdb1
if [ $? -eq 0 ]
then
/bin/echo -e "p\nd\nw" | sudo fdisk /dev/sdb
fi
#unmount /var/tmp/test
sudo umount /var/tmp/test
exit 0