/usr/lib/plainbox-provider-checkbox/bin/disk_read_performance_test is in plainbox-provider-checkbox 0.25-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #!/bin/bash
#
# Verify that disk storage performs at or above baseline performance
#
#Default to a lower bound of 15 MB/s
DEFAULT_BUF_READ=15
for disk in $@; do
echo "Beginning $0 test for $disk"
echo "---------------------------------------------------"
disk_type=`udevadm info --name /dev/$disk --query property | grep "ID_BUS" | awk '{gsub(/ID_BUS=/," ")}{printf $1}'`
dev_path=`udevadm info --name /dev/$disk --query property | grep "DEVPATH" | awk '{gsub(/DEVPATH=/," ")}{printf $1}'`
echo "INFO: $disk type is $disk_type"
case $disk_type in
"usb" )
#Custom metrics are guesstimates for now...
MIN_BUF_READ=7
# Increase MIN_BUF_READ if a USB3 device is plugged in a USB3 hub port
if [[ $dev_path =~ ((.*usb[0-9]+).*\/)[0-9]-[0-9\.:\-]+\/.* ]]; then
device_version=`cat '/sys/'${BASH_REMATCH[1]}'/version'`
hub_port_version=`cat '/sys/'${BASH_REMATCH[2]}'/version'`
if [ $(echo "$device_version >= 3.00"|bc -l) -eq 1 -a $(echo "$hub_port_version >= 3.00"|bc -l) -eq 1 ]; then
MIN_BUF_READ=80
fi
fi
;;
"ide" ) MIN_BUF_READ=40;;
* ) MIN_BUF_READ=$DEFAULT_BUF_READ;;
esac
echo "INFO: $disk_type: Using $MIN_BUF_READ MB/sec as the minimum throughput speed"
max_speed=0
echo ""
echo "Beginning hdparm timing runs"
echo "---------------------------------------------------"
for iteration in `seq 1 10`; do
speed=`hdparm -t /dev/$disk 2>/dev/null | grep "Timing buffered disk reads" | awk -F"=" '{print $2}' | awk '{print $1}'`
echo "INFO: Iteration $iteration: Detected speed is $speed MB/sec"
if [ -z "$speed" ]; then
echo "WARNING: Device $disk is too small! Aborting test."
exit 0
fi
speed=${speed/.*}
if [ $speed -gt $max_speed ]; then
max_speed=$speed
fi
done
echo "INFO: Maximum detected speed is $max_speed MB/sec"
echo "---------------------------------------------------"
echo ""
result=0
if [ $max_speed -gt $MIN_BUF_READ ]; then
echo "PASS: $disk Max Speed of $max_speed MB/sec is faster than Minimum Buffer Read Speed of $MIN_BUF_READ MB/sec"
else
echo "FAIL: $disk Max Speed of $max_speed MB/sec is slower than Minimum Buffer Read Speed of $MIN_BUF_READ MB/sec"
result=1
fi
done
if [ $result -gt 0 ]; then
echo "WARNING: One or more disks failed testing!"
exit 1
else
echo "All devices passed testing!"
exit 0
fi
|