diff options
Diffstat (limited to 'test-scripts')
20 files changed, 1519 insertions, 0 deletions
diff --git a/test-scripts/bluetooth/bt-connect-test.sh b/test-scripts/bluetooth/bt-connect-test.sh new file mode 100644 index 0000000..4fbddde --- /dev/null +++ b/test-scripts/bluetooth/bt-connect-test.sh @@ -0,0 +1,73 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh + +echo "=====>connect Bluetooth test<=====" +PASSORFAIL=2 #needed to pass discovery and scan tests +############################################################################## +# YOU NEED TO USE TWO DRAGON-BOARDS. +# ONE FOR DISCOVERY BLUETOOTH +# THE OTHER FOR SCAN IT +# THEREFOR- GO TO environmentVars.txt and write there the ip of the second board +############################################################################## + +UTIL_PATH=tiny-apts/util +GET_ENV_VARS=$UTIL_PATH/get-env-var-val-target.sh +IP_DEVICE="$($GET_ENV_VARS HELPER_DEVICE_IP)" + +DEVICE_NAME=$1 +DEVICE_MAC=$2 + +OUTPUT="$( (/usr/sbin/rfkill unblock bluetooth) 2>&1)" +ssh root@$IP_DEVICE /usr/sbin/rfkill unblock bluetooth || exit 1 +ssh root@$IP_DEVICE /usr/bin/hciconfig hci0 up || exit 1 +ssh root@$IP_DEVICE /usr/bin/hciconfig hci0 piscan || exit 1 +OUTPUTSCANBT="$( (/usr/bin/hcitool scan) 2>&1)" +echo "Bluetooth devices on :$OUTPUTSCANBT" +echo "$OUTPUTSCANBT" >> btdevices.txt +MACBT="$( (grep "$DEVICE_NAME" btdevices.txt | awk '{print $1}')2>&1)" +if [ "$MACBT" != "$DEVICE_MAC" ]; then + rm btdevices.txt + echo "=====>connect bluetooth test done<=====" + exit $PASSORFAIL +fi +PASSORFAIL=$((PASSORFAIL-1)) + +timeout 3m rfcomm connect $DEVICE_NAME $DEVICE_MAC & + +sleep 10 +SUCCESS_CONNECT="$( (ls /dev/rfcomm* | awk '{print $1}') 2>&1)" + +if [ "$SUCCESS_CONNECT" == /dev/rfcomm* ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi + +rm btdevices.txt + +echo "=====>connect bluetooth test done<=====" +exit $PASSORFAIL diff --git a/test-scripts/bluetooth/bt-connect-to-exist-device-test.sh b/test-scripts/bluetooth/bt-connect-to-exist-device-test.sh new file mode 100644 index 0000000..f37e2c2 --- /dev/null +++ b/test-scripts/bluetooth/bt-connect-to-exist-device-test.sh @@ -0,0 +1,64 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh + +echo "=====>connect dragonboard to another device by Bluetooth test<=====" +PASSORFAIL=2 #needed to pass discovery and scan tests +############################################################################## +# YOU NEED TO USE WORKING BLUETOOTH DEVICE FOR SCAN IT------Bluetooth +############################################################################## +DEVICE_NAME=$1 +DEVICE_MAC=$2 + +OUTPUT="$( (/usr/sbin/rfkill unblock bluetooth) 2>&1)" +OUTPUTSCANBT="$( (/usr/bin/hcitool scan) 2>&1)" #scanning +echo "Bluetooth devices on :$OUTPUTSCANBT" +echo "$OUTPUTSCANBT" >> btdevices.txt +MACBT="$( (grep "$DEVICE_NAME" btdevices.txt | awk '{print $1}')2>&1)" +if [ "$MACBT" != "$DEVICE_MAC" ]; then + rm btdevices.txt + echo "=====>connect bluetooth test done<=====" + exit $PASSORFAIL +fi +PASSORFAIL=$((PASSORFAIL-1)) + +timeout 3m rfcomm connect $DEVICE_NAME $DEVICE_MAC & + +sleep 10 +SUCCESS_CONNECT="$( (ls /dev/rfcomm* | awk '{print $1}') 2>&1)" + +if [ "$SUCCESS_CONNECT" == /dev/rfcomm* ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi + + + +rm btdevices.txt + +echo "=====>connect bluetooth test done<=====" +exit $PASSORFAIL diff --git a/test-scripts/bluetooth/bt-service-discovery-scan-test.sh b/test-scripts/bluetooth/bt-service-discovery-scan-test.sh new file mode 100644 index 0000000..3373fce --- /dev/null +++ b/test-scripts/bluetooth/bt-service-discovery-scan-test.sh @@ -0,0 +1,61 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh + + +PASSORFAIL=1 #needed to pass discovery and scan tests +############################################################################## +# YOU NEED TO USE TWO DRAGON BORADS +# ONE FOR SERVICE DISCOVERY +# THE OTHER FOR SCAN +# THEREFOR- GO TO environmentVars.txt and write there the ip of the second board +############################################################################## +GET_ENV_VARS=$(find -name "get-env-var-val-target.sh") +IP_DEVICE="$($GET_ENV_VARS HELPER_DEVICE_IP)" + +DEVICE_NAME=$1 +DEVICE_MAC=$2 +echo "=====>bluetooth discovery and scan test <=====" +OUTPUT="$( (/usr/sbin/rfkill unblock bluetooth) 2>&1)" + +ssh root@$IP_DEVICE /usr/sbin/rfkill unblock bluetooth || exit 1 #discovery on remote device +ssh root@$IP_DEVICE /usr/bin/hciconfig hci0 up || exit 1 +ssh root@$IP_DEVICE /usr/bin/hciconfig hci0 piscan || exit 1 + +OUTPUTSCANBT="$( (/usr/bin/hcitool scan) 2>&1)" #scanning +echo "Bluetooth devices on :$OUTPUTSCANBT" +echo "$OUTPUTSCANBT" >> btdevices.txt +MACBT="$( (grep "$DEVICE_NAME" btdevices.txt | awk '{print $1}')2>&1)" + +if [ "$MACBT" == "$DEVICE_MAC" ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi + +rm btdevices.txt +echo "=====>bluetooth discovery and scan test done<=====" +exit $PASSORFAIL diff --git a/test-scripts/display/opengl_glxgears_test.sh b/test-scripts/display/opengl_glxgears_test.sh new file mode 100644 index 0000000..8fd632f --- /dev/null +++ b/test-scripts/display/opengl_glxgears_test.sh @@ -0,0 +1,112 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +date + +echo "=============> Running Test: glxgears FPS <===============" +echo + +# This tests runs glxgears tool and measures the FPS perfomance. +# The test expects input FPS argument to assess PASS/FAIL decision. +MIN_FPS_THRESHOLD=$1 +MAX_FPS_THRESHOLD=$2 #if no arg given, ignores checking max boundary + +if [ -z "$MIN_FPS_THRESHOLD" ]; then + echo "Min FPS limit not given" + date + exit 3 +fi + +SKIP_MAX_FPS=0 +if [ -z "$MAX_FPS_THRESHOLD" ]; then + echo "Max FPS limits not given, skipping Max FPS check" + SKIP_MAX_FPS=1 +fi + +GLX_GEARS_LOG_FILENAME="glxgears.log" + +# do some cleanup (kill X and glxgears if they run before) +echo "some cleanup & setup ..." +kill -9 $(pidof glxgears) &> /dev/null +kill -9 $(pidof X) &> /dev/null +rm $GLX_GEARS_LOG_FILENAME &> /dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +# start the X server +X &> X.log & +sleep 2 + +# run glxgears for 10 seconds +glxgears -fullscreen -display :0 > $GLX_GEARS_LOG_FILENAME & + +sleep 10 + +# some cleanup +kill -9 $(pidof glxgears) +kill -9 $(pidof X) + +# assess the results +ACTUAL_FPS=$(cat glxgears.log | grep -o -E '[0-9]+\.[0-9]+ FPS' | grep -m1 -o -E '[0-9]+' | grep -m1 -o -E '[0-9]+') +echo actual FPS was $ACTUAL_FPS +echo required FPS should within $MIN_FPS_THRESHOLD and $MAX_FPS_THRESHOLD +echo + +RESULT=1 +if [ "$ACTUAL_FPS" -lt "$MIN_FPS_THRESHOLD" ] +then + RESULT=1 + echo "- - FAIL - - low FPS performance" +elif [ "1" -eq "$SKIP_MAX_FPS" ] +then + RESULT=0 + echo "+ + + P A S S + + +" +elif [ "$ACTUAL_FPS" -gt "$MAX_FPS_THRESHOLD" ] +then + RESULT=2 + echo "- - FAIL - - too high FPS performance, maybe LCD not connected..." +else + RESULT=0 + echo "+ + + P A S S + + +" +fi + +#writing result to file, to be read by test-executor.sh and used in log files +echo "FPS = $ACTUAL_FPS" > test_string_ret_val.txt + +echo +echo "=============> Finished Test: glxgears FPS <==============" +echo + +date +exit $RESULT + + + + + diff --git a/test-scripts/gpio/gpio-test.sh b/test-scripts/gpio/gpio-test.sh new file mode 100644 index 0000000..0e7f7b0 --- /dev/null +++ b/test-scripts/gpio/gpio-test.sh @@ -0,0 +1,112 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +#testing GPIO by sending and recieving signals in predefiend connection points +#IMPORTANT!! before running test connect gpio points as ilustrated: +#ilustaration of connected gpio points. +#symbol key: +# J8 - this is the name of the gpio panel (printed on the board next to the panel) +# * - a white dot pointing to the the begining of the first gpio point (printed on the board next to the panel) +# @ - connected gpio point +# === - connection between two gpio points + +# J8 # # # # # # # @===@ # # @===@ @===@ @===@ # # # +# * # # # # # # # # # # # @===@ @===@ @===@ # # # + +################### function definition ########################################## +signal_to_apq() #$1=signal value(1/0). $2=out_apq_name. $3=in_apq_name. $4=lineNum for logging msg. +{ + echo "$1" > $GPIO_PATH/$2/value + READ_RES=$(cat $GPIO_PATH/$3/value) + if [ $READ_RES != "$1" ]; then + $LOGGER_PATH/logger.sh $THIS_FILE_NAME $FAIL -v "writen $1, got: $READ_RES on: $2 to: $3" $4 + ERR_COUNT=$((ERR_COUNT+1)) + fi +} +########################## test run ############################################################### +THIS_FILE_NAME=$0 +LOGGER_PATH=tiny-apts/util +FAIL=1 +GPIO_PATH=/sys/class/gpio + +#allow Read Write permitions in export and unexport +chmod ugo+rw $GPIO_PATH/export +chmod ugo+rw $GPIO_PATH/unexport + +#mapping gpio points +for IN_APQ in 13 24 28 113 12 25 33 ; do + I=$((I+1)) #I= 1 .. 7 + eval IN_APQ_NAMES$I="gpio$IN_APQ" + eval IN_APQ_NUMS$I=$IN_APQ + eval IN_VAL_OLD$I="" #creating vars to hold old values +done + +MPP4=$(cat /sys/kernel/debug/pinctrl/200f000.spmi\:pm8916@0\:mpps@a000/gpio-ranges | grep 0 | cut -d"-" -f2 | cut -d"]" -f1 | cut -d" " -f2) + +for OUT_APQ in 36 115 35 110 69 $MPP4 34 ; do + J=$((J+1)) #J= 1 .. 7 + eval OUT_APQ_NAMES$J="gpio$OUT_APQ" + eval OUT_APQ_NUMS$J=$OUT_APQ + eval OUT_VAL_OLD$J="" #creating vars to hold old values +done + +INDEX_NUMS="1 2 3 4 5 6 7" +for index in $INDEX_NUMS ; do +#creating input, output gpio + eval echo \$IN_APQ_NUMS$index > $GPIO_PATH/export + eval echo \$OUT_APQ_NUMS$index > $GPIO_PATH/export +#getting maped gpio point + IN_APQ_NAME=$(eval echo \$IN_APQ_NAMES$index) + OUT_APQ_NAME=$(eval echo \$OUT_APQ_NAMES$index) +#granting read write permitions to value, direction files + chmod ugo+rw $GPIO_PATH/$IN_APQ_NAME/value + chmod ugo+rw $GPIO_PATH/$IN_APQ_NAME/direction + chmod ugo+rw $GPIO_PATH/$OUT_APQ_NAME/value + chmod ugo+rw $GPIO_PATH/$OUT_APQ_NAME/direction +#saving old values + eval IN_VAL_OLD$index=$(cat $GPIO_PATH/$IN_APQ_NAME/value) + eval OUT_VAL_OLD$index=$(cat $GPIO_PATH/$OUT_APQ_NAME/value) +#testing loopbacks + echo in > $GPIO_PATH/$IN_APQ_NAME/direction + echo out > $GPIO_PATH/$OUT_APQ_NAME/direction + signal_to_apq 1 $OUT_APQ_NAME $IN_APQ_NAME 71 + signal_to_apq 0 $OUT_APQ_NAME $IN_APQ_NAME 72 +#restore gpios values and unexport + echo out > $GPIO_PATH/$IN_APQ_NAME/direction #turn IN gpio to OUT so you could write to it, so next line would work + eval echo \$IN_VAL_OLD$index > $GPIO_PATH/$IN_APQ_NAME/value + eval echo \$OUT_VAL_OLD$index > $GPIO_PATH/$OUT_APQ_NAME/value + eval echo \$IN_APQ_NUMS$index > $GPIO_PATH/unexport + eval echo \$OUT_APQ_NUMS$index > $GPIO_PATH/unexport +done + +exit $ERR_COUNT + + + + + diff --git a/test-scripts/storage/copyfiles-flash-sdcard-test.sh b/test-scripts/storage/copyfiles-flash-sdcard-test.sh new file mode 100644 index 0000000..e0917ad --- /dev/null +++ b/test-scripts/storage/copyfiles-flash-sdcard-test.sh @@ -0,0 +1,41 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +echo "copy files PERFOMANCE test" +echo "" +CRE_PASS=$1 +GET_ENV_VARS=$(find -name "get-env-var-val-target.sh") +UTIL_PATH="$($GET_ENV_VARS UTIL_PATH)" +MOUNTED=$2 + +if [ ! "$MOUNTED" ]; then + MOUNTED=/dev/mmcblk1p1 +fi +echo "=====>copy from flash to sd card - criteria for pass result is not slower than $CRE_PASS MBps<=====" +$UTIL_PATH/copyfiles-flashsource.sh "$MOUNTED" "$CRE_PASS" + diff --git a/test-scripts/storage/copyfiles-flash-usb-test.sh b/test-scripts/storage/copyfiles-flash-usb-test.sh new file mode 100644 index 0000000..30465cd --- /dev/null +++ b/test-scripts/storage/copyfiles-flash-usb-test.sh @@ -0,0 +1,40 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +echo "copy files PERFOMANCE test" +echo "" +CRE_PASS=$1 +UTIL_PATH=tiny-apts/util +MOUNTED=$2 + +if [ ! "$MOUNTED" ]; then + MOUNTED="$( (ls /dev/sd*1 | awk '{print $1}') 2>&1)" +fi +echo "=====>copy from flash to usb - criteria for pass result is not slower than $CRE_PASS MBps<=====" +$UTIL_PATH/copyfiles-flashsource.sh "$MOUNTED" "$CRE_PASS" + diff --git a/test-scripts/storage/copyfiles-sdcard-flash-test.sh b/test-scripts/storage/copyfiles-sdcard-flash-test.sh new file mode 100644 index 0000000..748d2b2 --- /dev/null +++ b/test-scripts/storage/copyfiles-sdcard-flash-test.sh @@ -0,0 +1,41 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +echo "copy files PERFOMANCE test" +echo "" +CRE_PASS=$1 +GET_ENV_VARS=$(find -name "get-env-var-val-target.sh") +UTIL_PATH="$($GET_ENV_VARS UTIL_PATH)" +MOUNTED=$2 + +if [ ! "$MOUNTED" ]; then + MOUNTED=/dev/mmcblk1p1 +fi +echo "=====>copy from sdcard to flash - criteria for pass result is not slower than $CRE_PASS MBps<=====" +$UTIL_PATH/copyfiles-flashdestination.sh "$MOUNTED" "$CRE_PASS" + diff --git a/test-scripts/storage/copyfiles-usb-flash-test.sh b/test-scripts/storage/copyfiles-usb-flash-test.sh new file mode 100644 index 0000000..3f6bfe9 --- /dev/null +++ b/test-scripts/storage/copyfiles-usb-flash-test.sh @@ -0,0 +1,40 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +echo "copy files PERFOMANCE test" +echo "" +CRE_PASS=$1 +UTIL_PATH=tiny-apts/util +MOUNTED=$2 + +if [ ! "$MOUNTED" ]; then + MOUNTED="$( (ls /dev/sd*1 | awk '{print $1}') 2>&1)" +fi +echo "=====>copy from usb to flash- criteria for pass result is not slower than $CRE_PASS MBps<=====" +$UTIL_PATH/copyfiles-flashdestination.sh "$MOUNTED" "$CRE_PASS" + diff --git a/test-scripts/storage/flash-access-iozone-test.sh b/test-scripts/storage/flash-access-iozone-test.sh new file mode 100644 index 0000000..898a63d --- /dev/null +++ b/test-scripts/storage/flash-access-iozone-test.sh @@ -0,0 +1,64 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +#writes output files to /home/root +PASSORFAIL=2 # suppose to success write and read tests +CRE_READ=$1 +CRE_WRITE=$2 +echo " " +echo "=====>sequential flash access test starts at=====<" +date +iozone -azecI -+n -L64 -S32 -y512k -q512k -n1m -g64m -i0 -i1 -o -b sequential_result_flash.xls > sequential_result_flash.txt + +RESULT="$( (grep "65536" sequential_result_flash.txt | grep '"65536" 0' -B 1 | sed -n '3p' | awk '{print $2}') 2>&1)" +RESULT=$((RESULT/1024)) +echo "The read criteria to pass is $CRE_READ MBps and the result is $RESULT MBps" +if [ "$RESULT" -gt $CRE_READ ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi + +READ_RES=$RESULT + +RESULT="$( (grep "65536" sequential_result_flash.txt | grep '"65536" 0' -B 1 | sed -n '1p' | awk '{print $2}') 2>&1)" +RESULT=$((RESULT/1024)) +echo "The write criteria to pass is $CRE_WRITE MBps -result is $RESULT MBps" +if [ "$RESULT" -gt $CRE_WRITE ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi +WRITE_RES=$RESULT + +echo "=====>sequential flash access test done at<=====" +date + +#writing result to file, to be read by test-executor.sh and used in log files +echo "read = $READ_RES. write = $WRITE_RES" > test_string_ret_val.txt + +exit $PASSORFAIL + + + diff --git a/test-scripts/storage/random-access-flash-iozone-test.sh b/test-scripts/storage/random-access-flash-iozone-test.sh new file mode 100644 index 0000000..435b19d --- /dev/null +++ b/test-scripts/storage/random-access-flash-iozone-test.sh @@ -0,0 +1,70 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +#random flash access +#writes output files to /home/root +PASSORFAIL=2 # need to success write and read tests +KB=1024 +CRE_READ=$1 +CRE_WRITE=$2 +HELP=1000000 # to convert it to non floating point number +echo " " +echo "=====>random flash access test starts at <=====" +date +iozone -azecI -+n -L64 -S32 -y4k -q1024k -n64m -g64m -i0 -i2 -o -b random_access_result_flash.xls > random_access_result_flash.txt + +RESULT="$( (grep 'Random' random_access_result_flash.txt -A 2 | sed -n '3p' | awk '{print $2}') 2>&1)" +RESULT="$( (echo $RESULT $KB | awk '{print $1 / $2}') 2>&1)" +echo "The read criteria to pass is $CRE_READ MBps and The result is $RESULT MBps" + + +RESULT_AFTER_MULT="$( (echo $RESULT $HELP | awk '{print $1 * $2}') 2>&1)" +CRIT_AFTER_MULT="$( (echo $CRE_READ $HELP | awk '{print $1 * $2}') 2>&1)" +if [ $RESULT_AFTER_MULT -gt $CRIT_AFTER_MULT ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi +READ_RES=$RESULT + +RESULT="$( (grep 'Random' random_access_result_flash.txt -A 2 | sed -n '7p' | awk '{print $2}') 2>&1)" +RESULT="$( (echo $RESULT $KB | awk '{print $1 / $2}') 2>&1)" +echo "The write criteria to pass is $CRE_WRITE MBps - The result is $RESULT MBps" + +RESULT_AFTER_MULT="$( (echo $RESULT $HELP | awk '{print $1 * $2}') 2>&1)" +CRIT_AFTER_MULT="$( (echo $CRE_WRITE $HELP | awk '{print $1 * $2}') 2>&1)" +if [ $RESULT_AFTER_MULT -gt $CRIT_AFTER_MULT ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi +WRITE_RES=$RESULT + +echo "=====>random flash access test done at=====<" +date + +#writing result to file, to be read by test-executor.sh and used in log files +echo "read = $READ_RES. write = $WRITE_RES" > test_string_ret_val.txt + +exit $PASSORFAIL diff --git a/test-scripts/storage/sd-card-discover-test.sh b/test-scripts/storage/sd-card-discover-test.sh new file mode 100644 index 0000000..abbb86f --- /dev/null +++ b/test-scripts/storage/sd-card-discover-test.sh @@ -0,0 +1,37 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +#IMPORTANT! RUN TEST ONLY WITH SD CARD INSIDE!!! +#searchs "MMC_TYPE=SD" in command: "cat /sys/class/mmc_host/mmc1/mmc1:*/uevent" +#fails if not found. logges fail result to verbose-test-log.txt on the device + +# TODO: Fix to make it generic: in Eng. buld 1.0, enumerated under /mmc1 and in Eng. build 1.1 enumerated under mmc0 + +THIS_FILE_NAME=$0 + +tiny-apts/util/search-cmd-output.sh "cat /sys/class/mmc_host/mmc1/mmc1:*/uevent" "MMC_TYPE=SD" $THIS_FILE_NAME diff --git a/test-scripts/storage/sdcard-access-iozone-test.sh b/test-scripts/storage/sdcard-access-iozone-test.sh new file mode 100644 index 0000000..6bbc3de --- /dev/null +++ b/test-scripts/storage/sdcard-access-iozone-test.sh @@ -0,0 +1,70 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh + +#writes output files to /home/root +PASSORFAIL=2 # need to success write and read tests + +CRE_READ=$1 +CRE_WRITE=$2 +echo " " +echo "=====>sequential sdcard access test uses Sandisk Extreme SDR-104 sdcard starts at=====<" +date + +MOUNT="$( (ls /dev/mmcblk1p1 | awk '{print $1}') 2>&1)" +MOUNT_DIR=/mnt/ +mount $MOUNT $MOUNT_DIR +iozone -azecI -+n -L64 -S32 -y512k -q512k -n1m -g1000m -i0 -i1 -o -b sequential_result_sdcard.xls -f $MOUNT_DIR/tmp.txt > sequential_result_sdcard.txt + + +RESULT="$( (grep "524288" sequential_result_sdcard.txt | grep '"524288" 0' -B 1 | sed -n '3p' | awk '{print $2}') 2>&1)" +RESULT=$((RESULT/1024)) +echo "The read criteria to pass is $CRE_READ MBps and the result is $RESULT MBps" +if [ "$RESULT" -gt $CRE_READ ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi +READ_RES=$RESULT + +RESULT="$( (grep "524288" sequential_result_sdcard.txt | grep '"524288" 0' -B 1 | sed -n '1p' | awk '{print $2}') 2>&1)" +RESULT=$((RESULT/1024)) +echo "The write criteria to pass is $CRE_WRITE MBps -result is $RESULT MBps" +if [ "$RESULT" -gt $CRE_WRITE ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi +WRITE_RES=$RESULT + +umount $MOUNT +echo "=====>sdcard access test done at=====<" +date + +#writing result to file, to be read by test-executor.sh and used in log files +echo "read = $READ_RES. write = $WRITE_RES" > test_string_ret_val.txt + +exit $PASSORFAIL + + diff --git a/test-scripts/storage/usb-discover-test.sh b/test-scripts/storage/usb-discover-test.sh new file mode 100644 index 0000000..ab87816 --- /dev/null +++ b/test-scripts/storage/usb-discover-test.sh @@ -0,0 +1,37 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +#testing presence of all usb devices: 1-1.1:1.0, 1-1.2:1.0 in $(ls /sys/bus/usb/devices/) +#fails if at least one is missing. logges the missing usbs to verbose-test-log.txt on the device + + +THIS_FILE_NAME=$0 + +tiny-apts/util/search-cmd-output.sh "ls /sys/bus/usb/devices/" "1-1.1:1.0 1-1.2:1.0" $THIS_FILE_NAME + + diff --git a/test-scripts/storage/usb_mass_storage_iozone_sequential-test.sh b/test-scripts/storage/usb_mass_storage_iozone_sequential-test.sh new file mode 100644 index 0000000..76e0ee8 --- /dev/null +++ b/test-scripts/storage/usb_mass_storage_iozone_sequential-test.sh @@ -0,0 +1,112 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh + +# test writes output files to /home/root +WORKING_FOLDER=/home/root +PASSORFAIL=2 + +echo " " +echo "=====> Running Test (USB Mass Storage iozone sequential access) <======" +date + +READ_KPI=$1 +WRITE_KPI=$2 +echo read pass threshold is $READ_KPI MBps +echo write pass threshold is $WRITE_KPI MBps + +USB_MOUNT_FOLDER='/tmp/usbdrive' + +# do some cleanup of potenitally previously failed run +echo pre-test cleaning... +umount $USB_MOUNT_FOLDER +rmdir $USB_MOUNT_FOLDER +sleep 1 +mkdir $USB_MOUNT_FOLDER +echo +echo cleaning done... +echo running test now... +echo + +# figure out where USB device appears +USB_DEVICE_NAME=$(lsblk | grep -o -E 'sd[a,z][1-9]') +echo USB device name is $USB_DEVICE_NAME + +# mount +echo mount command is: mount -t vfat -o rw /dev/$USB_DEVICE_NAME $USB_MOUNT_FOLDER +mount -t vfat -o rw /dev/$USB_DEVICE_NAME $USB_MOUNT_FOLDER +echo USB drive mounted to $USB_MOUNT_FOLDER + +# drop cache +echo 3 > /proc/sys/vm/drop_caches + +# run benchmark +echo running command: iozone -azecI -+n -L64 -S32 -y512k -q512k -n1m -g1000m -i0 -i1 -o -b /tmp/sequential_external_drive.xls -f $USB_MOUNT_FOLDER/file.temp +iozone -azecI -+n -L64 -S32 -y512k -q512k -n1m -g1000m -i0 -i1 -o -b /tmp/sequential_external_drive.xls -f $USB_MOUNT_FOLDER/file.temp > /tmp/sequential_external_drive.txt + +cp /tmp/sequential_external_drive.* $WORKING_FOLDER/ + +# do cleanup +#umount $USB_MOUNT_FOLDER +#rm -rf $USB_MOUNT_FOLDER + +# compare the results agains the required KPI given as argument to this test +echo +RESULT="$( ((grep "524288" /tmp/sequential_external_drive.txt | grep '"524288" 0' -B 1 | sed -n '3p' | awk '{print $2}')) 2>&1)" + +RESULT=$((RESULT/1024)) +echo "The read criteria to pass is $READ_KPI MBps and the result is $RESULT MBps" +if [ "$RESULT" -gt $READ_KPI ]; then + PASSORFAIL=$((PASSORFAIL-1)) + echo "Read is ++++PASS++++" +else + echo "Read is ----FAIL----" +fi +READ_RES=$RESULT +echo +RESULT="$( (grep "524288" /tmp/sequential_external_drive.txt | grep '"524288" 0' -B 1 | sed -n '1p' | awk '{print $2}') 2>&1)" +RESULT=$((RESULT/1024)) +echo "The write criteria to pass is $WRITE_KPI MBps and the result is $RESULT MBps" +if [ "$RESULT" -gt $WRITE_KPI ]; then + PASSORFAIL=$((PASSORFAIL-1)) + echo "Write is ++++PASS++++" +else + echo "Write is ----FAIL----" +fi +WRITE_RES=$RESULT + +#writing result to file, to be read by test-executor.sh and used in log files +echo "read = $READ_RES. write = $WRITE_RES" > test_string_ret_val.txt +echo +echo "=====> Test Finished(USB Mass Storage iozone sequential access) <======" +date +echo +echo + + +exit $PASSORFAIL diff --git a/test-scripts/video/h264-mp4-gstreamer-playback-test.sh b/test-scripts/video/h264-mp4-gstreamer-playback-test.sh new file mode 100644 index 0000000..6664dd4 --- /dev/null +++ b/test-scripts/video/h264-mp4-gstreamer-playback-test.sh @@ -0,0 +1,160 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +date + +echo "=============> Running Test: gstreamer H264 Video Playback <===============" +echo + +# this tests plays an H264 file given as an argument by using gstreamer pipeline +# by using the v4l2dec pluging for HW decoding. +# this test also captures cpu temperature and cpu usage and prints this out. + +FILE_TO_PLAY=$1 +echo file to play - $FILE_TO_PLAY + +# check if the argument is supplied +if [ -z "$FILE_TO_PLAY" ] +then + echo file-to-play argument not supplied + echo + date + exit 1 +fi + +# check if the file to play appears in the file system +if [ -e "$FILE_TO_PLAY" ] +then + echo File $FILE_TO_PLAY found on the file system, Ok! +else + echo ERROR: File $FILE_TO_PLAY NOT found on file system + echo + date + exit 1 +fi + +GSTREAMER_LOG_FILE="gstreamer_h264_playback.log" + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $GSTREAMER_LOG_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +# executing gstreamer +COMMAND="gst-launch-1.0 -v filesrc location=$FILE_TO_PLAY ! qtdemux ! h264parse ! v4l2dec ! glimagesink" +echo "Running Command: $COMMAND" +export DISPLAY=:0 +eval $COMMAND &> $GSTREAMER_LOG_FILE & + +sleep 3 +TIMEOUT=60 +COUNTER=1 + +# Check if gstreamer was launched ok, i.e. if we find its PID +GST_PID=$(pidof "gst-launch-1.0") +if [ -z "$GST_PID" ] +then + echo + echo "ERROR: Could not start gstreamer" + echo + date + exit 1 +fi + + +echo playing and monitoring for $TIMEOUT seconds... +echo + +MAX_GST_CPU_USAGE=0 +while [ "$COUNTER" -lt "$TIMEOUT" ] +do + sleep 1 + echo "--> CPU statistic at second: $COUNTER <-------------------------------------" + + # CPU Usage in busybox is in the following format: + # PID PPID USER STAT VSZ %VSZ %CPU COMMAND + # + # so, extract the CPU usage by extracting the percentages and getting the second value + + PERCENTAGES_TO_EXTRACT_FROM="$(top -b -n1 | grep gst-launch-1.0 | grep -o -E '[0-9]+%')" + GST_CPU_USAGE="$(echo $PERCENTAGES_TO_EXTRACT_FROM | awk '{print $2}' | grep -o -E '[0-9]+')" + echo "gst CPU usage: $GST_CPU_USAGE %" + + if [ "$GST_CPU_USAGE" -gt "$MAX_GST_CPU_USAGE" ] + then + MAX_GST_CPU_USAGE=$GST_CPU_USAGE + fi + + echo "CPU Temperatures (degrees C): $(( $(cat /sys/class/thermal/thermal_zone0/temp) / 1000 )) \ +$(( $(cat /sys/class/thermal/thermal_zone1/temp) / 1000 ))" + + echo "CPU CORE Frequencies (Hz): \ +$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq) \ +$(cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq) \ +$(cat /sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq) \ +$(cat /sys/devices/system/cpu/cpu3/cpufreq/scaling_cur_freq)" + + COUNTER=$((COUNTER+1)) +done + +echo +echo Maximum recorded gstreamer CPU usage is: $MAX_GST_CPU_USAGE % + +# test finished, killing gstreamer +kill -9 $(pidof "gst-launch-1.0") &>/dev/null + +# count the amount of the frame drop reports. Fail the test if there are too many (>2) +FRAME_DROP_REPORTS="$(cat $GSTREAMER_LOG_FILE | grep -c "A lot of buffers are being dropped")" +echo +echo Number of Frame Drop Reports: $FRAME_DROP_REPORTS +echo +if [ "$FRAME_DROP_REPORTS" -gt "2" ] +then + RESULT=2 + echo "Too many Frame Drops!.." + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + + +echo +echo "=============> Finished Test: gstreamer H264 Video Playback <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/video/usbcam_gstreamer_video-test.sh b/test-scripts/video/usbcam_gstreamer_video-test.sh new file mode 100644 index 0000000..7391606 --- /dev/null +++ b/test-scripts/video/usbcam_gstreamer_video-test.sh @@ -0,0 +1,108 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +date + +echo "=============> Running Test: usb camera gstreamer video <===============" +echo + +# This tests runs gstreamer and v4l camera driver to capture the video and check it's validity. +# This test was developed when using Logitech Webcam C270 but is general and is expected to work +# with any USB webcam + +# This test requires the following packages to be inlcuded/installed: gstreamer1.0* packages and +# v4l-utils. When running on Debian for example, the following can be used to install the needed +# packages: apt-get install gstreamer1.0* and apt-get install v4l-utils. +# + + +REQUIRED_HEIGHT=$1 +REQUIRED_WIDTH=$2 + +echo required height in pixels: $REQUIRED_HEIGHT +echo required width in pixels: $REQUIRED_WIDTH + +if [ -z "$REQUIRED_WIDTH" ] +then + echo " - - F A I L - - ( arguments height and width not supplied properly )" + echo + date + exit 0 +fi + +GSTREAMER_LOG_FILE="gstreamer_usbcam.log" + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $GSTREAMER_LOG_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +$( gst-launch-1.0 -v v4l2src ! glimagesink &> $GSTREAMER_LOG_FILE ) & +sleep 20 + +# test finished, killing gstreamer +kill -9 $(pidof "gst-launch-1.0") &>/dev/null + +# now check validity of the video resolution + + +ACTUAL_HEIGHT=$( cat gstreamer_usbcam.log | grep -o -E 'height\\=\\\(int\\\)[0-9]+' | grep -o -E '[0-9]+' -m 1) +ACTUAL_WIDTH=$( cat gstreamer_usbcam.log | grep -o -E 'width\\=\\\(int\\\)[0-9]+' | grep -o -E '[0-9]+' -m 1) + +echo actual height in pixels: $ACTUAL_HEIGHT +echo actual width in pixels $ACTUAL_WIDTH + +RESULT=1 +if [ "$ACTUAL_HEIGHT" -eq "$REQUIRED_HEIGHT" ] +then + if [ "$ACTUAL_WIDTH" -eq "$REQUIRED_WIDTH" ] + then + echo " + + P A S S + + " + RESULT=0 + fi +fi + +if [ $RESULT -ne "0" ] +then + echo " - - F A I L - - " +fi + +echo +echo "=============> Finished Test: usb camera gstreamer video <=============" +echo + +date +exit $RESULT + + + + + diff --git a/test-scripts/wifi/wifi-connect-WPA2-PSK-security-test.sh b/test-scripts/wifi/wifi-connect-WPA2-PSK-security-test.sh new file mode 100644 index 0000000..07442de --- /dev/null +++ b/test-scripts/wifi/wifi-connect-WPA2-PSK-security-test.sh @@ -0,0 +1,57 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +#connecting to unsecure wifi AP. $1 - wifi AP, defined in "environment-vars.txt" file. given to createWpaConf func + +CONF="ctrl_interface=/run/wpa_supplicant +update_config=1 + +network={ + ssid=\"$1\" + psk=\"$2\" +} +" + +export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin":$PATH + +export + +tiny-apts/util/get-wifi-config-and-connect.sh "$CONF" + + + + + + + + + + + + + diff --git a/test-scripts/wifi/wifi-connect-open-security-test.sh b/test-scripts/wifi/wifi-connect-open-security-test.sh new file mode 100644 index 0000000..23f3d55 --- /dev/null +++ b/test-scripts/wifi/wifi-connect-open-security-test.sh @@ -0,0 +1,53 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +#connecting to unsecure wifi AP. $1 - wifi AP, defined in "environment-vars.txt" file. given to createWpaConf func + +CONF="ctrl_interface=/run/wpa_supplicant +update_config=1 + +network={ + ssid=\"$1\" + key_mgmt=NONE +} +" +export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin":$PATH + +export + +tiny-apts/util/get-wifi-config-and-connect.sh "$CONF" + + + + + + + + + + diff --git a/test-scripts/wifi/wifi-soft-ap-connect-test.sh b/test-scripts/wifi/wifi-soft-ap-connect-test.sh new file mode 100644 index 0000000..cf90d7f --- /dev/null +++ b/test-scripts/wifi/wifi-soft-ap-connect-test.sh @@ -0,0 +1,167 @@ +# Copyright (c) 2016, The Linux Foundation. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of The Linux Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#!/bin/sh +#creates softap on board that transmits the wifi AP. uses another board to connect to the wifi AP +#terminilogy: +#SOFTAP = board that creates a softap +#CLIENT = board that connects to the wifi AP + +#recievs as args: $1 - softap ssid, $2 - softap password, $3 - softap static IP, $4 - softap netmask + +########################################### function definition ############################################################ +FUNC_createHostapConf () # $1 - SSID. $2 - password +{ + CONF_PATH=/etc/hostap.conf + CONF="interface=wlan0 +driver=nl80211 +ssid=$1 +hw_mode=g +channel=6 +macaddr_acl=0 +auth_algs=1 +ignore_broadcast_ssid=0 +wpa=3 +wpa_passphrase=$2 +wpa_key_mgmt=WPA-PSK +wpa_pairwise=TKIP +rsn_pairwise=CCMP" + + echo "$CONF" > $CONF_PATH + + echo "hostapd.conf:" + cat $CONF_PATH +} + +FUNC_killPidsMightUseWlan () +{ + $UTIL_PATH/kill-process-ids.sh "wpa" + $UTIL_PATH/kill-process-ids.sh "hostap" + /usr/sbin/rfkill unblock all +} + +FUNC_movingFilesToClient () +{ + ssh $CLIENT_ADDR mkdir $CLIENT_PATH + ssh $CLIENT_ADDR mkdir $CLIENT_TEST_JOBS_PATH + ssh $CLIENT_ADDR mkdir $CLIENT_UTIL_PATH + + #scp $WSTATION_TEST_JOBS_PATH$TEST_JOB_NAME $TARGET_ADDR:$TARGET_TEST_JOBS_PATH + scp $SOFTAP_WIFI_TEST_JOB_PATH/wifi-connect-WPA2-PSK-security-test.sh $CLIENT_ADDR:$CLIENT_TEST_JOBS_PATH + scp $SOFTAP_UTIL_PATH/* $CLIENT_ADDR:$CLIENT_UTIL_PATH + #scp $SOFTAP_UTIL_PATH/kill-process-ids.sh $CLIENT_ADDR:$CLIENT_UTIL_PATH + #scp $SOFTAP_UTIL_PATH/logger.sh $CLIENT_ADDR:$CLIENT_UTIL_PATH + #scp $SOFTAP_UTIL_PATH/get-env-var-val-target.sh $CLIENT_ADDR:$CLIENT_UTIL_PATH + +} + +FUNC_logSomthing () # $1 - log msg +{ + echo "$1" + $UTIL_PATH/logger.sh $THIS_FILE_NAME $LOG -v "$1" 54 +} +############################################## test execution ############################################################# +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH + + + +THIS_FILE_NAME=$0 +GET_ENV_VARS=$(find -name "get-env-var-val-target.sh") + +UTIL_PATH="$($GET_ENV_VARS UTIL_PATH)" +SOFTAP_PATH=$($GET_ENV_VARS TARGET_BASE_PATH) +SOFTAP_WIFI_TEST_JOB_PATH=$PWD/$($GET_ENV_VARS WIFI_TEST_PATH) +SOFTAP_UTIL_PATH=$SOFTAP_PATH/$($GET_ENV_VARS UTIL_DIR) + + + + +CLIENT_PATH=$($GET_ENV_VARS TARGET_BASE_PATH) +CLIENT_TEST_JOBS_PATH=$CLIENT_PATH/$($GET_ENV_VARS TEST_SCRIPT_DIR) +CLIENT_UTIL_PATH=$CLIENT_PATH/$($GET_ENV_VARS UTIL_DIR) +CLIENT_ADDR="root@$($GET_ENV_VARS HELPER_DEVICE_IP)" + +FAIL=1 +LOG=3 + +SOFTAP_SSID=$1 +SOFTAP_PASSWORD=$2 + +SOFTAP_STATIC_IP=$3 +SOFTAP_NETMASK=$4 + +#make sure your wifi suports soft Ap interface mode +RESULT=$(/usr/sbin/iw list | grep "Supported interface modes" -A 10 | grep "* AP$" ) || +( ($UTIL_PATH/logger.sh $THIS_FILE_NAME $FAIL -v "wifi do not support AP interface mode" 19) && +(echo "wifi driver do not support AP interface mode") && (exit 1)) || exit 1 + +#create hostapd conf file +SSID=$SOFTAP_SSID +PASSWORD=$SOFTAP_PASSWORD + +FUNC_createHostapConf $SSID $PASSWORD + +FUNC_killPidsMightUseWlan + +#bring up wlan0 +/sbin/ifconfig wlan0 up $SOFTAP_STATIC_IP netmask $SOFTAP_NETMASK +sleep 4 + +#TODO add latter when the softap will work. so it will send IP to client for a successful connection to AP, do next: +#check you have "dhcpd" packg on your system +#config dhcpd (see in soft ap1.test in draftPages dir) +#run dhcpd - do:dhcpd -d -cf /etc/dhcp/dhcpd.conf wlan0 + +FUNC_logSomthing "===========> HOSTAPD STARTED <=========================" + +HOSTAPD_RET_VAL="$( (/usr/sbin/hostapd -d -B $CONF_PATH) 2>&1)" + +FUNC_logSomthing "HOSTAPD_RET_VAL=$HOSTAPD_RET_VAL" + +#TODO check DMESEG for wlan0 crash +DMESG="$( (/bin/dmesg) 2>&1)" +FUNC_logSomthing "===============> start of kernal debug mesg <=========================" +FUNC_logSomthing "DMESG=$DMESG" + +FUNC_logSomthing "===============> moving files to CLIENT <============================" +#transfer wifi connection scripts to device + +FUNC_movingFilesToClient + +FUNC_logSomthing "=================> connecting from CLIENT <=================================" + +STDERR="$( (ssh $CLIENT_ADDR $CLIENT_TEST_JOBS_PATH/wifi-connect-WPA2-PSK-security-test.sh $SSID $PASSWORD) 2>&1)" || +echo "STDERR=$STDERR. failed to connect to softap " && $UTIL_PATH/logger.sh $THIS_FILE_NAME $LOG -v "STDERR=$STDERR. failed to connect to softap" 73 && exit 1 || exit 1 + +#TODO add cleaning from client device + + + + + + + |