From ba647c3d0a13843262b26ae0b0f2a17f32c36244 Mon Sep 17 00:00:00 2001 From: Sandino Araico Sanchez Date: Mon, 16 Jan 2017 05:04:09 -0600 Subject: [PATCH] test scripts ready for production --- scripts/test-fio | 2 +- scripts/wrapper-fio | 49 ++++++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/scripts/test-fio b/scripts/test-fio index 098e540..73af299 100755 --- a/scripts/test-fio +++ b/scripts/test-fio @@ -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 diff --git a/scripts/wrapper-fio b/scripts/wrapper-fio index 2efcee9..e54817e 100755 --- a/scripts/wrapper-fio +++ b/scripts/wrapper-fio @@ -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=''