Fix formatting; Fix bug in GeekBench failure detection

This commit is contained in:
Mason Rowe 2020-12-29 08:39:49 -05:00 committed by GitHub
parent bf01122bde
commit 7978df4c3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

91
yabs.sh
View File

@ -15,7 +15,7 @@
echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #' echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
echo -e '# Yet-Another-Bench-Script #' echo -e '# Yet-Another-Bench-Script #'
echo -e '# v2020-12-27 #' echo -e '# v2020-12-29 #'
echo -e '# https://github.com/masonr/yet-another-bench-script #' echo -e '# https://github.com/masonr/yet-another-bench-script #'
echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #' echo -e '# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #'
@ -344,57 +344,56 @@ if [[ -z "$SKIP_FIO" && "$AVAIL_SPACE" -lt 2097152 ]]; then # 2GB = 2097152KB
echo -e "\nLess than 2GB of space available. Skipping disk test..." echo -e "\nLess than 2GB of space available. Skipping disk test..."
# if the skip disk flag was set, skip the disk performance test, otherwise test disk performance # if the skip disk flag was set, skip the disk performance test, otherwise test disk performance
elif [ -z "$SKIP_FIO" ]; then elif [ -z "$SKIP_FIO" ]; then
echo -en "\nPreparing system for disk tests..." # Perform ZFS filesystem detection and determine if we have enough free space according to spa_asize_inflation
ZFSCHECK="/sys/module/zfs/parameters/spa_asize_inflation"
if [[ -f "$ZFSCHECK" ]];then
mul_spa=$((($(cat /sys/module/zfs/parameters/spa_asize_inflation)*2)))
warning=0
poss=()
# Perform ZFS filesystem detection and determine if we have enough free space according to spa_asize_inflation for pathls in $(df -Th | awk '{print $7}' | tail -n +2)
ZFSCHECK="/sys/module/zfs/parameters/spa_asize_inflation" do
if [[ -f "$ZFSCHECK" ]];then if [[ "${PWD##$pathls}" != "${PWD}" ]]; then
mul_spa=$((($(cat /sys/module/zfs/parameters/spa_asize_inflation)*2))) poss+=($pathls)
warning=0 fi
poss=() done
for pathls in $(df -Th | awk '{print $7}' | tail -n +2) long=""
do m=-1
if [[ "${PWD##$pathls}" != "${PWD}" ]]; then for x in ${poss[@]}
poss+=($pathls) do
if [ ${#x} -gt $m ];then
m=${#x}
long=$x
fi
done
size_b=$(df -Th | grep -w $long | grep -i zfs | awk '{print $5}' | tail -c 2 | head -c 1)
free_space=$(df -Th | grep -w $long | grep -i zfs | awk '{print $5}' | head -c -2)
if [[ $size_b == 'T' ]]; then
free_space=$(bc <<< "$free_space*1024")
size_b='G'
fi fi
done
if [[ $(df -Th | grep -w $long) == *"zfs"* ]];then
long=""
m=-1 if [[ $size_b == 'G' ]]; then
for x in ${poss[@]} if [[ $(echo "$free_space < $mul_spa" | bc) -ne 0 ]];then
do warning=1
if [ ${#x} -gt $m ];then fi
m=${#x} else
long=$x
fi
done
size_b=$(df -Th | grep -w $long | grep -i zfs | awk '{print $5}' | tail -c 2 | head -c 1)
free_space=$(df -Th | grep -w $long | grep -i zfs | awk '{print $5}' | head -c -2)
if [[ $size_b == 'T' ]]; then
free_space=$(bc <<< "$free_space*1024")
size_b='G'
fi
if [[ $(df -Th | grep -w $long) == *"zfs"* ]];then
if [[ $size_b == 'G' ]]; then
if [[ $(echo "$free_space < $mul_spa" | bc) -ne 0 ]];then
warning=1 warning=1
fi fi
else
warning=1 fi
if [[ $warning -eq 1 ]];then
echo -en "\nWarning! You are running YABS on a ZFS Filesystem and your disk space is too low for the fio test. Your test results will be inaccurate. You need at least $mul_spa GB free in order to complete this test accurately. For more information, please see https://github.com/masonr/yet-another-bench-script/issues/13\n"
fi fi
fi fi
if [[ $warning -eq 1 ]];then echo -en "\nPreparing system for disk tests..."
echo -en "\nWarning! You are running YABS on a ZFS Filesystem and your disk space is too low for the fio test. Your test results will be inaccurate. You need at least $mul_spa GB free in order to complete this test accurately. For more information, please see https://github.com/masonr/yet-another-bench-script/issues/13\n"
fi
fi
# create temp directory to store disk write/read test files # create temp directory to store disk write/read test files
DISK_PATH=$YABS_PATH/disk DISK_PATH=$YABS_PATH/disk
@ -716,7 +715,7 @@ function launch_geekbench {
# ensure the test ran successfully # ensure the test ran successfully
if [ -z "$GEEKBENCH_TEST" ]; then if [ -z "$GEEKBENCH_TEST" ]; then
if [[ ! -z "$IPV4_CHECK" ]]; then if [[ -z "$IPV4_CHECK" ]]; then
# Geekbench test failed to download because host lacks IPv4 (cdn.geekbench.com = IPv4 only) # Geekbench test failed to download because host lacks IPv4 (cdn.geekbench.com = IPv4 only)
echo -e "\r\033[0KGeekbench releases can only be downloaded over IPv4. FTP the Geekbench files and run manually." echo -e "\r\033[0KGeekbench releases can only be downloaded over IPv4. FTP the Geekbench files and run manually."
elif [[ $ARCH != *x86* ]]; then elif [[ $ARCH != *x86* ]]; then