test scripts ready for production

This commit is contained in:
Sandino Araico Sanchez 2017-01-16 05:04:09 -06:00
parent 3bbbf9fb52
commit ba647c3d0a
2 changed files with 27 additions and 24 deletions

View file

@ -20,7 +20,7 @@ if [[ "$1" == "force" ]] ; then
rm -f $OUTPUT_DIR/disk/*.fio.result
fi
MAXWAIT=9
MAXWAIT=69
JOBS=0
if [[ $SUMMARY == 0 ]] ; then
echo -n "BEGIN: " >> $OUTPUT_DIR/fio.log

View file

@ -40,8 +40,6 @@ if [[ $DISK_SERIAL != $SERIAL ]] ; then
exit 15
fi
#TPATTERN=0x55
TPATTERN=0xaa
# TODO: Debug limit. Comment out for production
#LST_BLCK=10000000
SMARTLOG=300 # check every 5 minutes
@ -49,11 +47,8 @@ SMARTLOG=300 # check every 5 minutes
# TODO: Debug variable. Comment out for production
#SMARTLOG=15 # Check every second
BLK_SIZE=`cat /sys/block/$DISK/queue/physical_block_size`
MAX_SAME=`cat /sys/block/$DISK/queue/write_same_max_bytes`
CONCU=$(( MAX_SAME / ( BLK_SIZE / 2 ) ))
[[ $CONCU == 0 ]] && CONCU=32768
cat >> $OUTPUT_DIR/disk/$DISK.job << EOF
cat > $OUTPUT_DIR/disk/$DISK.job << EOF
[global]
ioengine=libaio
direct=1
@ -61,9 +56,9 @@ gtod_reduce=1
bs=$BLK_SIZE
iodepth=64
# TODO: Uncomment for production
#size=4G
size=4G
# TODO: Debug variable. Comment out for production
size=128M
#size=16M
readwrite=randrw
rwmixread=75
directory=/mnt/$DISK
@ -90,7 +85,7 @@ else
| cut -d ':' -f 2
`
# TODO: Debug variable. Comment out for production
ERROR=
#ERROR=
if [[ -n $ERROR ]] ; then
RAW_ERROR=$ERROR
ERROR=''
@ -104,21 +99,27 @@ else
fi
fi
if [[ -z $ERROR ]] ; then
sfdisk /dev/$DISK << EOF
# partition table of /dev/sdb
unit: sectors
/dev/sdb1 : start= 1, size=1953525167, Id=ee
/dev/sdb2 : start= 0, size= 0, Id= 0
/dev/sdb3 : start= 0, size= 0, Id= 0
/dev/sdb4 : start= 0, size= 0, Id= 0
EOF
mkfs.ext4 /dev/${DISK}1
# Reset partition table to zero
dd if=/dev/zero of=/dev/${DISK} bs=$BLK_SIZE count=128 \
>> /run/$SERIAL.fio.out 2>&1
parted /dev/${DISK} mklabel gpt mkpart primary 1 128G \
>> /run/$SERIAL.fio.out 2>&1
sleep 1
if [[ ! -b /dev/${DISK}1 ]] ; then
echo "Device /dev/${DISK}1 is not a block special file"
exit 17
fi
mkfs.ext4 /dev/${DISK}1 \
>> /run/$SERIAL.fio.out 2>&1
mkdir -pv /mnt/${DISK}
mount /dev/${DISK}1 /mnt/${DISK}
MOUNTED=`cat /proc/mounts | grep ${DISK}1`
if [[ -z $MOUNTED ]] ; then
echo "Device /dev/${DISK}1 is not mounted"
exit 18
fi
fio --output $OUTPUT_DIR/disk/$SERIAL.fio.out \
$OUTPUT_DIR/disk/$DISK.job \
2> /run/$SERIAL.fio.out &
$OUTPUT_DIR/disk/$DISK.job &
TEST_PID=`jobs -p %+`
echo $TEST_PID > /run/$SERIAL.fio.pid
while [[ -d /proc/$TEST_PID ]] ; do
@ -127,6 +128,8 @@ EOF
| parse-smart-error \
| sed 's/://g'
`
# TODO: Debug variable. Comment out for production
#ERROR=
if [[ -n $ERROR ]] ; then
smartctl -l error /dev/$DISK \
> $OUTPUT_DIR/disk/$SERIAL.smart.error
@ -135,7 +138,7 @@ EOF
fi
sleep $SMARTLOG
done
umount /mnt/${DISK}
umount -f /mnt/${DISK}
# Reset partition table to zero
dd if=/dev/zero of=/dev/${DISK} bs=$BLK_SIZE count=128 \
>> /run/$SERIAL.fio.out 2>&1
@ -147,7 +150,7 @@ EOF
| cut -d ':' -f 2
`
# TODO: Debug variable. Comment out for production
ERROR=
#ERROR=
if [[ -n $ERROR ]] ; then
RAW_ERROR=$ERROR
ERROR=''