Vitaly Shaburov
#!/bin/bash
LOG="/var/tmp/zfstest.$(date +%F-%T).txt"
ipa=$(sudo ifconfig | grep -A 1 vmxnet3s0 | sed '1d; s/^[ \t]*inet[ \t]*//; s/[ \t]*netmask.*$//')
sudo /sbin/zpool destroy testpool
sudo -E /usr/sbin/svcadm disable -s svc:/system/fmd:default
sudo -E find /var/fm/fmd -type f -exec rm {} \;
sudo -E /usr/sbin/svcadm enable svc:/system/fmd:default
# we need 3 x 8G drives with 512b sector size
export DISKS="$1 $2 $3"
export KEEP="rpool data"
export ZFS_USE_ONLY_DISKS=yes
#remove partition on disks
for D in $DISKS
do
sudo -E /usr/bin/dd if=/dev/null of=/dev/dsk/${D}p0 bs=512 count=512K
done
# cleanup drives before tests:
sudo -E /sbin/zpool create -f test123321 $DISKS
sudo -E /sbin/zpool destroy test123321
sudo -E rm -rf /tmp/mnt* /tmp/ufs.* /tmp/log.* /tmp/tmp.* /tmp/rst* /tmp/tmpfs*
test -d /var/tmp/test_results && sudo rm -rf /var/tmp/test_results
sudo -E /usr/sbin/devfsadm -C
uname -a > ${LOG}
echo "IP Address : ${ipa}" >> ${LOG}
echo "" >> ${LOG}
echo "Disk IDs : $DISKS" 2>&1 | /usr/bin/tee -a ${LOG}
# run tests
/bin/ksh /opt/zfs-tests/bin/zfstest $* 2>&1 | /usr/bin/tee -a /var/tmp/z.tmp
echo "Results Summary" >> ${LOG}
echo "" >> ${LOG}
skip=$(sed -n '/^SKIP[ \t]*/p' /var/tmp/z.tmp | sed 's/^SKIP[ \t]*//; s/[ \t]*$//')
fail=$(sed -n '/^FAIL[ \t]*/p' /var/tmp/z.tmp | sed 's/^FAIL[ \t]*//; s/[ \t]*$//')
pass=$(sed -n '/^PASS[ \t]*/p' /var/tmp/z.tmp | sed 's/^PASS[ \t]*//; s/[ \t]*$//')
total=0
if [ "${pass}" != "" ]; then
total=$((${total} + ${pass}))
fi
if [ "${fail}" != "" ]; then
total=$((${total} + ${fail}))
fi
if [ "${skip}" != "" ]; then
total=$((${total} + ${skip}))
fi
echo "TOTAL TESTS: $total" >> ${LOG}
sed '1,/Results Summary/d' /var/tmp/z.tmp >> ${LOG}
sudo rm -f /var/tmp/z.tmp
{"serverDuration": 21, "requestCorrelationId": "1d579e0e73524fadaeb55b3a3c350bae"}