From 751a28b86a1bb5f4a5d409b99a4f4e63c944cbaf Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Wed, 11 Mar 2020 22:01:20 +0100 Subject: [PATCH] New options - add Bluetooth test - split wireless network tests to 2.4 and 5Ghz band - add option to exclude certain IP addresses - display a list of all boards before starting the test Signed-off-by: Igor Pecovnik --- README.md | 61 ++++++++++++------- go.sh | 20 ++++-- lib/configuration.sh | 3 + lib/functions.sh | 11 ++-- tests/0000-armbian-first-login.bash | 50 --------------- ...01-connect-wireless-devices-on-2.4Ghz.bash | 9 +-- tests/0003-iperf-on-all-interfaces.bash | 5 +- ...05-connect-wireless-devices-on-5.0Ghz.bash | 5 +- tests/0008-bluetoth.bash | 10 +++ tests/0015-strong-stressing.bash | 4 +- tests/0016-dvfs.bash | 10 +++ tests/0019-7-zip-benchmark.bash | 4 +- tests/9999-reboot.bash | 2 +- 13 files changed, 93 insertions(+), 101 deletions(-) delete mode 100755 tests/0000-armbian-first-login.bash create mode 100755 tests/0008-bluetoth.bash create mode 100755 tests/0016-dvfs.bash diff --git a/README.md b/README.md index 65f89a4..0accad5 100644 --- a/README.md +++ b/README.md @@ -17,45 +17,64 @@ Connects to host(s) or all Armbian hosts in your subnet and run tests found in t One test cycle: - [ o.k. ] Host x.x.x.x found [ Run 1 out of 3 ] - [ o.k. ] 0000-armbian-first-login.bash [ 00:37:13 ] - [ o.k. ] 0001-connect-wireless-devices-on-2.4Ghz.bash [ Cubox i2eX/i4 @ 00:37:26 ] + [ o.k. ] Host x.x.x.x found [ Run 1 out of 1 ] + [ o.k. ] 0001-connect-wireless-devices-on-2.4Ghz.bash [ Tinkerboard @ x.x.x.x ] [ o.k. ] ... [ wlan0 ] [ o.k. ] ... [ wlxxxxxxxxxxxxx ] - [ o.k. ] 0003-iperf-on-all-interfaces.bash [ Cubox i2eX/i4 @ 00:37:49 ] - [ o.k. ] ..."eth0" ethernet (fec), hw, mtu 1500 [ ~399 MBits/s ~564 MBits/s ] - [ o.k. ] ..."Broadcom BCM4330" wifi (brcmfmac), hw, mtu 1500 [ ~63 MBits/s ] - [ o.k. ] ..."Realtek RTL8811AU 802.11a/b/g/n/ac" wifi (88XXau), hw, mtu 2312 [ ~73 MBits/s ] - [ o.k. ] 0005-connect-wireless-devices-on-5.0Ghz.bash [ Cubox i2eX/i4 @ 00:38:40 ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] 0003-iperf-on-all-interfaces.bash [ Tinkerboard @ x.x.x.x ] + [ o.k. ] ..."eth0" ethernet (rk_gmac-dwmac), hw, mtu 1500 [ ~941 MBits/s ~944 MBits/s ] + [ o.k. ] ..."wlan0" wifi (rtl8723bs), hw, mtu 1500 [ ~50 MBits/s ] + [ o.k. ] ..."148f 7601" wifi (mt7601u), hw, mtu 1500 [ ~28 MBits/s ] + [ o.k. ] ..."Realtek 802.11n NIC" wifi (8188eu), hw, mtu 1500 [ ~60 MBits/s ] + [ o.k. ] ..."Realtek 802.11ac NIC" wifi (rtl8821cu), hw, mtu 1500 [ ~0 MBits/s ] + [ o.k. ] ..."Realtek 802.11ac WLAN Adapter" wifi (rtl88xxau), hw, mtu 2312 [ ~61 MBits/s ] + [ o.k. ] ..."Ralink 802.11 n WLAN" wifi (rt2800usb), hw, mtu 1500 [ ~55 MBits/s ] + [ o.k. ] ..."Realtek AC1200 MU-MIMO USB2.0 Adapter" wifi (rtl88x2bu), hw, mtu 1500 [ ~58 MBits/s ] + [ o.k. ] 0005-connect-wireless-devices-on-5.0Ghz.bash [ Tinkerboard @ x.x.x.x ] [ o.k. ] ... [ wlan0 ] [ o.k. ] ... [ wlxxxxxxxxxxxxx ] - [ o.k. ] 0003-iperf-on-all-interfaces.bash [ Cubox i2eX/i4 @ 00:39:31 ] - [ o.k. ] ..."eth0" ethernet (fec), hw, mtu 1500 [ ~400 MBits/s ~552 MBits/s ] - [ o.k. ] ..."Realtek RTL8811AU 802.11a/b/g/n/ac" wifi (88XXau), hw, mtu 2312 [ ~205 MBits/s ] - [ o.k. ] 0015-strong-stressing.bash [ 00:40:11 + 100s ] - [ o.k. ] 0019-7-zip-benchmark.bash [ 00:41:52 ] - [ o.k. ] 9999-reboot.bash [ 00:45:16 ] - [ warn ] Rebooting in 3 seconds [ x.x.x.x ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] ... [ wlxxxxxxxxxxxxx ] + [ o.k. ] 0003-iperf-on-all-interfaces.bash [ Tinkerboard @ x.x.x.x ] + [ o.k. ] ..."eth0" ethernet (rk_gmac-dwmac), hw, mtu 1500 [ ~941 MBits/s ~944 MBits/s ] + [ o.k. ] ..."wlan0" wifi (rtl8723bs), hw, mtu 1500 [ ~22 MBits/s ] + [ o.k. ] ..."Realtek 802.11ac NIC" wifi (rtl8821cu), hw, mtu 1500 [ ~118 MBits/s ] + [ o.k. ] ..."Realtek AC1200 MU-MIMO USB2.0 Adapter" wifi (rtl88x2bu), hw, mtu 1500 [ ~130 MBits/s ] + [ o.k. ] 0008-bluetoth.bash [ Tinkerboard @ x.x.x.x ] + [ o.k. ] Bluetooth ping to your test device was succesfull [ Mi Telefon ] + [ o.k. ] 0016-dvfs.bash [ Tinkerboard @ x.x.x.x ] + [ o.k. ] DVFS works [ 600 - 1800 Mhz ] + [ o.k. ] 9999-reboot.bash [ 21:51:57 ] + [ o.k. ] Rebooting in 3 seconds [ x.x.x.x ] # Which tests are executed? | test name | function | |:-|:-| |0000-armbian-first-login.bash|Changes password and creates username| -|0001-connect-wireless-devices.bash|Connects wireless devices| +|0001-connect-wireless-devices-on-2.4Ghz.bash|Connects wireless devices on 2.4G band| |0003-iperf-on-all-interfaces.bash|Check speed on all devices| -|0005-used-wireless-modules.bash|Display used wireless modules| +|0005-connect-wireless-devices-on-5Ghz.bash|Connects wireless devices on 5G band| +|0007-iperf-on-all-interfaces.bash|Check speed on all devices| +|0008-bluetoth.bash|Ping Bluetooth device to check basic BT functionality| |0015-strong-stressing.bash|Running heavy stressing for n seconds| +|0016-dvfs.bash|Get min and max CPU temperature to see if DVFS is operational| |0019-7-zip-benchmark.bash|Run 7Zip benchmark| -|0030-install-armbian-config.bash|Install armbian-config tool| |9999-reboot.bash|Reboot the board| To do: -- add more tests -- make roboust -- data collecting +- improve errors catching +- common data collecting - support custom test board https://forum.armbian.com/topic/10841-the-testing-thread ![Semantic description of image](https://forum.armbian.com/uploads/monthly_2019_09/IMG_0031.thumb.JPG.25382da99ba09c22c27cf8d274141b8b.JPG "Image Title") diff --git a/go.sh b/go.sh index adc898a..13fd973 100755 --- a/go.sh +++ b/go.sh @@ -20,20 +20,30 @@ source lib/functions.sh # remove logs rm -rf logs/* +[[ -n $EXCLUDE ]] && HOST_EXCLUDE="--exclude ${EXCLUDE}" + if [[ -n $SUBNET ]]; then - readarray -t array < <(nmap --open -sn ${SUBNET} | grep "ssh\|Nmap scan report" | grep -v "gateway" | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}') + readarray -t hostarray < <(nmap $HOST_EXCLUDE --open -sn ${SUBNET} | grep "ssh\|Nmap scan report" | grep -v "gateway" | grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}') elif [[ -n $HOSTS ]]; then IFS=', ' read -r -a array <<< "$HOSTS" else echo "\$HOST not defined. Exiting." && exit 1 fi +BOARD_NAMES=() +for HOST in "${hostarray[@]}"; do + readarray -t array < <(find $SRC/init -maxdepth 2 -type f -name '*.bash' | sort) + for u in "${array[@]}" + do + . $u + BOARD_NAMES+=("$BOARD_NAME") + done +done - - -for HOST in "${array[@]}"; do +x=0 +for HOST in "${hostarray[@]}"; do rm -f logs/${HOST}.log - export HOST run_tests + x=$((x+1)) [[ $? -ne 0 ]] && display_alert "Host failed" "$HOST" "err" done diff --git a/lib/configuration.sh b/lib/configuration.sh index 6f47ebb..5c2f33c 100644 --- a/lib/configuration.sh +++ b/lib/configuration.sh @@ -20,9 +20,12 @@ OTHER_NORMAL="" HOSTS="" # comma delimited IP addresses # or SUBNET="" # Example 192.168.1.0/24 +EXCLUDE="" # Example 10.0.30.99,10.0.30.1 WLAN_ID_24="" WLAN_PASS_24="" WLAN_ID_50="" WLAN_PASS_50="" + +BLUEDEV="" # MAC address of your BT device, usually phone which is near by testing devices to make a ping diff --git a/lib/functions.sh b/lib/functions.sh index 4d42f0a..dbfdb45 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -69,23 +69,20 @@ display_alert() function run_tests { -x=1 +r=1 i=1 SUM=0 START=$(date +%s) -while [ $x -le ${PASSES} ] +while [ $r -le ${PASSES} ] do -while ! ping -c1 $HOST &>/dev/null; do display_alert "Ping $HOST failed $i" "$(date +%R:%S)" "wrn"; sleep 2; i=$(( $i + 1 )); [[ $i -gt 5 ]] && return 1;done ; START=$(date +%s); display_alert "Host ${HOST} found" "Run $x out of ${PASSES}" "info"; +while ! ping -c1 $HOST &>/dev/null; do display_alert "Ping $HOST failed $i" "$(date +%R:%S)" "info"; sleep 2; i=$(( $i + 1 )); [[ $i -gt 5 ]] && return 1;done ; START=$(date +%s); display_alert "Host ${HOST} found" "Run $r out of ${PASSES}" "info"; - TIMES[$x]=$(date +%s) i=1 - nc -zvw3 $HOST 22 &> /dev/null if [[ $? -ne 0 ]]; then display_alert "Can't connect. SSH on $HOST is closed" "$(date +%R:%S)" "wrn" else - readarray -t array < <(find $SRC/tests -maxdepth 2 -type f -name '*.bash' | sort) for u in "${array[@]}" @@ -94,7 +91,7 @@ while ! ping -c1 $HOST &>/dev/null; do display_alert "Ping $HOST failed $i" "$(d done fi - x=$(( $x + 1 )) + r=$(( $r + 1 )) done } diff --git a/tests/0000-armbian-first-login.bash b/tests/0000-armbian-first-login.bash deleted file mode 100755 index 61c4d86..0000000 --- a/tests/0000-armbian-first-login.bash +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -source $SRC/lib/functions.sh - -display_alert "$(basename $BASH_SOURCE)" "$(date +%R:%S)" "info" -ssh-keygen -qf "/root/.ssh/known_hosts" -R "${HOST}" > /dev/null 2>&1 -sshpass -p 1234 ssh -o "StrictHostKeyChecking=accept-new" ${USER_ROOT}@${HOST} "\x03" &>/dev/null -if [[ $? -eq 1 ]]; then - # clean keys - # pass user creation to expect - display_alert "Conduct first login steps" "root/${PASS_ROOT} and ${USER_NORMAL}/${PASS_NORMAL}" "info" - - MAKE_USER=$(expect -c " - spawn sshpass -p 1234 ssh -o "StrictHostKeyChecking=accept-new" ${USER_ROOT}@${HOST} - set timeout 10 - expect \"Current password:\" - send \"1234\r\" - expect \"New password:\" - send \"${PASS_ROOT}\r\" - expect \"Re-enter new password:\" - send \"${PASS_ROOT}\r\" - expect \"(eg. your forename):\" - send \"${USER_NORMAL}\r\" - expect \"New password:\" - send \"${PASS_NORMAL}\r\" - expect \"Retype new password:\" - send \"${PASS_NORMAL}\r\" - expect \"Name\" - send \"${NAME_NORMAL}\r\" - expect \"Room Number\" - send \"${ROOM_NORMAL}\r\" - expect \"Work Phone\" - send \"${WORKPHONE_NORMAL}\r\" - expect \"Home Phone\" - send \"${HOMEPHONE_NORMAL}\r\" - expect \"Other\" - send \"${OTHER_NORMAL}\r\" - expect \"information correct\" - send \"Y\r\" - expect eof - ") - # Disable user creation: send \"\x03\" - # display output - echo "${MAKE_USER}" | tee -a logs/${HOST}.log -fi -sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "apt -qq -y install jq stress armbian-config" &>/dev/null -BOARD_NAME=$(sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "cat /etc/armbian-release | grep BOARD_NAME | sed 's/\"//g' | cut -d "=" -f2") - -# cat armbian release file to the logs -sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "cat /etc/armbian-release | sed -e 's/^/'$(date +%R:%S)' /' ">> ${SRC}/logs/${HOST}.txt 2>&1 diff --git a/tests/0001-connect-wireless-devices-on-2.4Ghz.bash b/tests/0001-connect-wireless-devices-on-2.4Ghz.bash index 5798f66..8d88e7e 100755 --- a/tests/0001-connect-wireless-devices-on-2.4Ghz.bash +++ b/tests/0001-connect-wireless-devices-on-2.4Ghz.bash @@ -1,11 +1,7 @@ #!/bin/bash source $SRC/lib/functions.sh -display_alert "$(basename $BASH_SOURCE)" "$BOARD_NAME @ $(date +%R:%S)" "info" - -#sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "rm -f /etc/NetworkManager/system-connections/*" -#sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "service network-manager reload" # bug workaround https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1681513 -#sleep 5 +display_alert "$(basename $BASH_SOURCE)" "${BOARD_NAMES[$x]} @ ${HOST}" "info" readarray -t array < <(get_device "^[wr].*" "") for u in "${array[@]}" @@ -17,5 +13,6 @@ do sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "nmcli con modify $u wifi-sec.key-mgmt wpa-psk" >> ${SRC}/logs/${HOST}.txt 2>&1 sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "nmcli con modify $u wifi-sec.psk ${WLAN_PASS_24}" >> ${SRC}/logs/${HOST}.txt 2>&1 sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "nmcli con up $u" >> ${SRC}/logs/${HOST}.txt 2>&1 - [[ $? -ne 0 ]] && display_alert "Something went wrong with $u - check logs" "$u" "wrn" + [[ $? -ne 0 ]] && display_alert "Something went wrong with $u - check logs ${SRC}/logs/${HOST}.txt" "$u" "wrn" done +sleep 3 diff --git a/tests/0003-iperf-on-all-interfaces.bash b/tests/0003-iperf-on-all-interfaces.bash index 822f2aa..82681e3 100755 --- a/tests/0003-iperf-on-all-interfaces.bash +++ b/tests/0003-iperf-on-all-interfaces.bash @@ -1,12 +1,11 @@ #!/bin/bash - source $SRC/lib/functions.sh -display_alert "$(basename $BASH_SOURCE)" "$BOARD_NAME @ $(date +%R:%S)" "info" +display_alert "$(basename $BASH_SOURCE)" "${BOARD_NAMES[$x]} @ ${HOST}" "info" sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "pkill iperf3;iperf3 -Ds --pidfile /var/run/iperf3" -readarray -t array < <(get_device "^bond.*|^[ewr].*|^br.*|^lt.*|^umts.*" "ip") +readarray -t array < <(get_device "^bond.*|^[ewr].*|^br.*|^lt.*|^umts.*|^lan.*" "ip") for u in "${array[@]}" do diff --git a/tests/0005-connect-wireless-devices-on-5.0Ghz.bash b/tests/0005-connect-wireless-devices-on-5.0Ghz.bash index e2a9ccd..402d477 100755 --- a/tests/0005-connect-wireless-devices-on-5.0Ghz.bash +++ b/tests/0005-connect-wireless-devices-on-5.0Ghz.bash @@ -1,10 +1,7 @@ #!/bin/bash source $SRC/lib/functions.sh -display_alert "$(basename $BASH_SOURCE)" "$BOARD_NAME @ $(date +%R:%S)" "info" - -#sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "rm -f /etc/NetworkManager/system-connections/*" -#sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "service network-manager reload" # bug workaround https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1681513 +display_alert "$(basename $BASH_SOURCE)" "${BOARD_NAMES[$x]} @ ${HOST}" "info" readarray -t array < <(get_device "^[wr].*") diff --git a/tests/0008-bluetoth.bash b/tests/0008-bluetoth.bash new file mode 100755 index 0000000..2cda9f1 --- /dev/null +++ b/tests/0008-bluetoth.bash @@ -0,0 +1,10 @@ +#!/bin/bash +source $SRC/lib/functions.sh + +display_alert "$(basename $BASH_SOURCE)" "${BOARD_NAMES[$x]} @ ${HOST}" "info" +if [[ -n $BLUEDEV ]]; then + resoult=$(sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "hcitool name $BLUEDEV 2>/dev/null") +else + return 0 +fi +[[ -n $resoult ]] && display_alert "Bluetooth ping to your test device was succesfull" "$resoult" "info" diff --git a/tests/0015-strong-stressing.bash b/tests/0015-strong-stressing.bash index eaf49e2..ce56f5e 100755 --- a/tests/0015-strong-stressing.bash +++ b/tests/0015-strong-stressing.bash @@ -1,6 +1,6 @@ #!/bin/bash - +return 0 source $SRC/lib/functions.sh -display_alert "$(basename $BASH_SOURCE)" "$(date +%R:%S) + ${STRESS_TIME}s" "info" +display_alert "$(basename $BASH_SOURCE)" "${BOARD_NAMES[$x]} @ ${HOST} + ${STRESS_TIME}s" "info" sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "stress -q --cpu $(nproc) --io 4 --vm 2 --vm-bytes 128M --timeout ${STRESS_TIME}s" diff --git a/tests/0016-dvfs.bash b/tests/0016-dvfs.bash new file mode 100755 index 0000000..526afb8 --- /dev/null +++ b/tests/0016-dvfs.bash @@ -0,0 +1,10 @@ +#!/bin/bash +source $SRC/lib/functions.sh + +display_alert "$(basename $BASH_SOURCE)" "${BOARD_NAMES[$x]} @ ${HOST}" "info" + +min='[[ -d /sys/devices/system/cpu/cpu0/cpufreq ]] && echo -n $(bc <<< "scale=0;$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq | head -1)/1000")" - " ' +max='[[ -d /sys/devices/system/cpu/cpu0/cpufreq ]] && echo $(bc <<< "scale=0;$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq | head -1)/1000")" Mhz" ' + +resoult=$(sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "eval $min; eval $max") +[[ -n $resoult ]] && display_alert "DVFS works" "$resoult" "info" diff --git a/tests/0019-7-zip-benchmark.bash b/tests/0019-7-zip-benchmark.bash index 741d847..10d7aa2 100755 --- a/tests/0019-7-zip-benchmark.bash +++ b/tests/0019-7-zip-benchmark.bash @@ -1,6 +1,6 @@ #!/bin/bash - +return 0 source $SRC/lib/functions.sh -display_alert "$(basename $BASH_SOURCE)" "$(date +%R:%S)" "info" +display_alert "$(basename $BASH_SOURCE)" "${BOARD_NAMES[$x]} @ ${HOST}" "info" sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "armbianmonitor -z" >> ${SRC}/logs/${HOST}.log | tee -a ${SRC}/logs/${HOST}.txt diff --git a/tests/9999-reboot.bash b/tests/9999-reboot.bash index ed708e1..5154471 100755 --- a/tests/9999-reboot.bash +++ b/tests/9999-reboot.bash @@ -3,7 +3,7 @@ source $SRC/lib/functions.sh display_alert "$(basename $BASH_SOURCE)" "$(date +%R:%S)" "info" -display_alert "Rebooting in 3 seconds" "${HOST}" "wrn" +display_alert "Rebooting in 3 seconds" "${HOST}" "info" sleep 3 sshpass -p ${PASS_ROOT} ssh ${USER_ROOT}@${HOST} "reboot" &>/dev/null sleep 3