diff options
author | Alex Fradkin <alexf@codeaurora.org> | 2016-05-05 17:31:50 +0300 |
---|---|---|
committer | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2016-09-26 09:15:37 -0700 |
commit | 02b73667dd1c6472c3b22e9115f9e1f66256c6df (patch) | |
tree | 4c4b4bbf02a6067c34e723d53a6de09fb3a09de4 |
Test scripts for Dragonboard 410c validation
This test suite include scripts for basic various hardware validation
(e.g. dispaly, storage, WIFI, etc.)
Signed-off-by: Alex Fradkin <alexf@codeaurora.org>
Change-Id: I6ed83ef1bf240fd87357919ac30f011bd9cf5a18
37 files changed, 2765 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..41bfc2c --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +#tiny-apts documentation + +***how to operate: +run only tiny-apts.sh!! this is the main execution file script that calls other scripts. + +***in test-scripts folder put only!!! test-job scripts that exit with 0 for success or 1 for failure. + +step by step: +1) make sure you can connect to your board via ssh as root without it prompting for password, +for instructions see http://www.linuxproblem.org/art_9.html + +2) go to environmentVars.txt file and set TARGET_DEVICE_IP variable to your board Ethernet interface IP address, so tiny-apts can connect to it. +NOTE: some tests will require additional board, set HELPER_DEVICE_IP variable to the second boards Ethernet interface IP address + +3) in file selectTestsWithARGS.txt you can select the tests you wish to run. + +4) when tiny-apts is complete, see test-log.txt for a summary of pass/fail results and for a verbose output see verbose-test-log.txt + + +MANUALLY OPERATED DEVICES USAGE IN TESTS - +in several tests we used manually operated devices such as bluetooth speaker to be discovered by dragonboard as bluetooth device (e.g. bt-connect-to-exist-device-test). + +IMPORTANT GENERAL NOTE: all tests are written for and validated with busybox shell + +OPERATING SYSTEM TOOLS IN USE: +a description of tools (like iozone, hostapd, etc) and their usage in each test. +purpose: in case your operating system miss some tools or uses the tools in a different way, here we show exactly how tiny-apts uses those tools + +test-script file name: + +*wifi-connect-open-security-test.sh +*wifi-connect-WPA2-PSK-security-test.sh +*wifi-soft-ap-connect-test.sh + this test uses the following tools: + wpa_supplicant + usage: /usr/sbin/wpa_supplicant -B -i <wifi device like: wlan0> -c <wpa supplicant configuration file> + + wpa_cli + /usr/sbin/wpa_cli status + + ip + /sbin/ip route show + + ping + /bin/ping -c <number of packeges to ping> <gateway IP to ping to> + +*wifi-soft-ap-connect-test.sh + this test uses the following tools: + iw + /usr/sbin/iw list + + ifconfig + /sbin/ifconfig <wifi interface like wlan0> up <some static IP like 192.168.8.1> netmask 255.255.255.0 + + hostapd + /usr/sbin/hostapd -d -B <hostapd configuration file> + +* sdcard-access-iozone-test.sh + this test uses the following tools: + iozone +* flash-access-iozone-test.sh + this test uses the following tools: + iozone +* random-access-flash-iozone-test.sh + this test uses the following tools: + iozone + +* copyfiles-tests + this test uses the following tools: + mount + umount + diff --git a/environmentVars.txt b/environmentVars.txt new file mode 100644 index 0000000..c5a0611 --- /dev/null +++ b/environmentVars.txt @@ -0,0 +1,45 @@ +#this file is meant to serve the user to manage environment veraibles to sute the aplication to his/her working environment +#IMPORTANT! if you change this file name you also have to change it in "get-env-var-val.sh" +#the only place this file name is hard codded is in util: "get-env-var-val.sh" + +#======> very important veriables for user <============= + + +#please specifie target-device ip +#this ip belongs to the board connected to the working station that the test-scripts will be run on +TARGET_DEVICE_IP=<please write your device IP address> + +#this ip belongs to the second board connected to the working station that the TARGET_DEVICE board will use to run special test-scripts. +#test-scripts like "wifi-soft-ap-connect.sh" that uses the HELPER_DEVICE to connect to the ap created by the TARGET_DEVICE +HELPER_DEVICE_IP=<please write your helper device IP address> + +#work station IP +WSTATION_IP=<please write your work station IP address> + +# ========> less important veriables for user <================ +#these veriables describe the file hierarchy + +#name of directory containning test scripts on target devices and on work-station +TEST_SCRIPT_DIR=test-scripts + +#name of logger file script +LOGGER_FILE=logger.sh + +#name of directory containning utilities used by test scripts and by tiny-apts scripts on target devices and on work-station +UTIL_DIR=util + +#name of file that defines the test-scripts to be run and their arguments +TEST_ARGS_FILE=selectTestsWithARGS.txt + +#name of directory created in the targed device +TARGET_BASE_PATH=/home/root/tiny-apts + +#util dir in target device +UTIL_PATH=tiny-apts/util + +#wifi test-scripts path +WIFI_TEST_PATH=tiny-apts/test-scripts/wifi + + + + diff --git a/file-transferor.sh b/file-transferor.sh new file mode 100644 index 0000000..ea91089 --- /dev/null +++ b/file-transferor.sh @@ -0,0 +1,98 @@ +# 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/bash +#file transferor +#transfers test-job script files to target-device via scp +#operated by tiny-apts +#WSTATION is short for WORKING STATION + +############################### function definition ################################################ +createDirOnTargetDevice () # $1 - dir path +{ + STDERR="$( (ssh $TARGET_ADDR mkdir -p $1) 2>&1)" || +(($WSTATION_LOGGER_PATH $THIS_FILE_NAME $FAIL -v "$STDERR" $LINENO) && echo "ssh in file-transferor failed see verbose log" && exit $EXIT_ERR) || exit $EXIT_ERR +} + +copyToTargetDevice () # $1 - src dir. $2 - dest dir # copies all files from recieved dir to traget device +{ +# STDERR="$( (scp $1/* $TARGET_ADDR:$2) 2>&1)" || +#(($WSTATION_LOGGER_PATH $THIS_FILE_NAME $LOG -v "$STDERR" $LINENO) && echo "scp in file-transferor failed see verbose log" && exit $EXIT_ERR) || exit #$EXIT_ERR + + STDERR="$( (scp -r $1 $TARGET_ADDR:$2) 2>&1)" || +(($WSTATION_LOGGER_PATH $THIS_FILE_NAME $LOG -v "$STDERR" $LINENO) && echo "scp in file-transferor failed see verbose log" && exit $EXIT_ERR) || exit #$EXIT_ERR + + +} +################################## script execution ################################################# + +GET_ENV_VAR=$1 + +WSTATION_TEST_JOBS_PATH="$PWD/$($GET_ENV_VAR TEST_SCRIPT_DIR)" +WSTATION_UTIL_PATH="$PWD/$($GET_ENV_VAR UTIL_DIR)" +WSTATION_LOGGER_PATH="$PWD/$($GET_ENV_VAR LOGGER_FILE)" + +TARGET_BASE_PATH="$($GET_ENV_VAR TARGET_BASE_PATH)" +TARGET_TEST_JOBS_PATH="$TARGET_BASE_PATH/$($GET_ENV_VAR TEST_SCRIPT_DIR)" +TARGET_UTIL_PATH="$TARGET_BASE_PATH/$($GET_ENV_VAR UTIL_DIR)" +TARGET_ADDR="root@$($GET_ENV_VAR TARGET_DEVICE_IP)" + +EXPECTED_ARGS_NUM=1 + +THIS_FILE_NAME=${0##*/} +FAIL=1 +LOG=3 +EXIT_ERR=1 + +$WSTATION_UTIL_PATH/check-args-num.sh $# $EXPECTED_ARGS_NUM $WSTATION_LOGGER_PATH $THIS_FILE_NAME || exit $EXIT_ERR + +#change permitions before transfering to device +chmod a+x -R $WSTATION_TEST_JOBS_PATH +chmod a+x -R $WSTATION_UTIL_PATH + +#create dir for test-job scripts +createDirOnTargetDevice $TARGET_TEST_JOBS_PATH || exit $EXIT_ERR + +#copy test-job scripts to target-device +copyToTargetDevice $WSTATION_TEST_JOBS_PATH $TARGET_BASE_PATH || exit $EXIT_ERR + +#create dir for utils to use from device +createDirOnTargetDevice $TARGET_UTIL_PATH || exit $EXIT_ERR + +#copy logger to util - so test-scripts could use logger on the device +cp logger.sh $WSTATION_UTIL_PATH +#copy environmentVars.txt to util so get-env-var-val-target.sh could use it to give tests-scripts access to environment variables +cp environmentVars.txt $WSTATION_UTIL_PATH + +#copy util files to target-device +copyToTargetDevice $WSTATION_UTIL_PATH $TARGET_BASE_PATH || exit $EXIT_ERR + + + + + + diff --git a/logger.sh b/logger.sh new file mode 100644 index 0000000..7b5741a --- /dev/null +++ b/logger.sh @@ -0,0 +1,65 @@ +# 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. + +#receives $1 = name of test, $2 = result of test (0-success, 0< - fail, 0> - log msg). $3 = if verbose status, $4 - verbose err msg +#writes parms + data and time to txt file + +#if verbose err msg is empty it just exits without logging + +TEST_NAME=$1 +TEST_RESULT=$2 +VERBOSE=$3 +VERBOSE_ERRMSG=$4 +VERBOSE_ERR_LINE_NO=$5 + + +#/home/linaro/tiny-apts/log +#tiny-apts/log + +if [ $TEST_RESULT -eq 0 ]; then + TEST_RESULT="PASS" + +elif [ $TEST_RESULT -gt 0 ]; then + TEST_RESULT="FAIL" +else + TEST_RESULT="LOG MSG" +fi + + +if [ "$VERBOSE" = -v ]; then + if [ -n "$VERBOSE_ERRMSG" ]; then + echo "date:$(date). file name:$TEST_NAME - "LOG MSG", ERRMSG=$VERBOSE_ERRMSG. errLineNum:$VERBOSE_ERR_LINE_NO" >> verbose-test-log.txt + fi +else + ADDITIONAL_INFO=$VERBOSE + echo "date:$(date) $TEST_NAME - $TEST_RESULT $ADDITIONAL_INFO" >> test-log.txt +fi + + + + + diff --git a/selectTestsWithARGS.txt b/selectTestsWithARGS.txt new file mode 100644 index 0000000..e68dd59 --- /dev/null +++ b/selectTestsWithARGS.txt @@ -0,0 +1,76 @@ +#this file is meant to serve the user of the tiny-apts +#only the uncommented lines will be parsed +#each line should look like this: +#<directory containing test in test-scripts>/<name of test-script to be run>:<test-script arguments> +#TBD - acronym for "to be developed" + + +#testing general purpose IO +#gpio/gpio-test.sh:NONE + +#storage/sd-card-discover-test.sh:NONE + +#storage/usb-discover-test.sh:NONE + +#test-script arguments -wifi AP- +#wifi/wifi-connect-open-security-test.sh:<enter your wifi AP> + +#test-script arguments -wifi AP-, -wifi password- +#wifi/wifi-connect-WPA2-PSK-security-test.sh:<enter your wifi AP> <enter your wifi password> + + +#test-script arguments -softap ssid-, -softap password-, -softap static IP-, -softap netmask- +#wifi/wifi-soft-ap-connect-test.sh:<enter softap wifi AP> <enter softap wifi password> <enter static ip> <enter net mask> + +#test-script arguments -name discovery device-,-mac address for discovery device- +#bluetooth/bt-service-discovery-scan-test.sh:<enter your discovery dragonboard name> <enter your discovery dragonboard MAC address> + +#test-script arguments -name discovery device-,-mac address for discovery device- +#bluetooth/bt-connect-test.sh:<enter your discovery dragonboard name> <enter your discovery dragonboard MAC address> + +#test-script arguments -ip address for discovery device-,-name discovery device-,-mac address for discovery device- +#this test uses manual operated device +#bluetooth/bt-connect-to-exist-device-test.sh: <enter your discovery dragonboard IP address> <enter your discovery dragonboard name> <enter your discovery dragonboard MAC address> + +#Runs glxgear opengl toy on fullscreen and checks FPS. Should be given two parameters min and optional max expected FPS +display/opengl_glxgears_test.sh:0 + +#test-script arguments -criteria to read-, -criteria to write- +#storage/sdcard-access-iozone-test.sh:0 0 + +#test-script arguments -criteria to read-, -criteria to write- +#storage/flash-access-iozone-test.sh:0 0 + +#-script arguments -criteria to read-, -criteria to write- +#storage/random-access-flash-iozone-test.sh:0 0 + +#-script arguments -criteria to pass- +#storage/copyfiles-usb-flash-test.sh:0 + +#-script arguments -criteria to pass- +#storage/copyfiles-flash-usb-test.sh:0 + +#script arguments -criteria to pass- +#storage/copyfiles-flash-sdcard-test.sh:0 + +#-script arguments -criteria to pass- +#storage/copyfiles-sdcard-flash-test.sh:0 + +#USB mass storage Iozone script +#storage/usb_mass_storage_iozone_sequential-test.sh:0 0 + + +############## tests under development ######################################## + + + +#Runs gstreamer on USB webcam and checks the video resolution vs expected. Expects two arguments: height and width in pixels +#no cammera connected - args are DUMMY - TBD +#video/usbcam_gstreamer_video-test.sh:18 18 + +#plays H264 encoded video content on the screen. The test gets an argument which file to play. Also, it prints out CPU temperatures, frequencies and how much CPU% the playback takes. +#video/h264-mp4-gstreamer-playback-test.sh + + + + diff --git a/test-executor.sh b/test-executor.sh new file mode 100644 index 0000000..380403e --- /dev/null +++ b/test-executor.sh @@ -0,0 +1,156 @@ +# 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/bash +#executes test-jobs located on the target device + +############################### function definition ####################################################################3 +#recieves params: $1=TEST-JOB, $2=RESULT, $3=additional info +function print-result +{ + if [ $2 -eq 0 ] + then + echo "$1 - PASS $3" + else + echo "$1 - FAIL $3" + fi +} + +function get-test-job-args #$1 = test-job line from selectTestsWithARGS.txt +{ + DEL_NUM="$(echo $1 | awk -F':' '{print NF}')" + echo $1 | cut -d":" -f"2-$DEL_NUM" +} + +function get-test-job-file-name #$1 = test-job line from selectTestsWithARGS.txt +{ + echo $1 | cut -d":" -f1 +} + +function isRunTest #$1 = test-job +{ + RESULT=$(grep $1 $TEST_ARG_PATH | grep "run test") + return $? +} + +function cleneTargetDevCacheMem +{ + FREE_RET_VAL="$( (ssh $TARGET_ADDR free -h) 2>&1)" && ($LOGGER_PATH $THIS_FILE_NAME $LOG -v "FREE_RET_VAL before=$FREE_RET_VAL" $LINENO) || (($LOGGER_PATH $THIS_FILE_NAME $LOG -v "free failed" $LINENO) && return $EXIT_ERR) || return $EXIT_ERR + + SYNC_RET_VAL="$( (ssh $TARGET_ADDR sync) 2>&1)" || (($LOGGER_PATH $THIS_FILE_NAME $LOG -v "sync failed! SYNC_RET_VAL=$SYNC_RET_VAL" $LINENO) && return $EXIT_ERR) || return $EXIT_ERR + + CLEAN_RET_VAL="$( (ssh $TARGET_ADDR "echo 3 > /proc/sys/vm/drop_caches") 2>&1)" || (($LOGGER_PATH $THIS_FILE_NAME $LOG -v "clean cache failed! CLEAN_RET_VAL=$CLEAN_RET_VAL" $LINENO) && return $EXIT_ERR) || return $EXIT_ERR + + FREE_RET_VAL="$( (ssh $TARGET_ADDR free -h) 2>&1)" && ($LOGGER_PATH $THIS_FILE_NAME $LOG -v "FREE_RET_VAL after=$FREE_RET_VAL" $LINENO) || (($LOGGER_PATH $THIS_FILE_NAME $LOG -v "free failed!" $LINENO) && return $EXIT_ERR) || return $EXIT_ERR +} + +function checkIfTestExists # $1 - test-script file name +{ + + TEST_DIR_PATH=$(echo $1 | cut -d"/" -f1) + + TEST_FILE_NAME=$(echo $1 | cut -d"/" -f2) + + GREP_RET_VAL=$(ls $WSTATION_TEST_SCRIPTS_PATH/$TEST_DIR_PATH | grep $TEST_FILE_NAME) + + if [ -z "$GREP_RET_VAL" ]; then + return $EXIT_ERR + fi +} +#################### script execution ##################################### +################### environment variables ################################ +GET_ENV_VAR=$1 +# target-device environment varibales +TARGET_BASE_PATH="$($GET_ENV_VAR TARGET_BASE_PATH)" +TARGET_TEST_JOBS_PATH="$TARGET_BASE_PATH/$($GET_ENV_VAR TEST_SCRIPT_DIR)" +TARGET_UTIL_PATH="$TARGET_BASE_PATH/$($GET_ENV_VAR UTIL_DIR)" +TARGET_ADDR="root@$($GET_ENV_VAR TARGET_DEVICE_IP)" + +# work-station environment varibales +TEST_ARG_PATH="$PWD/$($GET_ENV_VAR TEST_ARGS_FILE)" +LOGGER_PATH="$PWD/$($GET_ENV_VAR LOGGER_FILE)" +WSTATION_UTIL_PATH="$PWD/$($GET_ENV_VAR UTIL_DIR)" +WSTATION_TEST_SCRIPTS_PATH="$PWD/$($GET_ENV_VAR TEST_SCRIPT_DIR)" + +THIS_FILE_NAME=${0##*/} +FAIL=1 +LOG=-2 +EXIT_ERR=1 + +EXPECTED_ARGS_NUM=1 +$WSTATION_UTIL_PATH/check-args-num.sh $# $EXPECTED_ARGS_NUM $LOGGER_PATH $THIS_FILE_NAME || exit $EXIT_ERR + +#TEST_COUNTER=0 +SUCCESSFUL_TEST_COUNTER=0 + +#ignors comments and new lines from selectTestsWithARGS.txt file +LIST_OF_TEST_JOBS=$(grep -v "#" $TEST_ARG_PATH | grep -v "^$") + +#run all test-jobs files on target-device +IFS=' +' +for TEST_JOB_LINE in $LIST_OF_TEST_JOBS +do + cleneTargetDevCacheMem + $WSTATION_UTIL_PATH/check-ret-val-and-log.sh $? "function cleneTargetDevCacheMem failed" $LOGGER_PATH $THIS_FILE_NAME || exit $EXIT_ERR + + TEST_JOB_FILE_NAME="$(get-test-job-file-name "$TEST_JOB_LINE")" + checkIfTestExists $TEST_JOB_FILE_NAME + $WSTATION_UTIL_PATH/check-ret-val-and-log.sh $? "TEST DOSN'T EXIST! TEST NAME:$TEST_JOB_FILE_NAME WRITEN IN FILE: $TEST_ARG_PATH NOT FOUND IN DIR:$WSTATION_TEST_SCRIPTS_PATH. MAKE SURE IT'S NOT A TYPO" $LOGGER_PATH $THIS_FILE_NAME || exit $EXIT_ERR + + echo "$TEST_JOB_FILE_NAME args:$(get-test-job-args "$TEST_JOB_LINE")" + + STRING_RET_VAL="$( (ssh $TARGET_ADDR "echo \"\" > test_string_ret_val.txt" ) 2>&1)" + if [ "${TEST_JOB_FILE_NAME: -2}" = py ] + then + STDERR="$( (ssh $TARGET_ADDR python $TARGET_TEST_JOBS_PATH/"$TEST_JOB_FILE_NAME" $(get-test-job-args "$TEST_JOB_LINE") ) 2>&1)" + RESULT=$? + else + STDERR="$( (ssh $TARGET_ADDR $TARGET_TEST_JOBS_PATH/"$TEST_JOB_FILE_NAME" $(get-test-job-args "$TEST_JOB_LINE") ) 2>&1)" + RESULT=$? + fi + STRING_RET_VAL="$( (ssh $TARGET_ADDR cat test_string_ret_val.txt ) 2>&1)" + print-result "$TEST_JOB_FILE_NAME" $RESULT $STRING_RET_VAL + $LOGGER_PATH $TEST_JOB_FILE_NAME $RESULT $STRING_RET_VAL + $LOGGER_PATH $THIS_FILE_NAME $LOG -v "$STDERR" $LINENO + + + TEST_COUNTER=$((TEST_COUNTER+1)) + (exit $RESULT) && SUCCESSFUL_TEST_COUNTER=$((SUCCESSFUL_TEST_COUNTER+1)) + + echo "-------------------------------------------------------------------------------------" + $LOGGER_PATH $THIS_FILE_NAME $LOG -v "-------------------------------------------------------------------------------------" $LINENO +done +IFS=$OLDIFS + +SUMMERY="TEST SUMMERY: passed $SUCCESSFUL_TEST_COUNTER out of $TEST_COUNTER tests" +echo $SUMMERY +$LOGGER_PATH $SUMMERY $LOG + + + + 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 + + + + + + + diff --git a/tiny-apts.sh b/tiny-apts.sh new file mode 100644 index 0000000..465ed8a --- /dev/null +++ b/tiny-apts.sh @@ -0,0 +1,63 @@ +# 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/bash +#author c_aziski (Alfred Ziskind) +#tiny-apts +#=========> must be run as super user <========== + +#transfers files from workStation to target device +#running the test-job scripts on target device +#looging results + +####################################### function decleration ################################################################## + +####################################### test execution ################################################################## +chmod a+xw * -R +EXIT_ERR=1 + +UTIL_PATH=$PWD/util +GET_ENV_VARS=$UTIL_PATH/get-env-var-val-station.sh + + +PRINT_BEGIN="test-job scripts transfer to target device in progress..." +PRINT_RUNNING="running tests on target device" +PRINT_END="tiny-apts finished. test results see test-log.txt, verbose err log file see: verbose-test-log.txt" + +echo $PRINT_BEGIN +./file-transferor.sh $GET_ENV_VARS || (echo $PRINT_END && echo "file transferor failed" && exit $EXIT_ERR) || exit $EXIT_ERR + +echo $PRINT_RUNNING +./test-executor.sh $GET_ENV_VARS + +echo "-----------" >> verbose-test-log.txt +echo "-----------" >> test-log.txt +echo $PRINT_END + + + + diff --git a/util/check-args-num.sh b/util/check-args-num.sh new file mode 100644 index 0000000..560d908 --- /dev/null +++ b/util/check-args-num.sh @@ -0,0 +1,49 @@ +# 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 +#util script that checks if number of arguments given are as expected + + + +CURR_NUM_ARGS=$1 +EXPECTED_NUM_ARGS=$2 +ABSOLUTE_LOGER_PATH=$3 +CALLED_FROM_FILE_NAME=$4 + +LOG=3 +DUMMY_LINE_NUM=1 +EXIT_ERR=1 + +RET_VAL=0 + +if [ $CURR_NUM_ARGS -ne $EXPECTED_NUM_ARGS ]; then + $ABSOLUTE_LOGER_PATH $CALLED_FROM_FILE_NAME $LOG -v "incorrect num of arguments" $DUMMY_LINE_NUM + RET_VAL=$EXIT_ERR +fi + +exit $RET_VAL diff --git a/util/check-ret-val-and-log.sh b/util/check-ret-val-and-log.sh new file mode 100644 index 0000000..6ca46db --- /dev/null +++ b/util/check-ret-val-and-log.sh @@ -0,0 +1,51 @@ +# 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 +#util script that checks the return value of a command, if failed - logs an err msg. +#if command succeeded it dose nothing + +CMD_RET_VAL=$1 +ERR_LOG_MSG=$2 +ABSOLUTE_LOGER_PATH=$3 +CALLED_FROM_FILE_NAME=$4 + +LOG=3 +DUMMY_LINE_NUM=1 +EXIT_ERR=1 + +RET_VAL=0 + + +if [ $CMD_RET_VAL -ne 0 ]; then + $ABSOLUTE_LOGER_PATH $CALLED_FROM_FILE_NAME $LOG -v "$ERR_LOG_MSG" $DUMMY_LINE_NUM + RET_VAL=$EXIT_ERR +fi + +exit $RET_VAL + +#(($ABSOLUTE_LOGER_PATH $CALLED_FROM_FILE_NAME $LOG -v "$ERR_LOG_MSG" $LINENO) && exit $EXIT_ERR) || exit $EXIT_ERR diff --git a/util/copyfiles-flashdestination.sh b/util/copyfiles-flashdestination.sh new file mode 100644 index 0000000..b11c3fc --- /dev/null +++ b/util/copyfiles-flashdestination.sh @@ -0,0 +1,76 @@ +# 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 +CRE_PASS=$2 +MOUNT=$1 +PASSORFAIL=1 # need to success copy tests +MOUNTED_DIR=/mnt/ +CP_DIR=/tmp/ +FILE_NAME=file.txt + +mount $MOUNT $MOUNTED_DIR || exit 1 + +COMMAND="$( (dd if=/dev/urandom of=$MOUNTED_DIR$FILE_NAME count=1024 bs=1M) 2>&1)" +chmod 777 $MOUNTED_DIR$FILE_NAME || exit 1 +SIZE_FILE="$( (ls -la $MOUNTED_DIR$FILE_NAME | awk '{print $5}') 2>&1)" +MEGA=1048576 + +GT="$( (echo $CRE_PASS $MEGA | awk '{print $1 * $2}') 2>&1)" +FILE_SIZE_IN_MEGA="$( (echo $SIZE_FILE $MEGA | awk '{print $1 / $2}') 2>&1)" + +echo "File size is $FILE_SIZE_IN_MEGA MB" + +OUTPUT="$( (time cp $MOUNTED_DIR$FILE_NAME $CP_DIR) 2>&1)" +echo "$OUTPUT" >> timels.txt + +MINUTES="$( (grep "real" timels.txt | awk '{print $2}' | cut -d m -f 1) 2>&1)" +SEC="$( (grep "real" timels.txt | awk '{print $3}' | cut -d s -f 1) 2>&1)" +rm timels.txt +MIN_IN_SEC=$(( $MINUTES*60 )) +SEC_AMOUNT="$( (echo $SEC $MIN_IN_SEC | awk '{print $1 + $2}') 2>&1)" +RATE="$( (echo $FILE_SIZE_IN_MEGA $SEC_AMOUNT | awk '{print $1 / $2}') 2>&1)" +echo "Measured data rate is $RATE MBps" + +#writing result to file, to be read by test-executor.sh and used in log files +echo "data rate = $RATE MBps" > test_string_ret_val.txt + +RATE_AFTER_MULT="$( (echo $RATE $MEGA | awk '{print $1 * $2}') 2>&1)" + + +if [ $RATE_AFTER_MULT > $GT ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi + +rm $MOUNTED_DIR$FILE_NAME $CP_DIR$FILE_NAME +umount $MOUNT + +echo "=====>copy test done<=====" + + +exit $PASSORFAIL + diff --git a/util/copyfiles-flashsource.sh b/util/copyfiles-flashsource.sh new file mode 100644 index 0000000..716b794 --- /dev/null +++ b/util/copyfiles-flashsource.sh @@ -0,0 +1,74 @@ +# 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 + + +CRE_PASS=$2 + +#$1 is /dev/sda1 USB DEVICE- MASS STORAGE or dev/mmcblk1p1 sd card +PASSORFAIL=1 # need to success copy +CP_DIR=/tmp/ +FILE_NAME=file.txt +COMMAND="$( (dd if=/dev/urandom of=$CP_DIR$FILE_NAME count=1024 bs=1M) 2>&1)" +chmod 777 $CP_DIR$FILE_NAME || exit 1 +SIZE_FILE="$( (ls -la $CP_DIR$FILE_NAME | awk '{print $5}') 2>&1)" + +MEGA=1048576 +K10=10240 +GT="$( (echo $CRE_PASS $K10 | awk '{print $1 * $2}') 2>&1)" +FILE_SIZE_IN_MEGA="$( (echo $SIZE_FILE $MEGA | awk '{print $1 / $2}') 2>&1)" +MOUNT=$1 +MOUNTED_DIR=/mnt/ + +echo "File size is $FILE_SIZE_IN_MEGA MB" +mount $MOUNT $MOUNTED_DIR || exit 1 +OUTPUT="$( (time cp $CP_DIR$FILE_NAME $MOUNTED_DIR) 2>&1)" +echo "$OUTPUT" >> timels.txt +MINUTES="$( (grep "real" timels.txt | awk '{print $2}' | cut -d m -f 1) 2>&1)" +SEC="$( (grep "real" timels.txt | awk '{print $3}' | cut -d s -f 1) 2>&1)" +rm timels.txt +MIN_IN_SEC=$((MINUTES * 60)) +SEC_AMOUNT="$( (echo $SEC $MIN_IN_SEC | awk '{print $1 + $2}') 2>&1)" +RATE="$( (echo $FILE_SIZE_IN_MEGA $SEC_AMOUNT | awk '{print $1 / $2}') 2>&1)" +echo "Measured data rate is $RATE MBps" + +#writing result to file, to be read by test-executor.sh and used in log files +echo "data rate = $RATE MBps" > test_string_ret_val.txt + +RATE_AFTER_MULT="$( (echo $RATE $K10 | awk '{print $1 * $2}') 2>&1)" + +if [ $RATE_AFTER_MULT -gt $GT ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi + +rm $MOUNTED_DIR$FILE_NAME $CP_DIR$FILE_NAME +umount $MOUNT + +echo "=====>copy done<=====" +exit $PASSORFAIL + diff --git a/util/get-env-var-val-station.sh b/util/get-env-var-val-station.sh new file mode 100644 index 0000000..0a8722f --- /dev/null +++ b/util/get-env-var-val-station.sh @@ -0,0 +1,39 @@ +# 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 +#recieves an environment variable +#reads from environmentVars.txt +#and prints the variable value on stdout + +#usage - $(getEnvVarVal <SOME_ENV_VAR>) + +# $1 environmet var + + +(grep "$1" environmentVars.txt | cut -d"=" -f2) + diff --git a/util/get-env-var-val-target.sh b/util/get-env-var-val-target.sh new file mode 100644 index 0000000..8d1a9d8 --- /dev/null +++ b/util/get-env-var-val-target.sh @@ -0,0 +1,42 @@ +# 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 +#recieves an environment variable +#reads from environmentVars.txt +#and prints the variable value on stdout + +#usage - $(getEnvVarVal <SOME_ENV_VAR>) + +# $1 environmet var + +ENV_VAR_PATH=$(find -name "environmentVars.txt") + + +grep "$1" $ENV_VAR_PATH | cut -d"=" -f2 + + diff --git a/util/get-wifi-config-and-connect.sh b/util/get-wifi-config-and-connect.sh new file mode 100644 index 0000000..16dc010 --- /dev/null +++ b/util/get-wifi-config-and-connect.sh @@ -0,0 +1,153 @@ +# 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 +#util script for wifi connection test-scripts +#receives configuration info to connect to wifi AP +# $1 configuration info + +############################ functions definition #################################################################### +createWpaConf () # $1 conf information. $2 = wpa_supplicant.conf path +{ + echo "$1" > $2 +} + +runCmdCheckAndLog () # $1 command to execute and check. $2 expected ret val if successful. $3 logg msg. $4 sleep time between attempts. $5 num of attempts. $6 - expected ret val if failed +{ + ATTEMPTS=$5 + COUNTER=0 + SUCCESS_PHRASE=$2 + FAILE_PHRASE=$6 + + echo "BEFORE WHILE LOOOP: ATTEMPTS=$ATTEMPTS => COUNTER=$COUNTER" + + while [ $COUNTER -lt $ATTEMPTS ]; do + COUNTER=$((COUNTER+1)) + echo "" + echo "IN WHILE LOOP EXECUTING=$1" + + STDOUT_RET_VAL="$( ($1) 2>&1)" + + sleep $4 + + echo "STDOUT_RET_VAL=$STDOUT_RET_VAL" + echo "SLEEPS AMOUNT OF SECONDS=$4" + echo "ATTEMPTS=$ATTEMPTS => COUNTER=$COUNTER" + + RESULT=$(echo "$STDOUT_RET_VAL" | grep "$FAILE_PHRASE") + RETVAL=$? + echo "FAILE_PHRASE RETVAL=$RETVAL" + if [ $RETVAL -eq 0 ]; then + continue + fi + + RESULT=$(echo "$STDOUT_RET_VAL" | grep "$SUCCESS_PHRASE") + RETVAL=$? + echo "SUCCESS_PHRASE RETVAL=$RETVAL" + if [ $RETVAL -eq 0 ]; then + break + fi + + done + + RESULT=$(echo "$STDOUT_RET_VAL" | grep "$2") || + ( ($UTIL_PATH/logger.sh $THIS_FILE_NAME $LOG -v "$3. STDERR:$STDOUT_RET_VAL" 51) && (echo "$3. STDERR:$STDOUT_RET_VAL") && (exit 1)) || exit 1 +} + +getIpFromUdhcp () +{ + echo "IN FUNCTION: getIpFromUdhcp" + + runCmdCheckAndLog "/sbin/udhcpc -i wlan0" "obtained" "udhcpc shulden't fail" 4 4 "ip: not found" + + runCmdCheckAndLog "/sbin/ifconfig wlan0" "inet addr" "udhcpc failed to obtain IP for wifi AP" 3 2 "DUMMY expected error" +} + +pingGatewayOfConnectedWifiAp () +{ + LINE_CONTAINNING_GATEWAY_IP=$(/sbin/ip route show | grep wlan0 | grep default) && echo "LINE_CONTAINNING_GATEWAY_IP=$LINE_CONTAINNING_GATEWAY_IP" || + ( ($UTIL_PATH/logger.sh $THIS_FILE_NAME $LOG -v "failed to grep gateway ip" 58) && (echo "failed to grep gateway ip") && (exit 1) ) || exit 1 + + for ITEM in $LINE_CONTAINNING_GATEWAY_IP; do + if [ $ITEM != "dev" ]; then + PREV=$ITEM + else + GATEWAY_IP=$PREV + fi + done + + echo "GATEWAY_IP=$GATEWAY_IP" + + runCmdCheckAndLog "/bin/ping -c 1 $GATEWAY_IP" "received, 0% packet loss" "faild to ping gateway IP" 5 7 "0 packets received" || exit 1 +} +############################## test run ##################################################################################### + +THIS_FILE_NAME=$0 + +GET_ENV_VARS=$(find -name "get-env-var-val-target.sh") +UTIL_PATH="$($GET_ENV_VARS UTIL_PATH)" + +LOG=-2 +WPA_SUPP_CONF_PATH=/etc/wpa_supplicant_test.conf +CONF_INFO="$1" + + +$UTIL_PATH/kill-process-ids.sh "wpa" +$UTIL_PATH/kill-process-ids.sh "udhcpc" + +createWpaConf "$CONF_INFO" $WPA_SUPP_CONF_PATH + +echo "CONF_INFO: $CONF_INFO" + +/usr/sbin/rfkill unblock all + +runCmdCheckAndLog "/usr/sbin/wpa_supplicant -B -i wlan0 -c $WPA_SUPP_CONF_PATH" "Successfully initialized wpa_supplicant" "wpa_supplicant configuration failed" 1 2 "nl80211:" || exit 1 + +runCmdCheckAndLog "/usr/sbin/wpa_cli status" "wpa_state=COMPLETED" "wpa_cli status - dosent show:\"wpa_state=COMPLETED\"" 6 20 "wpa_state=DISCONNECTED" || exit 1 + +getIpFromUdhcp || exit 1 + +pingGatewayOfConnectedWifiAp || exit 1 + +#rm $WPA_SUPP_CONF_PATH + + + + + + + + + + + + + + + + + diff --git a/util/kill-process-ids.sh b/util/kill-process-ids.sh new file mode 100644 index 0000000..aa747a4 --- /dev/null +++ b/util/kill-process-ids.sh @@ -0,0 +1,47 @@ +# 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 +#util script for killing unwanted process +# $1 = string to serach process IDs + +PROCESS_PIDS=$(/bin/ps | grep "$1" | grep -v "grep" | grep -v "/bin/sh" | cut -d"r" -f1) +echo "PROCESS_PIDS=$PROCESS_PIDS" + + +PROCESSES=$(/bin/ps | grep "$1" | grep -v "grep" | grep -v "/bin/sh") +echo "PROCESSES=$PROCESSES" + + +for ITEM in $PROCESS_PIDS; do + echo "ITEM=$ITEM" + STDERR="$( (kill -9 $ITEM) 2>&1)" +done + +echo "inside kill util. return val=$?" + +exit 0 diff --git a/util/logger.sh b/util/logger.sh new file mode 100644 index 0000000..7b5741a --- /dev/null +++ b/util/logger.sh @@ -0,0 +1,65 @@ +# 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. + +#receives $1 = name of test, $2 = result of test (0-success, 0< - fail, 0> - log msg). $3 = if verbose status, $4 - verbose err msg +#writes parms + data and time to txt file + +#if verbose err msg is empty it just exits without logging + +TEST_NAME=$1 +TEST_RESULT=$2 +VERBOSE=$3 +VERBOSE_ERRMSG=$4 +VERBOSE_ERR_LINE_NO=$5 + + +#/home/linaro/tiny-apts/log +#tiny-apts/log + +if [ $TEST_RESULT -eq 0 ]; then + TEST_RESULT="PASS" + +elif [ $TEST_RESULT -gt 0 ]; then + TEST_RESULT="FAIL" +else + TEST_RESULT="LOG MSG" +fi + + +if [ "$VERBOSE" = -v ]; then + if [ -n "$VERBOSE_ERRMSG" ]; then + echo "date:$(date). file name:$TEST_NAME - "LOG MSG", ERRMSG=$VERBOSE_ERRMSG. errLineNum:$VERBOSE_ERR_LINE_NO" >> verbose-test-log.txt + fi +else + ADDITIONAL_INFO=$VERBOSE + echo "date:$(date) $TEST_NAME - $TEST_RESULT $ADDITIONAL_INFO" >> test-log.txt +fi + + + + + diff --git a/util/search-cmd-output.sh b/util/search-cmd-output.sh new file mode 100644 index 0000000..41bfe31 --- /dev/null +++ b/util/search-cmd-output.sh @@ -0,0 +1,75 @@ +# 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 +#author c_aziski (Alfred Ziskind) +#testing presence of all search items in a command output +#fails if at least one item missing, when fails logges the testing file and the missing item and returns 1 +#on success return 0 + +THIS_FILE_NAME=$0 +COMMAND="$1" +SEARCH_ITEMS="$2" +LIST_OF_ITEMS_TO_SEARCH_IN=$(eval $COMMAND) +TEST_FILE_NAME=$3 + +LOGGER_PATH=tiny-apts/util +FAIL=1 + +TRUE="true" +FALSE="false" +EMPTY_STR="" + +IS_FOUND=$FALSE +MISSING_ITEMS=$EMPTY_STR + +for I in $SEARCH_ITEMS +do + for j in $LIST_OF_ITEMS_TO_SEARCH_IN + do + if [ "$I" = "$j" ] + then + IS_FOUND=$TRUE + break + fi + IS_FOUND=$FALSE + done + + if [ "$IS_FOUND" = "$FALSE" ] + then + MISSING_ITEMS="$MISSING_ITEMS $I" + fi +done + + +if [ "$MISSING_ITEMS" = "$EMPTY_STR" ] +then + exit 0 +else + $LOGGER_PATH/logger.sh $THIS_FILE_NAME $FAIL -v "module called from test file:$TEST_FILE_NAME. missing search items are: $MISSING_ITEMS" 45 + exit 1 +fi |