From 1c2391c8d6a12710615bb6ad246fb5f579e29859 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Sat, 29 Jun 2019 16:44:13 +0200 Subject: [PATCH] #673 adapted stresstest fpr RaspberryPi4 --- home.admin/config.scripts/blitz.stresstest.sh | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/home.admin/config.scripts/blitz.stresstest.sh b/home.admin/config.scripts/blitz.stresstest.sh index dddb5ee..25df1d5 100644 --- a/home.admin/config.scripts/blitz.stresstest.sh +++ b/home.admin/config.scripts/blitz.stresstest.sh @@ -26,7 +26,29 @@ if [ ${sysbenchInstalled} -eq 0 ];then fi # do debug outputs to the STDERR - so that the STDOUT is just the results in the end -echo "RaspiBlitz Hardwaretest v0.1" >&2 +echo "RaspiBlitz Hardwaretest v0.2" >&2 + +# detect hardware version of RaspberryPi +# https://www.unixtutorial.org/command-to-confirm-raspberry-pi-model +raspberryPi=${cat /proc/device-tree/model | cut -d " " -f 3 | sed 's/[^0-9]*//g'} +if [ ${#raspberryPi} -eq 0 ]; then + raspberryPi=0 +fi +echo "RaspberryPi Model Version: ${raspberryPi}" +if [ ${raspberryPi} -lt 4 ]; then + # raspberryPi 3 and lower (microUSB power connector) + voltWARN=1230000 + voltFAIL=1200100 + tempWARN=6500 + tempFAIL=6999 +else + # raspberryPi 4 and up (USB-C power connector) + voltWARN=871800 + voltFAIL=871800 + tempWARN=7599 + tempFAIL=7799 +fi + echo "Starting sysbench to run for 60 seconds (--max-time=60 --cpu-max-prime=10000)" >&2 # result values @@ -61,11 +83,11 @@ for (( n=0; n<15; ++n )); do voltFloat=$(echo "${CoreVoltage/V/}*1000000" | bc) voltInt=${voltFloat/.*} #echo "V -> ${voltFloat}/${voltInt}" - if [ ${voltInt} -lt 1200100 ] && [ ${powerWARN} -gt 1 ]; then + if [ ${voltInt} -lt ${voltFAIL} ] && [ ${powerWARN} -gt 1 ]; then ((powerFAIL=powerFAIL+1)) echo "--> Power CRITICAL detected" >&2 fi - if [ ${voltInt} -lt 1230000 ]; then + if [ ${voltInt} -lt ${voltWARN} ]; then ((powerWARN=powerWARN+1)) echo "--> Power WARN detected" >&2 fi @@ -77,11 +99,11 @@ for (( n=0; n<15; ++n )); do tempFloat=$(echo "${Temp/\'C/}*100" | bc) tempInt=${tempFloat/.*} #echo "T -> ${tempFloat}/${tempInt}" - if [ ${tempInt} -gt 6999 ]; then + if [ ${tempInt} -gt ${tempFAIL} ]; then ((tempFAIL=tempFAIL+1)) echo "--> Temp CRITICAL detected" >&2 fi - if [ ${tempInt} -gt 6500 ]; then + if [ ${tempInt} -gt ${tempWARN} ]; then ((tempWARN=tempWARN+1)) echo "--> Temp WARN detected" >&2 fi @@ -93,6 +115,7 @@ for (( n=0; n<15; ++n )); do done if [ ${#filenameForReport} -eq 0 ]; then + echo "raspberryPi=${raspberryPi}" echo "powerFAIL=${powerFAIL}" echo "powerWARN=${powerWARN}" echo "powerMIN='${powerMIN} microVolt'" @@ -100,7 +123,8 @@ if [ ${#filenameForReport} -eq 0 ]; then echo "tempWARN=${tempWARN}" echo "tempMAX='${tempMAX} centiGrad'" else - echo "powerFAIL=${powerFAIL}" >${filenameForReport} + echo "raspberryPi=${raspberryPi}" >${filenameForReport} + echo "powerFAIL=${powerFAIL}" >>${filenameForReport} echo "powerWARN=${powerWARN}" >>${filenameForReport} echo "powerMIN='${powerMIN} microVolt'" >>${filenameForReport} echo "tempFAIL=${tempFAIL}" >>${filenameForReport}