diff options
author | Alfred Ziskind <aziski@codeaurora.org> | 2016-08-31 16:45:24 +0300 |
---|---|---|
committer | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2016-09-26 09:15:49 -0700 |
commit | 10acb53f5693dd95bb60f3064e821cc882acd472 (patch) | |
tree | f2df49f017c01385ff3bdd886d1374b99811d57d | |
parent | 02b73667dd1c6472c3b22e9115f9e1f66256c6df (diff) |
Test scripts for Dragonboard 410c validation version 1.1
This test suite include scripts for basic various hardware validation
(e.g. dispaly, storage, WIFI, etc.)
New tests were added:
- storage
- WIFI
- audio
- video
...
Non-relevant/old tests removed:
- old bluetooth tests
- old storage tests
Change-Id: Ic78707ac0212c34ad368d075ecfe44c2f27b40c5
Signed-off-by: Alfred Ziskind <aziski@codeaurora.org>
91 files changed, 6447 insertions, 2003 deletions
@@ -0,0 +1,26 @@ +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. diff --git a/README.md b/README.md index 41bfc2c..1b2a029 100644..100755 --- a/README.md +++ b/README.md @@ -1,27 +1,90 @@ #tiny-apts documentation -***how to operate: +acronym definition: +working station or WSTATON - pc that is the working station connected to the device under test +DUT - device/board under test +HELPER - the second board connected to the WSTATION for tests that require a second board +TBD - to be developed + +working station requirements: +the pc that is the working station connected to the DUT must be debian (e.g jessie) distribution or ubuntu + + +*** 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. +*** in test-scripts folder put only!!! test-job scripts that exit with 0 for success or higher than 0 for failure. step by step: -1) make sure you can connect to your board via ssh as root without it prompting for password, + +1. make sure you can connect to your board via ssh as root without it prompting for password, +also from DUT to HELPER and from HELPER to DUT without 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. +2. defining environment variables in environmentVars.txt: + 2.1) TARGET_DEVICE_IP - set to your board Ethernet interface IP address, so tiny-apts can connect to it. + 2.2) TARGET_DEVICE_USER - the user name on the DUT. + 2.3) HELPER_DEVICE_IP - set to second boards Ethernet interface IP address + 2.4) CONTENT_FILE_PATH - some tests (e.g audio, video) will require sound/video files to run, + here you set the full path of the directory on the working station containing these files + 2.5) CLIENT_CONTENT_DIR - just the directory name of the content files directory. + these is the name that will appear on the DUT. + 2.6) content variables, set only the files name: SOUND_FILE_WAV, SOUND_FILE_MP3, SOUND_FILE_OGG, + VIDEO_FILE_1080P_24FPS_MOV, VIDEO_FILE_1080P_30FPS_MOV, VIDEO_FILE_1080P_60FPS_MP4, VIDEO_FILE_720P_24FPS_MOV + 2.7) optional variables - are meant for developers if there is a need to change current directories names in the file tree. + for just running/developing tests, they should not be altered + -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 +3. in file selectTestsWithARGS.txt you can select the tests you wish to run by uncommenting them +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 +*** list of tests below requires executables added to util directory or appropriate package installed on the device + +1. fio-test.sh requires fio-test.py - https://github.com/Linaro/test-definitions/blob/master/ubuntu/scripts/fio-test.py + +2. ebiz.sh requires ebizzy - https://sourceforge.net/projects/ebizzy/ + +3. gettime.sh requires gettimeofday02 - https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/gettimeofday/gettimeofday02.c + +4. hackbench.sh requires hackbench - https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/sched/cfs-scheduler/hackbench.c + +5. lmbench.sh requires lat_ctx - https://github.com/foss-for-synopsys-dwc-arc-processors/lmbench/blob/master/src/lat_ctx.c + +6. lscpu.sh requires lscpu - https://layers.openembedded.org/layerindex/recipe/21404/ + +7. rtc.sh requirs rtc01 - https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/device-drivers/rtc/rtc01.c + +8. strng.sh requires stress-ng - https://github.com/ColinIanKing/stress-ng + +9. sysbench.sh requires sysbench - https://github.com/akopytov/sysbench + +Some benchmarks depends on these libraries, please add these lib files to util directory: + +libapparmor.so.1 + +libboost_system.so.1.55.0 + +libboost_thread.so.1.55.0 + +libbsd.so.0 + +libibverbs.so.1 + +libmysqlclient.so.18 + +librados.so.2 + +librbd.so.1 + +librdmacm.so.1 + + + 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 @@ -33,27 +96,27 @@ test-script file name: *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> + usage: wpa_supplicant -B -i <wifi device e.g: wlan0> -c <wpa supplicant configuration file> wpa_cli - /usr/sbin/wpa_cli status + wpa_cli status ip - /sbin/ip route show + ip route show ping - /bin/ping -c <number of packeges to ping> <gateway IP to ping to> + 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 + iw list ifconfig - /sbin/ifconfig <wifi interface like wlan0> up <some static IP like 192.168.8.1> netmask 255.255.255.0 + 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> + hostapd -d -B <hostapd configuration file> * sdcard-access-iozone-test.sh this test uses the following tools: diff --git a/environmentVars.txt b/environmentVars.txt index c5a0611..230b5ed 100644..100755 --- a/environmentVars.txt +++ b/environmentVars.txt @@ -1,44 +1,98 @@ -#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" +#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. -#======> very important veriables for user <============= +#this file is meant to serve the user to manage environment variables to suit the application to his/her working environment -#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> +#IMPORTANT! if you change this file name you also have to change it in "get-env-var-val-target.sh" utility +#it's the only place this file name is hard codded -#work station IP -WSTATION_IP=<please write your work station IP address> +#======> mandatory variables for user <============= -# ========> less important veriables for user <================ -#these veriables describe the file hierarchy +#please specify 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=<IP of DUT> -#name of directory containning test scripts on target devices and on work-station -TEST_SCRIPT_DIR=test-scripts +#user name with user privileges - for commands that must be executed as user and not root +TARGET_DEVICE_USER=<DUT user name. e.g linaro> -#name of logger file script -LOGGER_FILE=logger.sh +#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=<IP of helper board> + +#========> content files for testing <====================== +#path to directory containing content files needed for testing, e.g.: sound files for audio tests, video file Etc +CONTENT_FILE_PATH=<full path to my content files/<content dir name>> + +#name of dir containing content files for testing in DUT +#must be the same name as dir name of CONTENT_FILE_PATH +CLIENT_CONTENT_DIR=<content dir name> + + +#populate the directory with files with these specific names: +SOUND_FILE_WAV=<fileName.wav> + +#=====> make sure the MP3 file Sampling rate is 44.1 KHz! +SOUND_FILE_MP3=<fileName.mp3> + +SOUND_FILE_OGG=ACDC_-_<fileName.ogg> + +# Video files needs to be at least 9 MIN long for video stability test to succeed +VIDEO_FILE_1080P_24FPS_MOV=<1080p 24FPS mov file e.g big_buck_bunny_1080p_h264.mov> +VIDEO_FILE_1080P_30FPS_MOV=<1080p 30FPS mov file e.g big_buck_bunny_1080p_30fps.MOV> +VIDEO_FILE_1080P_60FPS_MP4=<1080p 60FPS mp4 file e.g bbb_sunflower_1080p_60fps_normal.mp4> +VIDEO_FILE_720P_24FPS_MOV=<720p 24FPS mov file e.g big_buck_bunny_720p_h264.mov> -#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 +# ========> optional variables for user <================ +SOUND_FILE_MSG_TO_USER=msg_to_user +LED_TEST_MSG_TO_USER=MSG_TO_USER_LED_TEST + +###### with these variables the developer builds paths to run test/utility scripts on DUT ###### +### mostly used in generally-used-variables.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 +#name of directory containing test scripts on target devices and on work-station +TEST_SCRIPT_DIR=test-scripts + +#wifi test-scripts dir name +WIFI_TESTS_DIR=wifi + +#name of directory containing utilities used by test scripts and by tiny-apts scripts on target devices and on work-station +UTIL_DIR=util + +#name of directory containing tests to be run from the working station +STATION_TEST_DIR=station-test-scripts + + -#wifi test-scripts path -WIFI_TEST_PATH=tiny-apts/test-scripts/wifi diff --git a/file-transferor.sh b/file-transferor.sh index ea91089..1e824a9 100644..100755 --- a/file-transferor.sh +++ b/file-transferor.sh @@ -1,29 +1,30 @@ -# 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. +#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 @@ -35,64 +36,55 @@ 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 +(($WSTATION_LOGGER_PATH $THIS_FILE_NAME $LOG -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 - - + STDERR="$( (rsync -avzP $1 $TARGET_ADDR:$2) 2>&1)" || (($WSTATION_LOGGER_PATH $THIS_FILE_NAME $LOG -v "$STDERR" $LINENO) && echo "rsync 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 +# defines general variables used in most tests +source "$(dirname $(readlink -f $0))/util/generally-used-variables.txt" THIS_FILE_NAME=${0##*/} FAIL=1 -LOG=3 +LOG=-3 EXIT_ERR=1 -$WSTATION_UTIL_PATH/check-args-num.sh $# $EXPECTED_ARGS_NUM $WSTATION_LOGGER_PATH $THIS_FILE_NAME || exit $EXIT_ERR +HOST_PATH="/root/.ssh/known_hosts" +ssh-keygen -f $HOST_PATH -R "$($GET_ENV_VARS TARGET_DEVICE_IP)" &>/dev/null +sleep 1 +ssh-keyscan -H "$($GET_ENV_VARS TARGET_DEVICE_IP)" >> $HOST_PATH 2>/dev/null +#TODO: automate authentication from DUT to Helper and from HELPER to DUT -#change permitions before transfering to device -chmod a+x -R $WSTATION_TEST_JOBS_PATH -chmod a+x -R $WSTATION_UTIL_PATH +########## transfer test-jobs ################# #create dir for test-job scripts -createDirOnTargetDevice $TARGET_TEST_JOBS_PATH || exit $EXIT_ERR +createDirOnTargetDevice $TEST_SCRIPTS_PATH || exit $EXIT_ERR #copy test-job scripts to target-device -copyToTargetDevice $WSTATION_TEST_JOBS_PATH $TARGET_BASE_PATH || exit $EXIT_ERR +copyToTargetDevice $WSTATION_TEST_SCRIPTS_PATH $BASE_PATH || exit $EXIT_ERR +######## transfer utils ########## #create dir for utils to use from device -createDirOnTargetDevice $TARGET_UTIL_PATH || exit $EXIT_ERR +createDirOnTargetDevice $DEVICE_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 - +cp environmentVars.txt $WSTATION_UTIL_PATH || ( echo "failed to copy environmentVars.txt" && exit 1 ) || exit 1 #copy util files to target-device -copyToTargetDevice $WSTATION_UTIL_PATH $TARGET_BASE_PATH || exit $EXIT_ERR - +copyToTargetDevice $WSTATION_UTIL_PATH $BASE_PATH || exit $EXIT_ERR +############ transfer content files ################## +#create dir for content files to be used in tests +createDirOnTargetDevice $CONTENT_PATH || (echo "failed to create dir for content files to be used in tests" && exit $EXIT_ERR) || exit $EXIT_ERR +#copy content files to target device +copyToTargetDevice $WSTATION_CONTENT_FILE_PATH $BASE_PATH || exit $EXIT_ERR +exit 0 diff --git a/known_issues.txt b/known_issues.txt new file mode 100755 index 0000000..2935c48 --- /dev/null +++ b/known_issues.txt @@ -0,0 +1,3 @@ +1. test "STA-all-channels-performance-WPA2-TKIP-secure-test.sh" +test occasionally fails to bring up softap in channel ~8 +can't find text "AP-enabled' in log file diff --git a/logger.sh b/logger.sh index 7b5741a..2a96689 100644..100755 --- a/logger.sh +++ b/logger.sh @@ -1,44 +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. - -#receives $1 = name of test, $2 = result of test (0-success, 0< - fail, 0> - log msg). $3 = if verbose status, $4 - verbose err msg +#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 = (-v)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=$3 # -v small verbose msg under (48894 chars), -vb - large msg VERBOSE_ERRMSG=$4 VERBOSE_ERR_LINE_NO=$5 +################ function definition ######################### +deleteLogIfToBig () #deletes if log file largger then 10 Megabyte +{ + LOG_FILE_SIZE=$(ls -al | awk '/'"$VERBOSE_LOG_FILE_NAME"'/ {print $5}') + if [ $LOG_FILE_SIZE -gt 17000000 ]; then + rm $VERBOSE_LOG_FILE_NAME 2>/dev/null + fi +} -#/home/linaro/tiny-apts/log -#tiny-apts/log +#################### script execution ############################ + +VERBOSE_LOG_FILE_NAME=verbose-test-log.txt +touch $VERBOSE_LOG_FILE_NAME +deleteLogIfToBig if [ $TEST_RESULT -eq 0 ]; then TEST_RESULT="PASS" @@ -51,15 +64,28 @@ 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 + echo "date:$(date). file name:$TEST_NAME - "LOG MSG", ERRMSG=$VERBOSE_ERRMSG. errLineNum:$VERBOSE_ERR_LINE_NO" >> $VERBOSE_LOG_FILE_NAME + +elif [ "$VERBOSE" = -vb ]; then + echo "$VERBOSE_ERRMSG" >> $VERBOSE_LOG_FILE_NAME else ADDITIONAL_INFO=$VERBOSE - echo "date:$(date) $TEST_NAME - $TEST_RESULT $ADDITIONAL_INFO" >> test-log.txt + echo "date:$(date) $TEST_NAME - $TEST_RESULT $ADDITIONAL_INFO" >> test-log.txt + fi +#if [ -n "$VERBOSE_ERRMSG" ]; then + + + +#else + +#fi + +#date:Sun Aug 28 16:14:43 IDT 2016 test-executor.sh - LOG MSG -vb + + diff --git a/multimedia/MSG_TO_USER_LED_TEST b/multimedia/MSG_TO_USER_LED_TEST Binary files differnew file mode 100755 index 0000000..bd8b2c0 --- /dev/null +++ b/multimedia/MSG_TO_USER_LED_TEST diff --git a/multimedia/msg_to_user b/multimedia/msg_to_user Binary files differnew file mode 100755 index 0000000..d56422f --- /dev/null +++ b/multimedia/msg_to_user diff --git a/selectTestsWithARGS.txt b/selectTestsWithARGS.txt index e68dd59..704939e 100644..100755 --- a/selectTestsWithARGS.txt +++ b/selectTestsWithARGS.txt @@ -1,16 +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. + + + #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" +#################### BENCHMARK tests ################################### +#benchmark/hackbench.sh:NONE +#benchmark/ebiz.sh:NONE +#benchmark/lmbench.sh:NONE +#benchmark/strng.sh:NONE +#benchmark/sysbench.sh:NONE + +###################### CLOCK tests ######################### +#clock/rtc.sh:NONE +#clock/gettime.sh:NONE + +########################## GPIO tests ###################################################### #testing general purpose IO #gpio/gpio-test.sh:NONE +#test-script arguments -time to turn on the leds- +#gpio/leds-test.sh:2 +#gpio/uart_test.sh:NONE -#storage/sd-card-discover-test.sh:NONE +########################## CPU tests ###################################################### -#storage/usb-discover-test.sh:NONE +#cpu test - checks CPU hotplug feature by turning CPUs off, and turning them on afterwards +#cpu/psci-hotplug-test.sh:NONE +#cpu/lscpu.sh:NONE +#cpu/cpu_freq.sh:NONE + +########################## display tests ###################################################### + +#Runs glxgear opengl toy on full screen and checks FPS. +#Should be given two parameters min and max (in case LCD not connected ) expected FPS +#display/opengl_glxgears_test.sh:<minimum FPS> <maximum FPS> + +#display/glmark.sh:NONE +#display/tuxracer.sh:NONE + +########################## wifi tests ###################################################### #test-script arguments -wifi AP- #wifi/wifi-connect-open-security-test.sh:<enter your wifi AP> @@ -18,58 +75,82 @@ #test-script arguments -wifi AP-, -wifi password- #wifi/wifi-connect-WPA2-PSK-security-test.sh:<enter your wifi AP> <enter your wifi password> +#wifi/wifi-softap-WPA2-PSK-secure-connect-test.sh:NONE +#wifi/wifi-softap-non-secure-connect-test.sh:NONE +#wifi/wifi-softap-get-station-info-test.sh:NONE +#wifi/wifi-softap-disassoc-sta-test.sh:NONE + +#testing wifi performance. +#station-test-scripts/wifi/STA-all-channels-performance-WPA2-TKIP-secure-test.sh:NONE -#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> +#wifi/wifi-softap-all-channels-connect-test.sh:NONE -#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 +####################### audio tests ################################################## +#audio/USB-OGG-Audio-ALSA-Playback-test.sh:NONE +#audio/USB-WAV-Audio-ALSA-Playback-test.sh:NONE +#audio/USB-MP3-Audio-ALSA-Playback-test.sh:NONE +#audio/USB-WAV-Audio-ALSA-Record-test.sh:NONE +#audio/USB-RAW-Audio-ALSA-Record-encoded-to-MP3-test.sh:NONE -#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 +#audio/HDMI-WAV-Audio-ALSA-Playback-test.sh:NONE +#audio/HDMI-MP3-Audio-ALSA-Playback-test.sh:NONE -#-script arguments -criteria to pass- -#storage/copyfiles-usb-flash-test.sh:0 +#audio/Analog-WAV-Audio-ALSA-Playback-test.sh:NONE -#-script arguments -criteria to pass- -#storage/copyfiles-flash-usb-test.sh:0 -#script arguments -criteria to pass- -#storage/copyfiles-flash-sdcard-test.sh:0 +#audio/Analog-WAV-Audio-ALSA-Record-test.sh:NONE -#-script arguments -criteria to pass- -#storage/copyfiles-sdcard-flash-test.sh:0 +#audio/Analog-RAW-Audio-ALSA-Record-encoded-to-AAC-test.sh:NONE + +#audio/encode-wav-to-MP3-playback-USB-audio-test.sh:NONE + +######################## video tests ################################### + +# arg 1 - file to play - variable name from "environmentVars.txt" file representing the video file +# e.g "VIDEO_FILE_720P_24FPS_MOV" +# arg 2 - audio output (e.g HDMI, analog, USB) +#video/Video-play-video-File-test.sh:VIDEO_FILE_720P_24FPS_MOV HDMI +#video/Video-play-video-File-test.sh:VIDEO_FILE_1080P_24FPS_MOV HDMI +#video/Video-play-video-File-test.sh:VIDEO_FILE_1080P_30FPS_MOV HDMI +#video/Video-play-video-File-test.sh:VIDEO_FILE_1080P_60FPS_MP4 HDMI + +#video/Video-play-video-File-test.sh:VIDEO_FILE_1080P_24FPS_MOV analog +#video/Video-play-video-File-test.sh:VIDEO_FILE_1080P_30FPS_MOV analog +#video/Video-play-video-File-test.sh:VIDEO_FILE_1080P_60FPS_MP4 analog + +#video/Video-play-video-File-test.sh:VIDEO_FILE_1080P_30FPS_MOV USB + + +# Plays gst for 14 Hours +#video/Video-1080p-24fps-MOV-Audio-HDMI-stability-test.sh:NONE + +####################### storage tests ####################################### + +#storage/sd-card-discover-test.sh:NONE +#storage/usb-discover-test.sh:NONE -#USB mass storage Iozone script -#storage/usb_mass_storage_iozone_sequential-test.sh:0 0 +#storage/storage_iozone_test.sh:usb sequential +#storage/storage_iozone_test.sh:sdcard sequential +#storage/storage_iozone_test.sh:onboard_flash random +#storage/storage_dd_test.sh:usb +#storage/storage_dd_test.sh:sdcard +#storage/storage_dd_test.sh:onboard_flash -############## tests under development ######################################## +#storage/storage_copyfile_test.sh:onboard_flash usb +#storage/storage_copyfile_test.sh:onboard_flash sdcard +#storage/storage_copyfile_test.sh:onboard_flash onboard_flash +#-script arguments -USB device- +storage/fio-test.sh:/dev/sda1 -#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/station-test-scripts/wifi/STA-all-channels-performance-WPA2-TKIP-secure-test.sh b/station-test-scripts/wifi/STA-all-channels-performance-WPA2-TKIP-secure-test.sh new file mode 100755 index 0000000..49d2ef9 --- /dev/null +++ b/station-test-scripts/wifi/STA-all-channels-performance-WPA2-TKIP-secure-test.sh @@ -0,0 +1,214 @@ +#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 +# connects DUT Wifi STA to working stations wifi dongle in every channel and runs iperf + + +#=====================> function declaration <=========================== +configureHostapd () #$1 - channel number +{ + HOSTAPD_CONF=" +interface=$CURR_WLAN +ctrl_interface=/var/run/hostapd +driver=nl80211 +hw_mode=g +channel=$1 +ssid=$SOFTAP_SSID + +#for high throughput 20Mhz +country_code=JP +#advertises the country_code and the set of allowed channels and transmit power levels based on the regulatory limits +ieee80211d=1 + +ieee80211n=1 +wmm_enabled=1 + +auth_algs=1 +wpa=2 +wpa_key_mgmt=WPA-PSK +wpa_pairwise=TKIP CCMP +wpa_passphrase=$SOFTAP_PASS +rsn_pairwise=CCMP +macaddr_acl=0 +" + + +} + +configureDhcpd () +{ + DHCPD_CONF=" +ddns-update-style none; +ignore client-updates; +authoritative; +option local-wpad code 252 = text; + +subnet +192.168.8.0 netmask 255.255.255.0 { +# --- default gateway +option routers +$SOFTAP_GATEWAY; +# --- Netmask +option subnet-mask +255.255.255.0; +# --- Broadcast Address +option broadcast-address +192.168.8.255; +# --- Domain name servers, tells the clients which DNS servers to use. +option domain-name-servers +$SOFTAP_GATEWAY, 8.8.8.8, 8.8.4.4; +option time-offset +0; +range 192.168.8.3 192.168.8.128; +default-lease-time 1209600; +max-lease-time 1814400; +} +" +} + +cleanup () +{ + echo "===> cleanup - killing wpa_supplicant, hostapd, dhcpd and removing log files <======" + ssh $TARGET_ADDR $DEVICE_UTIL_PATH/kill-process-ids.sh wpa_supplicant + $UTIL_PATH/kill-process-ids.sh hostapd + $UTIL_PATH/kill-process-ids.sh dhcpd + rm $WS_IPERF_LOG &>/dev/null + rm $DUT_IPERF_LOG &>/dev/null + sleep 5 +} + +#=====================> script execution <=========================== +echo "===================> starting STA-all-channels-performance-WPA2-TKIP-secure-test.sh <====================" + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +SOFTAP_SSID="STA-all-channel" +SOFTAP_PASS="12345678" +SOFTAP_GATEWAY="192.168.8.1" + +WS_IPERF_LOG="$CURR_PATH/ws-iperf.log" +DUT_IPERF_LOG="$CURR_PATH/dut-iperf.log" +IPERF_RUNNING_TIME=35 + +cleanup +configureDhcpd + +for CHANNEL in $(seq 1 13) +do +# run in loop for channel 1-13 + + # bring up softap in channel num N + configureHostapd $CHANNEL + + echo "=========== testing hostapd conf file =================" + echo $HOSTAPD_CONF + echo "=========== testing dhcpd conf file =================" + echo $DHCPD_CONF + $UTIL_PATH/bringUp-softap.sh "$HOSTAPD_CONF" "$DHCPD_CONF" \ + || (echo "==> bring-up softap utility failed <== in channel $CHANNEL. so far iperf logs:$ALL_CHANNEL_RES" && exit 1) \ + || exit 1 + + echo "====> connect DUT to sofap <=======" + ssh $TARGET_ADDR $WIFI_TEST_PATH/wifi-connect-WPA2-PSK-security-test.sh $SOFTAP_SSID $SOFTAP_PASS \ + || (echo "DUT failed to connect to wifi in channel $CHANNEL. so far iperf logs:$ALL_CHANNEL_RES" && exit 1) \ + || exit 1 + sleep 5 + + echo "=======> run iperf for $IPERF_RUNNING_TIME seconds DUT-client WS-server <=============" + iperf -s 1> $WS_IPERF_LOG & + sleep 5 + + echo "$( (ssh $TARGET_ADDR iperf -c $SOFTAP_GATEWAY -i 1 -t $IPERF_RUNNING_TIME) 2>&1)" > $DUT_IPERF_LOG + cat $DUT_IPERF_LOG | grep "connect failed" \ + && echo "iperf -c from DUT failed in channel $CHANNEL. so far iperf logs:$ALL_CHANNEL_RES" \ + && exit 1 + + echo "=====> pars iperf results <======" + DUT_IPERF_RES=$(awk 'NR==1; END{print}' $DUT_IPERF_LOG | rev | cut -d" " -f2 | rev | grep -e "---" -v) + + echo "====> DUT_IPERF_RES=$DUT_IPERF_RES in CHANNEL=$CHANNEL <============" + sleep 3 + echo "===> kill iperf server on WS <=====" + $UTIL_PATH/kill-process-ids.sh iperf + sleep 1 + $UTIL_PATH/kill-process-ids.sh iperf + sleep 2 + + echo "=====> run iperf for $IPERF_RUNNING_TIME seconds WS-client DUT-server <================" + echo "$( (ssh $TARGET_ADDR iperf -s) 2>&1)" > $DUT_IPERF_LOG & + sleep 1 + + echo "====> get DUT ip address <======" + DUT_WLAN="$(ssh $TARGET_ADDR ifconfig -a | grep wlan | cut -d" " -f1)" + DUT_IP_ADDR="$(ssh $TARGET_ADDR ifconfig | grep -A 1 $DUT_WLAN | grep "inet addr" | cut -d":" -f2 | cut -d" " -f1)" + iperf -c "$DUT_IP_ADDR" -i 1 -t "$IPERF_RUNNING_TIME" &>"$WS_IPERF_LOG" + cat $WS_IPERF_LOG | grep "connect failed" \ + && echo "iperf -c from WS failed in channel $CHANNEL. so far iperf logs:$ALL_CHANNEL_RES" \ + && exit 1 + + echo "====> parse iperf results <======" + WS_IPERF_RES=$(awk 'NR==1; END{print}' $WS_IPERF_LOG | rev | cut -d" " -f2 | rev | grep -e "---" -v) + + echo "====> WS_IPERF_RES=$WS_IPERF_RES in CHANNEL=$CHANNEL <============" + sleep 3 + echo "=====> kill iperf server on DUT <=======" + ssh $TARGET_ADDR $DEVICE_UTIL_PATH/kill-process-ids.sh iperf + sleep 1 + ssh $TARGET_ADDR $DEVICE_UTIL_PATH/kill-process-ids.sh iperf + + + echo "====> concatenate results for current channel $CHANNEL<=====" + CURR_CHANNEL_RES="channel number $CHANNEL\nDUT client - $DUT_IPERF_RES\nWS client - $WS_IPERF_RES\n" + ALL_CHANNEL_RES="$ALL_CHANNEL_RES$CURR_CHANNEL_RES" + + # cleanup + cleanup + sleep 5 +done + +echo "==========> final result: <==============" +echo -e "$ALL_CHANNEL_RES" +echo "==============> successfully ended STA-all-channels-performance-WPA2-TKIP-secure-test.sh <============================" + + + + + + + + + + + + + + + + diff --git a/test-executor.sh b/test-executor.sh index 380403e..75e35f0 100644..100755 --- a/test-executor.sh +++ b/test-executor.sh @@ -1,29 +1,30 @@ -# 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. +#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 @@ -42,114 +43,166 @@ function print-result 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" + local DELIMITER_NUM="$(echo $1 | awk -F':' '{print NF}')" + if [ $DELIMITER_NUM -eq 1 ]; then + echo "ERROR: in file selectTestsWithARGS.txt, if script has no arguments write \"NONE\" after colon" && exit 1 + fi + echo $1 | cut -d":" -f"2-$DELIMITER_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 $? + echo $1 | cut -d":" -f1 } 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 + FREE_RET_VAL="$( (ssh $TARGET_ADDR free -h) 2>&1)" && ($WSTATION_LOGGER_PATH $THIS_FILE_NAME $LOG -v "FREE_RET_VAL before=$FREE_RET_VAL" $LINENO) || (($WSTATION_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 + SYNC_RET_VAL="$( (ssh $TARGET_ADDR sync) 2>&1)" || (($WSTATION_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 + CLEAN_RET_VAL="$( (ssh $TARGET_ADDR "echo 3 > /proc/sys/vm/drop_caches") 2>&1)" || (($WSTATION_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 + FREE_RET_VAL="$( (ssh $TARGET_ADDR free -h) 2>&1)" && ($WSTATION_LOGGER_PATH $THIS_FILE_NAME $LOG -v "FREE_RET_VAL after=$FREE_RET_VAL" $LINENO) || (($WSTATION_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) + 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 2> /dev/null | grep $TEST_FILE_NAME) if [ -z "$GREP_RET_VAL" ]; then + 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 fi } + +function preExecutionSetup +{ + + echo "=========> is this the first time you are running tiny-apts on current build? (yes/no)? <================" + read FIRST_TIME_RUN + + # special commands that needs DUT to reboot + if [ $FIRST_TIME_RUN = "yes" ] + then + # install needed utilities + ssh $TARGET_ADDR $DEVICE_UTIL_PATH/install-pkg.sh fio >/dev/null || (echo "failed to install required packages in test-executor.sh script" && exit 1) || exit 1 + + ssh $TARGET_ADDR $DEVICE_UTIL_PATH/pre-execution-setup.sh 2>/dev/null + echo "=========> Please unplug power from DUT and plug it back <================" + echo "======= wait for 1 Min, or until the DUT is fully brought up =============" + echo "=================== Press any key to continue ============================" + read -n 1 -s + fi +} + +function IsTestLogConetntToBig +{ + RET_VAL=1 + + # POSIX smallest allowable upper limit on argument length (all systems): 4096 + if [ $(echo "$TEST_LOG_CONTENT" | wc -c) -gt 4096 ]; then + RET_VAL=0 + fi + return $RET_VAL +} + +function logLargeTestContent +{ + COUNT=1 + + while read LINE; do + if [ $COUNT -eq 1 ]; then + $WSTATION_LOGGER_PATH $THIS_FILE_NAME $LOG -v "$LINE" $LINENO + COUNT=$((COUNT+1)) + continue + fi + $WSTATION_LOGGER_PATH $THIS_FILE_NAME $LOG -vb "$LINE" $LINENO + + COUNT=$((COUNT+1)) + done +} + #################### 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)" +# defines general variables used in most tests +source "$(dirname $(readlink -f $0))/util/generally-used-variables.txt" 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 "^$") +# Pre-execution operations +preExecutionSetup #run all test-jobs files on target-device +echo "running tests on target device" +#ignores comments and new lines from selectTestsWithARGS.txt file +LIST_OF_TEST_JOBS=$(grep -v "#" $WSTATION_TEST_ARGS_PATH | grep -v "^$") 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 + $WSTATION_UTIL_PATH/check-ret-val-and-log.sh $? "function cleneTargetDevCacheMem failed" $WSTATION_LOGGER_PATH $THIS_FILE_NAME || exit $EXIT_ERR TEST_JOB_FILE_NAME="$(get-test-job-file-name "$TEST_JOB_LINE")" + TEST_JOB_ARGS="$(get-test-job-args "$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")" + $WSTATION_UTIL_PATH/check-ret-val-and-log.sh $? "TEST DOSN'T EXIST! TEST NAME:$TEST_JOB_FILE_NAME WRITEN IN FILE: $WSTATION_TEST_ARGS_PATH NOT FOUND IN DIR:$WSTATION_TEST_SCRIPTS_PATH. MAKE SURE IT'S NOT A TYPO" $WSTATION_LOGGER_PATH $THIS_FILE_NAME || exit $EXIT_ERR + echo "$TEST_JOB_FILE_NAME args: $TEST_JOB_ARGS" + #nullify test_string_ret_val.txt file (erase unrelated previous tests values) 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)" + + if [ "$(echo $TEST_JOB_FILE_NAME | cut -d"/" -f1)" = "$STATION_TEST_SCRIPTS_DIR" ] + then + #run tests on working station + TEMP_RET_VAL_LOG=ret-val-log.temp + $TEST_JOB_FILE_NAME $TEST_JOB_ARGS &> $TEMP_RET_VAL_LOG RESULT=$? + TEST_LOG_CONTENT="$(cat $TEMP_RET_VAL_LOG)" + rm $TEMP_RET_VAL_LOG &>/dev/null + else + #run tests on target device + if [ "${TEST_JOB_FILE_NAME: -2}" = py ] + then + TEST_LOG_CONTENT="$( (ssh $TARGET_ADDR python $TEST_SCRIPTS_PATH/"$TEST_JOB_FILE_NAME" $TEST_JOB_ARGS ) 2>&1)" + RESULT=$? + else + TEST_LOG_CONTENT="$( (ssh $TARGET_ADDR $TEST_SCRIPTS_PATH/"$TEST_JOB_FILE_NAME" $TEST_JOB_ARGS ) 2>&1)" + RESULT=$? + + fi fi + #read string ret-val of test in file "test_string_ret_val.txt" 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 + $WSTATION_LOGGER_PATH $TEST_JOB_FILE_NAME $RESULT $STRING_RET_VAL + IsTestLogConetntToBig && echo "$TEST_LOG_CONTENT" | logLargeTestContent \ + || $WSTATION_LOGGER_PATH $TEST_JOB_FILE_NAME $LOG -v "$TEST_LOG_CONTENT" $LINENO TEST_COUNTER=$((TEST_COUNTER+1)) (exit $RESULT) && SUCCESSFUL_TEST_COUNTER=$((SUCCESSFUL_TEST_COUNTER+1)) echo "-------------------------------------------------------------------------------------" - $LOGGER_PATH $THIS_FILE_NAME $LOG -v "-------------------------------------------------------------------------------------" $LINENO + $WSTATION_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 +$WSTATION_LOGGER_PATH $SUMMERY $LOG + + diff --git a/test-scripts/audio/Analog-RAW-Audio-ALSA-Record-encoded-to-AAC-test.sh b/test-scripts/audio/Analog-RAW-Audio-ALSA-Record-encoded-to-AAC-test.sh new file mode 100755 index 0000000..7a3ea0f --- /dev/null +++ b/test-scripts/audio/Analog-RAW-Audio-ALSA-Record-encoded-to-AAC-test.sh @@ -0,0 +1,178 @@ +#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 +# this test: +# 1. Records RAW audio via Analog microphone +# 2. Encodes to AAC +# 3. plays audio msg to user on HDMI screen +# 4. Plays recorded AAC using gstreamer on *USB headset and checks for errors or warnings +# * the recording sounds to low on HDMI. on USB headphones sounds louder + +# needs to be connected to the DUT: +# 1 - Analog Mic (#TODO add a connected analog Mic illustration ) +# 2 - USB headset +# 3 - HDMI screen + + +date +echo "=============> Running Test: Analog-RAW-Audio-ALSA-Record-encoded-to-AAC-test.sh <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +ALSA_LOG_FILE="alsa.log" +RECORD_FILE=Analog_audio_record_AAC_test.AAC + +#install missing packeges with opkg +$UTIL_PATH/install-pkg.sh faac || (echo "failed to install required packages" && exit 1) || exit 1 + +# define audio Hardware configuration - parse USB card and device numbers to play in USB headphones (e.g. plughw:1,0) +PLAYBACK_HW_CARD=$(aplay -l | grep "USB Audio" | cut -d":" -f1 | cut -d" " -f2) +PLAYBACK_HW_DEVICE=$(aplay -l | grep "USB Audio" | cut -d":" -f2 | cut -d"," -f2 | cut -d" " -f3) +USB_HEADPHONES_HW_CONFIG=plughw:$PLAYBACK_HW_CARD,$PLAYBACK_HW_DEVICE +# HDMI configuration +HDMI_HW_CONFIG=plughw:0,0 + +echo "===== testing ======> USB_HEADPHONES_HW_CONFIG=$USB_HEADPHONES_HW_CONFIG ========" + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "arecord") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null + +$UTIL_PATH/kill-process-ids.sh pulseaudio +rm $ALSA_LOG_FILE &>/dev/null +rm $RECORD_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 &>/dev/null +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer -c 0 cset name='RDAC2 MUX' 'RX2' &>/dev/null +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' &>/dev/null +amixer -c 0 cset name='HPHR' 'Switch' &>/dev/null +amixer -c 0 cset name='MI2S_RX Channels' 'Two' &>/dev/null +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='HPHL' 1 &>/dev/null +amixer cset iface=MIXER,name='HPHR' 1 &>/dev/null +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 &>/dev/null +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 &>/dev/null +#turn on secondary mic - for analog mic +amixer cset iface=MIXER,name='DEC1 MUX' 'ADC2' &>/dev/null +amixer cset iface=MIXER,name='ADC2 Volume' 90 &>/dev/null +amixer cset iface=MIXER,name='ADC2 MUX' 'INP3' &>/dev/null +sleep 1 + + +# run pulseaudio +X & +sleep 2 +su $USER_NAME -lc $UTIL_PATH/pulseaudio-run-daemon.sh + +# play msg to user in USB headset to start speaking +COMMAND="aplay -l -L && aplay -vv $MSG_TO_USER -D $HDMI_HW_CONFIG" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# executing arecord +COMMAND="arecord -vv -D plughw:0,2 -f cd -d 5 | faac - -o $RECORD_FILE" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# check if the file to play appears in the file system +if [ -e "$RECORD_FILE" ] +then + echo File $RECORD_FILE found on the file system, Ok! +else + echo ERROR: File $RECORD_FILE NOT found on file system + echo + date + exit 1 +fi + +# executing gstreamer - playing in USB headset +COMMAND="gst-launch-1.0 -v filesrc location=$RECORD_FILE ! decodebin ! audioconvert ! audioresample ! alsasink device='$USB_HEADPHONES_HW_CONFIG'" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE +sleep 1 + +echo "====> ALSA_LOG_FILE=$(cat $ALSA_LOG_FILE)" +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + +# garbage cleaning +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "arecord") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +$UTIL_PATH/kill-process-ids.sh pulseaudio +rm $ALSA_LOG_FILE &>/dev/null +rm $RECORD_FILE &>/dev/null +sleep 2 + + +echo +echo "=============> Finished Test: Analog-RAW-Audio-ALSA-Record-encoded-to-AAC-test.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/Analog-WAV-Audio-ALSA-Playback-test.sh b/test-scripts/audio/Analog-WAV-Audio-ALSA-Playback-test.sh new file mode 100755 index 0000000..d180efd --- /dev/null +++ b/test-scripts/audio/Analog-WAV-Audio-ALSA-Playback-test.sh @@ -0,0 +1,134 @@ +#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 +# play WAV audio on analog speakers by using ALSA aplay utility checks for errors or warnings + +# needs to be connected to the DUT: +# Analog speaker (#TODO add a connected analog speaker illustration ) + + +date +echo "=============> Running Test: Analog-WAV-Audio-ALSA-Playback-test <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +ALSA_LOG_FILE="alsa.log" +FILE_TO_PLAY="$CONTENT_PATH/$($GET_ENV_VARS SOUND_FILE_WAV)" +echo file to play - $FILE_TO_PLAY + +#define audio Hardware configuration: +ANALOG_SPEAKER_HW_CONFIG=plughw:0,1 + +echo "==== 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 + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 &>/dev/null +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer -c 0 cset name='RDAC2 MUX' 'RX2' &>/dev/null + +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' &>/dev/null +amixer -c 0 cset name='HPHR' 'Switch' &>/dev/null +amixer -c 0 cset name='MI2S_RX Channels' 'Two' &>/dev/null + +# Before analog playback +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='HPHL' 1 &>/dev/null +amixer cset iface=MIXER,name='HPHR' 1 &>/dev/null +amixer cset iface=MIXER,name='RX1 Digital Volume' 80 &>/dev/null +amixer cset iface=MIXER,name='RX2 Digital Volume' 80 &>/dev/null +sleep 1 + +# executing aplay +COMMAND="aplay -l -L && aplay -vv $FILE_TO_PLAY -D $ANALOG_SPEAKER_HW_CONFIG" +echo "Running Command: $COMMAND" +eval $COMMAND &> $ALSA_LOG_FILE + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + +# garbage cleaning +eval kill -9 $(pidof "aplay") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +sleep 1 + +echo +echo "=============> Finished Test: Analog-WAV-Audio-ALSA-Playback-test <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/Analog-WAV-Audio-ALSA-Record-test.sh b/test-scripts/audio/Analog-WAV-Audio-ALSA-Record-test.sh new file mode 100755 index 0000000..596b5c6 --- /dev/null +++ b/test-scripts/audio/Analog-WAV-Audio-ALSA-Record-test.sh @@ -0,0 +1,158 @@ +#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 +# this test records via analog microphone and plays it using ALSA aplay utility on USB headset + +# needs to be connected to the DUT: +# 1 - Analog Mic (#TODO add a connected analog Mic illustration ) +# 2 - HDMI screen + + +date +echo "=============> Running Test: Analog-WAV-Audio-ALSA-Record-test.sh <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +ALSA_LOG_FILE="alsa.log" +RECORD_FILE=Analog_audio_record_test.wav + +#define audio Hardware configuration: +HDMI_HW_CONFIG=plughw:0,0 + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "arecord") &>/dev/null +$UTIL_PATH/kill-process-ids.sh pulseaudio +rm $ALSA_LOG_FILE &>/dev/null +rm $RECORD_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 &>/dev/null +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer -c 0 cset name='RDAC2 MUX' 'RX2' &>/dev/null + +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' &>/dev/null +amixer -c 0 cset name='HPHR' 'Switch' &>/dev/null +amixer -c 0 cset name='MI2S_RX Channels' 'Two' &>/dev/null +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='HPHL' 1 &>/dev/null +amixer cset iface=MIXER,name='HPHR' 1 &>/dev/null +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 &>/dev/null +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 &>/dev/null +#turn on secondary mic - for analog mic +amixer cset iface=MIXER,name='DEC1 MUX' 'ADC2' &>/dev/null +amixer cset iface=MIXER,name='ADC2 Volume' 90 &>/dev/null +amixer cset iface=MIXER,name='ADC2 MUX' 'INP3' &>/dev/null + + +# run pulseaudio +X & +sleep 2 +su $USER_NAME -lc $UTIL_PATH/pulseaudio-run-daemon.sh + +# paly msg to user in HDMI to start recording +COMMAND="aplay -l -L && aplay -vv $MSG_TO_USER -D $HDMI_HW_CONFIG" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# executing arecord +COMMAND="arecord -D plughw:0,2 -r 48000 -f S16_LE $RECORD_FILE -d 5" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE || (echo "arecord failed" && cat $ALSA_LOG_FILE && exit 1) || exit 1 + +# check if the file to play appears in the file system +if [ -e "$RECORD_FILE" ] +then + echo File $RECORD_FILE found on the file system, Ok! +else + echo ERROR: File $RECORD_FILE NOT found on file system + echo + date + exit 1 +fi + +# executing aplay +COMMAND="aplay -l -L && aplay -vv $RECORD_FILE -D $HDMI_HW_CONFIG" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + +# garbage cleaning +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "arecord") &>/dev/null +$UTIL_PATH/kill-process-ids.sh pulseaudio +rm $ALSA_LOG_FILE &>/dev/null +rm $RECORD_FILE &>/dev/null +sleep 1 + + +echo +echo "=============> Finished Test: Analog-WAV-Audio-ALSA-Record-test.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/HDMI-MP3-Audio-ALSA-Playback-test.sh b/test-scripts/audio/HDMI-MP3-Audio-ALSA-Playback-test.sh new file mode 100755 index 0000000..180b685 --- /dev/null +++ b/test-scripts/audio/HDMI-MP3-Audio-ALSA-Playback-test.sh @@ -0,0 +1,137 @@ +#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 +# This test play MP3 audio on HDMI by using ALSA gst-launch utility. +# connect HDMI screen to DUT + + +date +echo "=============> Running Test: HDMI-MP3-Audio-ALSA-Playback-test.sh <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +FILE_TO_PLAY="$CONTENT_PATH/$($GET_ENV_VARS SOUND_FILE_MP3)" +ALSA_LOG_FILE="alsa.log" + +#define audio Hardware configuration: +HDMI_HW_CONFIG=hw:0,0 + +echo file to play - $FILE_TO_PLAY +# 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 + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +rm $ALSA_LOG_FILE &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 &>/dev/null +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer -c 0 cset name='RDAC2 MUX' 'RX2' &>/dev/null + +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' &>/dev/null +amixer -c 0 cset name='HPHR' 'Switch' &>/dev/null +amixer -c 0 cset name='MI2S_RX Channels' 'Two' &>/dev/null + +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='HPHL' 1 &>/dev/null +amixer cset iface=MIXER,name='HPHR' 1 &>/dev/null +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 &>/dev/null +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 &>/dev/null +sleep 2 + +# activate X - windows system +X &>/dev/null +sleep 2 +export DISPLAY=:0 +sleep 2 + +# executing gstreamer +COMMAND="gst-launch-1.0 -v filesrc location="$FILE_TO_PLAY" ! decodebin ! audioconvert ! audioresample ! alsasink device='$HDMI_HW_CONFIG'" +echo "Running Command: $COMMAND" +eval $COMMAND &> $ALSA_LOG_FILE + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + +# garbage cleaning +rm $ALSA_LOG_FILE &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +sleep 1 + +echo +echo "=============> Finished Test:HDMI-MP3-Audio-ALSA-Playback-test.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/HDMI-WAV-Audio-ALSA-Playback-test.sh b/test-scripts/audio/HDMI-WAV-Audio-ALSA-Playback-test.sh new file mode 100755 index 0000000..4093136 --- /dev/null +++ b/test-scripts/audio/HDMI-WAV-Audio-ALSA-Playback-test.sh @@ -0,0 +1,138 @@ +#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 +# This test plays WAV audio by using ALSA aplay utility, output - HDMI audio +# connect HDMI screen to DUT + + +date +echo "=============> Running Test: HDMI-WAV-Audio-ALSA-Playback-test.sh <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +FILE_TO_PLAY="$CONTENT_PATH/$($GET_ENV_VARS SOUND_FILE_WAV)" +ALSA_LOG_FILE="alsa.log" + +#define audio Hardware configuration: +HDMI_HW_CONFIG=plughw:0,0 + +echo file to play - $FILE_TO_PLAY +# 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 + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 &>/dev/null +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer -c 0 cset name='RDAC2 MUX' 'RX2' &>/dev/null +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' &>/dev/null +amixer -c 0 cset name='HPHR' 'Switch' &>/dev/null +amixer -c 0 cset name='MI2S_RX Channels' 'Two' &>/dev/null +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='HPHL' 1 &>/dev/null +amixer cset iface=MIXER,name='HPHR' 1 &>/dev/null +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 &>/dev/null +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 &>/dev/null + +# activate X - windows system +X &>/dev/null +sleep 2 +export DISPLAY=:0 +sleep 2 + +# executing aplay +COMMAND="aplay -l -L && aplay -vv $FILE_TO_PLAY -D $HDMI_HW_CONFIG" +echo "Running Command: $COMMAND" +eval $COMMAND &> $ALSA_LOG_FILE + +echo "ALSA_LOG_FILE=$(cat $ALSA_LOG_FILE)" + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + +# garbage cleaning +eval kill -9 $(pidof "aplay") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +sleep 1 + + +echo +echo "=============> Finished Test: HDMI-WAV-Audio-ALSA-Playback-test.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/USB-MP3-Audio-ALSA-Playback-test.sh b/test-scripts/audio/USB-MP3-Audio-ALSA-Playback-test.sh new file mode 100755 index 0000000..b24706b --- /dev/null +++ b/test-scripts/audio/USB-MP3-Audio-ALSA-Playback-test.sh @@ -0,0 +1,133 @@ +#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 +# This test play MP3 audio on USB headphones by using gstreamer. +date +echo "=============> Running Test: USB-MP3-Audio-ALSA-Playback-test.sh <===============" +echo + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +FILE_TO_PLAY="$CONTENT_PATH/$($GET_ENV_VARS SOUND_FILE_MP3)" +ALSA_LOG_FILE="alsa.log" + +# define audio Hardware configuration - parse USB card and device numbers to play in USB headphones (e.g. plughw:1,0) +PLAYBACK_HW_CARD=$(aplay -l | grep "USB Audio" | cut -d":" -f1 | cut -d" " -f2) +PLAYBACK_HW_DEVICE=$(aplay -l | grep "USB Audio" | cut -d":" -f2 | cut -d"," -f2 | cut -d" " -f3) +HW_CONFIG=plughw:$PLAYBACK_HW_CARD,$PLAYBACK_HW_DEVICE +echo "======> HW_CONFIG=$HW_CONFIG <=====" + +# 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 + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 &>/dev/null +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer -c 0 cset name='RDAC2 MUX' 'RX2' &>/dev/null + +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' &>/dev/null +amixer -c 0 cset name='HPHR' 'Switch' &>/dev/null +amixer -c 0 cset name='MI2S_RX Channels' 'Two' &>/dev/null + +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='HPHL' 1 &>/dev/null +amixer cset iface=MIXER,name='HPHR' 1 &>/dev/null +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 &>/dev/null +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 &>/dev/null +sleep 2 + +# executing gstreamer +COMMAND="gst-launch-1.0 -v filesrc location="$FILE_TO_PLAY" ! mad ! audioresample ! alsasink device='$HW_CONFIG'" +echo "Running Command: $COMMAND" +eval $COMMAND &> $ALSA_LOG_FILE + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + +# garbage clean +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +sleep 1 + +echo +echo "=============> Finished Test: USB-MP3-Audio-ALSA-Playback-test.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/USB-OGG-Audio-ALSA-Playback-test.sh b/test-scripts/audio/USB-OGG-Audio-ALSA-Playback-test.sh new file mode 100755 index 0000000..4c53a75 --- /dev/null +++ b/test-scripts/audio/USB-OGG-Audio-ALSA-Playback-test.sh @@ -0,0 +1,134 @@ +#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 +# This test play OGG audio on USB headphones by using gstreamer. + +# connect USB headphones to DUT + + +date +echo "=============> Running Test: USB-OGG-Audio-ALSA-Playback-test.sh <===============" + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +FILE_TO_PLAY="$CONTENT_PATH/$($GET_ENV_VARS SOUND_FILE_OGG)" +ALSA_LOG_FILE="alsa.log" + +# define audio Hardware configuration - parse USB card and device numbers to play in USB headphones (e.g. plughw:1,0) +PLAYBACK_HW_CARD=$(aplay -l | grep "USB Audio" | cut -d":" -f1 | cut -d" " -f2) +PLAYBACK_HW_DEVICE=$(aplay -l | grep "USB Audio" | cut -d":" -f2 | cut -d"," -f2 | cut -d" " -f3) +USB_HEADPHONES_HW_CONFIG=plughw:$PLAYBACK_HW_CARD,$PLAYBACK_HW_DEVICE +echo "======> USB_HEADPHONES_HW_CONFIG=$USB_HEADPHONES_HW_CONFIG <=====" + +# 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 + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' +amixer -c 0 cset name='RDAC2 MUX' 'RX2' + +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' +amixer -c 0 cset name='HPHR' 'Switch' +amixer -c 0 cset name='MI2S_RX Channels' 'Two' + +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' +amixer cset iface=MIXER,name='HPHL' 1 +amixer cset iface=MIXER,name='HPHR' 1 +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 + +# executing gstreamer +COMMAND="gst-launch-1.0 filesrc location="$FILE_TO_PLAY" ! decodebin ! audioconvert ! alsasink device='$USB_HEADPHONES_HW_CONFIG'" +echo "Running Command: $COMMAND" +eval $COMMAND &> $ALSA_LOG_FILE + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + +# garbage clean +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +sleep 1 + +echo +echo "=============> Finished Test: USB-OGG-Audio-ALSA-Playback-test.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/USB-RAW-Audio-ALSA-Record-encoded-to-MP3-test.sh b/test-scripts/audio/USB-RAW-Audio-ALSA-Record-encoded-to-MP3-test.sh new file mode 100755 index 0000000..1693123 --- /dev/null +++ b/test-scripts/audio/USB-RAW-Audio-ALSA-Record-encoded-to-MP3-test.sh @@ -0,0 +1,154 @@ +#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 +# this test: +# 1. plays audio msg to user on USB headphones +# 2. Records RAW audio via USB microphone +# 3. Encodes to MP3 with lame +# 4. Plays recorded MP3 using gstreamer on USB headphones and checks for errors or warnings + +# needs to be connected to the DUT: +# 2 - USB headset with microphone and headphones + + +date +echo "=============> Running Test: USB-RAW-Audio-ALSA-Record-encoded-to-MP3-test.sh <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +ALSA_LOG_FILE="alsa.log" +RECORD_FILE=USB_audio_record_MP3_test.wav + +# define audio Hardware configuration - parse USB card and device numbers to play in USB headphones (e.g. plughw:1,0) +PLAYBACK_HW_CARD=$(aplay -l | grep "USB Audio" | cut -d":" -f1 | cut -d" " -f2) +PLAYBACK_HW_DEVICE=$(aplay -l | grep "USB Audio" | cut -d":" -f2 | cut -d"," -f2 | cut -d" " -f3) +USB_HEADPHONES_HW_CONFIG=plughw:$PLAYBACK_HW_CARD,$PLAYBACK_HW_DEVICE +echo "======> USB_HEADPHONES_HW_CONFIG=$USB_HEADPHONES_HW_CONFIG <=====" + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "arecord") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +rm $RECORD_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' +amixer -c 0 cset name='RDAC2 MUX' 'RX2' + +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' +amixer -c 0 cset name='HPHR' 'Switch' +amixer -c 0 cset name='MI2S_RX Channels' 'Two' + +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' +amixer cset iface=MIXER,name='HPHL' 1 +amixer cset iface=MIXER,name='HPHR' 1 +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 + +# paly msg to user in usb headphones to start recording +COMMAND="aplay -l -L && aplay -vv $MSG_TO_USER -D $USB_HEADPHONES_HW_CONFIG" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# executing arecord +COMMAND="arecord -vvv -f cd -t raw -D hw:1,0 -d 5 | lame --verbose --little-endian --signed -r -s 44.1 - $RECORD_FILE" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# check if the file to play appears in the file system +if [ -e "$RECORD_FILE" ] +then + echo File $RECORD_FILE found on the file system, Ok! +else + echo ERROR: File $RECORD_FILE NOT found on file system + echo + date + exit 1 +fi + +# executing gstreamer +COMMAND="gst-launch-1.0 filesrc location=$RECORD_FILE ! mad ! audioconvert ! audioresample ! alsasink device='$USB_HEADPHONES_HW_CONFIG'" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + +# garbage clean +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "arecord") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +rm $RECORD_FILE &>/dev/null +sleep 1 + +echo +echo "=============> Finished Test: USB-RAW-Audio-ALSA-Record-encoded-to-MP3-test.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/USB-WAV-Audio-ALSA-Playback-test.sh b/test-scripts/audio/USB-WAV-Audio-ALSA-Playback-test.sh new file mode 100755 index 0000000..ccbb4ee --- /dev/null +++ b/test-scripts/audio/USB-WAV-Audio-ALSA-Playback-test.sh @@ -0,0 +1,151 @@ +#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 play WAV audio on USB headphones by using ALSA aplay utility. + +# connect USB headset to DUT + + +date +echo "=============> Running Test: USB-WAV-Audio-ALSA-Playback-test.sh <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +FILE_TO_PLAY="$CONTENT_PATH/$($GET_ENV_VARS SOUND_FILE_WAV)" +echo file to play - $FILE_TO_PLAY + +# define audio Hardware configuration - parse USB card and device numbers to play in USB headphones (e.g. plughw:1,0) +PLAYBACK_HW_CARD=$(aplay -l | grep "USB Audio" | cut -d":" -f1 | cut -d" " -f2) +PLAYBACK_HW_DEVICE=$(aplay -l | grep "USB Audio" | cut -d":" -f2 | cut -d"," -f2 | cut -d" " -f3) +HW_CONFIG=plughw:$PLAYBACK_HW_CARD,$PLAYBACK_HW_DEVICE +echo "USB-WAV-Audio-ALSA-Playback-test.sh ======> HW_CONFIG=$HW_CONFIG" + +# 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 + +# check if the argument is supplied +if [ -z "$HW_CONFIG" ] +then + echo + echo Audio HW configuration not supplied. Typically this argument should be plughw:0,0 for internal sound card or plughw:1,0 for external such as USB sound card + echo + date + exit 1 +fi + + +ALSA_LOG_FILE="alsa.log" + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' +amixer -c 0 cset name='RDAC2 MUX' 'RX2' + +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' +amixer -c 0 cset name='HPHR' 'Switch' +amixer -c 0 cset name='MI2S_RX Channels' 'Two' + +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' +amixer cset iface=MIXER,name='HPHL' 1 +amixer cset iface=MIXER,name='HPHR' 1 +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 + +# executing aplay +COMMAND="aplay -l -L && aplay -vv $FILE_TO_PLAY -D $HW_CONFIG" +echo "Running Command: $COMMAND" +eval $COMMAND &> $ALSA_LOG_FILE + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + + +echo +echo "=============> Finished Test: ALSA WAV PLAYBACK <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/USB-WAV-Audio-ALSA-Record-test.sh b/test-scripts/audio/USB-WAV-Audio-ALSA-Record-test.sh new file mode 100755 index 0000000..a77c67a --- /dev/null +++ b/test-scripts/audio/USB-WAV-Audio-ALSA-Record-test.sh @@ -0,0 +1,155 @@ +#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 records via USB microphone and plays it using ALSA aplay utility on USB headset + +# connect USB headset with headphones and microphone to DUT + + +date +echo "=============> Running Test: USB-WAV-Audio-ALSA-Record-test.sh <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +# define audio Hardware configuration - parse USB card and device numbers to play in USB headphones (e.g. plughw:1,0) +PLAYBACK_HW_CARD=$(aplay -l | grep "USB Audio" | cut -d":" -f1 | cut -d" " -f2) +PLAYBACK_HW_DEVICE=$(aplay -l | grep "USB Audio" | cut -d":" -f2 | cut -d"," -f2 | cut -d" " -f3) +#TODO: add a check to see the parsing is successful +HW_CONFIG=plughw:$PLAYBACK_HW_CARD,$PLAYBACK_HW_DEVICE +echo "======> HW_CONFIG=$HW_CONFIG <=====" + +# check if the argument is supplied +if [ -z "$HW_CONFIG" ] +then + echo + echo "Audio HW configuration not supplied. Typically this argument should be plughw:0,0 for internal sound card or plughw:1,0 for external such as USB sound card" + echo + date + exit 1 +fi + + +ALSA_LOG_FILE="alsa.log" + +#record to file from usb for 5 seconds +FILE_TO_PLAY=USB_audio_record_test.wav + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "arecord") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +rm $FILE_TO_PLAY &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' +amixer -c 0 cset name='RDAC2 MUX' 'RX2' + +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' +amixer -c 0 cset name='HPHR' 'Switch' +amixer -c 0 cset name='MI2S_RX Channels' 'Two' + +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' +amixer cset iface=MIXER,name='HPHL' 1 +amixer cset iface=MIXER,name='HPHR' 1 +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 + +# play message to user in usb headphones to start recording +COMMAND="aplay -l -L && aplay -vv $MSG_TO_USER -D $HW_CONFIG" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# executing arecord +COMMAND="arecord -vv -fdat $FILE_TO_PLAY -D hw:1,0 -d 5 -r 44100" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# 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 + +# executing aplay +COMMAND="aplay -l -L && aplay -vv $FILE_TO_PLAY -D $HW_CONFIG" +echo "Running Command: $COMMAND" +eval $COMMAND &>> $ALSA_LOG_FILE + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + + +echo +echo "=============> Finished Test: USB-WAV-Audio-ALSA-Record-test.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/audio/encode-wav-to-MP3-playback-USB-audio-test.sh b/test-scripts/audio/encode-wav-to-MP3-playback-USB-audio-test.sh new file mode 100755 index 0000000..501e14b --- /dev/null +++ b/test-scripts/audio/encode-wav-to-MP3-playback-USB-audio-test.sh @@ -0,0 +1,146 @@ +#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 +# This test converts wav file to mp3 file and plays it in USB headphons by using ALSA gstreamer utility. +## connect USB headphones to device to hear result!! ## + + +date +echo "=============> Running Test: encode-wav-to-MP3-playback-USB-audio-test.sh <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +FILE_TO_PLAY="$CONTENT_PATH/$($GET_ENV_VARS SOUND_FILE_WAV)" +ALSA_LOG_FILE="alsa.log" +MP3_FILE_TO_PLAY="encode_wav_2_mp3_test_mp3_out" +LAME_LOG_FILE="lame.log" + +# do some cleanup (kill and clean any remainders from previous runs) +echo "some cleanup & setup ..." +echo +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +rm $MP3_FILE_TO_PLAY &>/dev/null +rm $LAME_LOG_FILE &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +### convert wav file to mp3 file +lame --verbose $FILE_TO_PLAY $MP3_FILE_TO_PLAY &> $LAME_LOG_FILE +###### check conversion was successful +grep "Writing LAME Tag...done" $LAME_LOG_FILE &>/dev/null || (echo "encoding failed" && exit 1 ) || exit 1 + +FILE_TO_PLAY=$MP3_FILE_TO_PLAY + +# 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 +# define audio Hardware configuration - parse USB card and device numbers to play in USB headphones (e.g. plughw:1,0) +PLAYBACK_HW_CARD=$(aplay -l | grep "USB Audio" | cut -d":" -f1 | cut -d" " -f2) +PLAYBACK_HW_DEVICE=$(aplay -l | grep "USB Audio" | cut -d":" -f2 | cut -d"," -f2 | cut -d" " -f3) +USB_HEADPHONES_HW_CONFIG=plughw:$PLAYBACK_HW_CARD,$PLAYBACK_HW_DEVICE +echo "===== testing ======> USB_HEADPHONES_HW_CONFIG=$USB_HEADPHONES_HW_CONFIG ========" + +#configuring sound card +#routing the Tombak codec +#====================================== +amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 &>/dev/null +amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer -c 0 cset name='RDAC2 MUX' 'RX2' &>/dev/null + +#Turn on both sides of the headphones +#======================================== +amixer -c 0 cset name='HPHL' 'Switch' &>/dev/null +amixer -c 0 cset name='HPHR' 'Switch' &>/dev/null +amixer -c 0 cset name='MI2S_RX Channels' 'Two' &>/dev/null +amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' &>/dev/null +amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' &>/dev/null +amixer cset iface=MIXER,name='HPHL' 1 &>/dev/null +amixer cset iface=MIXER,name='HPHR' 1 &>/dev/null +amixer cset iface=MIXER,name='RX1 Digital Volume' 40 &>/dev/null +amixer cset iface=MIXER,name='RX2 Digital Volume' 40 &>/dev/null +sleep 2 +# executing gstreamer +# if it's not mp3 file, gst pipeline will fail and exit test with fail +COMMAND="gst-launch-1.0 -v filesrc location="$FILE_TO_PLAY" ! mad ! audioresample ! alsasink device='$USB_HEADPHONES_HW_CONFIG'" +echo "Running Command: $COMMAND" +eval $COMMAND &> $ALSA_LOG_FILE + +# test finished, post processing data +# look into the log file and search for any errors +ERROR_COUNT="$(cat $ALSA_LOG_FILE | grep -c "error")" +WARNING_COUNT="$(cat $ALSA_LOG_FILE | grep -c "arning")" +ERROR_COUNT=$(( $WARNING_COUNT + $ERROR_COUNT)) + +echo +echo Number of Errors or Warnings: $ERROR_COUNT +echo +if [ "$ERROR_COUNT" -gt "0" ] +then + RESULT=1 + echo "Errors found!.." + cat $ALSA_LOG_FILE | grep "arning" + cat $ALSA_LOG_FILE | grep "error" + echo + echo " - - F A I L - - " +else + RESULT=0 + echo " + + P A S S + + " +fi + +# garbage cleaning +eval kill -9 $(pidof "aplay") &>/dev/null +eval kill -9 $(pidof "gst-launch-1.0") &>/dev/null +rm $ALSA_LOG_FILE &>/dev/null +rm $MP3_FILE_TO_PLAY &>/dev/null +rm $LAME_LOG_FILE &>/dev/null +sleep 1 + +echo +echo "=============> Finished Test: encode-wav-to-MP3-playback-USB-audio-test.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/test-scripts/benchmark/ebiz.sh b/test-scripts/benchmark/ebiz.sh new file mode 100755 index 0000000..01d2d33 --- /dev/null +++ b/test-scripts/benchmark/ebiz.sh @@ -0,0 +1,52 @@ +#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 +# ebizzy is designed to generate a workload resembling common web application server workloads. It is highly threaded, has a large in-memory working set, and allocates and deallocates memory frequently. + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +PASSORFAIL=2 # need to read begin and end +echo "=============> Running Test Test: EBIZZY <==============" +echo +date +PASSORFAIL=$((PASSORFAIL-1)) +for i in $(seq 1 50) +do + echo "ebizzy iteration number $i " + # ebizzy it's a binary - that's why not apears in editor + $UTIL_PATH/ebizzy -t 2 -S 20 $@ +done +echo "=============> Finished Test: EBIZZY <==============" +echo +date +PASSORFAIL=$((PASSORFAIL-1)) + +exit $PASSORFAIL diff --git a/test-scripts/benchmark/hackbench.sh b/test-scripts/benchmark/hackbench.sh new file mode 100755 index 0000000..0ec36fa --- /dev/null +++ b/test-scripts/benchmark/hackbench.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 +# scheduler benchmark/stress test + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +PASSORFAIL=2 # need to read begin and end +echo "=============> Running Test Test: hackbench <==============" +echo +date + +PASSORFAIL=$((PASSORFAIL-1)) +for i in $(seq 1 1000) +do + echo "hackbench iteration number $i " + $UTIL_PATH/hackbench $@ +done +echo "=============> Finished Test: hackbench <==============" +echo +date +PASSORFAIL=$((PASSORFAIL-1)) + +exit $PASSORFAIL + + + + + diff --git a/test-scripts/benchmark/lmbench.sh b/test-scripts/benchmark/lmbench.sh new file mode 100755 index 0000000..43d1222 --- /dev/null +++ b/test-scripts/benchmark/lmbench.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 +# Suite of simple, portable benchmarks +# Compares different systems performance + + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +PASSORFAIL=2 # need to read begind and end +echo "=============> Running Test Test: lmbench <==============" +echo +date +PASSORFAIL=$((PASSORFAIL-1)) +for i in $(seq 1 1000) +do + echo "lat_ctx iteration number $i " + $UTIL_PATH/lat_ctx -s 64 2 + $UTIL_PATH/lat_ctx -s 64 8 + $UTIL_PATH/lat_ctx -s 64 16 + $UTIL_PATH/lat_ctx -s 64 20 +done +echo "=============> successfully completed Test: lmbench <==============" +echo +date +PASSORFAIL=$((PASSORFAIL-1)) + + +exit $PASSORFAIL diff --git a/test-scripts/benchmark/strng.sh b/test-scripts/benchmark/strng.sh new file mode 100755 index 0000000..2a3890a --- /dev/null +++ b/test-scripts/benchmark/strng.sh @@ -0,0 +1,84 @@ +#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 +# stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces. + + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +PASSORFAIL=0 # default- is success +echo "=============> Running Test Test: strng <==============" +echo +date + +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$UTIL_PATH + + +print_test_result() +{ + local test_case_id=$1 + local exit_code=$2 + if [ $exit_code -eq 0 ]; then + echo "$test_case_id: pass" + else + echo "$test_case_id: fail" + PASSORFAIL=$((PASSORFAIL+1)) + fi +} + +duration=200 +processor_number=$(grep processor /proc/cpuinfo | wc -l) +workloads="cpu io fork switch vm pipe yield hdd cache sock fallocate flock affinity timer dentry urandom sem open sigq poll" +workload_number=$(echo $workloads | wc -w) +sub_duration=$(( $duration / $workload_number )) +echo "CPU(s): $processor_number" +echo "Workloads to run: $workloads" +echo "Total stress_ng test duration: $duration seconds" +echo "Test duration for each workload: $sub_duration seconds" +count=1 +for i in $workloads +do + echo + echo "[$count/$workload_number] Running $i workload..." + if [ $i = "vm" ]; then + # mmap 64M per vm process to avoid OOM, the default is 256M. + $UTIL_PATH/stress-ng --$i $processor_number --vm-bytes 64m --timeout $sub_duration --metrics-brief --verbose + else + $UTIL_PATH/stress-ng --$i $processor_number --timeout $sub_duration --metrics-brief --verbose + fi + print_test_result $UTIL_PATH/stress-ng-$i $? + count=$(( $count + 1 )) +done + +echo "=============> Finished Test: strng <==============" +echo +date +exit $PASSORFAIL diff --git a/test-scripts/benchmark/sysbench.sh b/test-scripts/benchmark/sysbench.sh new file mode 100755 index 0000000..54ee3db --- /dev/null +++ b/test-scripts/benchmark/sysbench.sh @@ -0,0 +1,86 @@ +#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 +# SysBench is a modular, cross-platform and multi-threaded benchmark tool for evaluating OS parameters that are important for a system running a database under intensive load. + + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +TIMES=8 +PASSORFAIL=0 #default is success + + +echo "=============> Running Test Test: sysbench <==============" +echo +date + +export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$UTIL_PATH + +TEST=${2-cpu} +MAX_REQUESTS=${3-50000} +DURATION=${4-20} +FILE_TEST_MODE=${5-seqrewr} + +echo "TIMES IS $TIMES" +for i in $(seq 1 ${TIMES}); +do + t=$((${i} * 2)); + log_file="${TEST}-test-${t}-threads.log"; + opt="--test=${TEST} --max-requests=${MAX_REQUESTS} --num-threads=${t} --max-time=${DURATION}" + [ "${TEST}" = "threadsR" ] && opt="${opt} --thread-locks=$((${t}/2))" + [ "${TEST}" = "fileio" ] && opt="${opt} --file-test-mode=${FILE_TEST_MODE}" + echo "Running sysbench ${opt} run" | tee ${log_file}; + $UTIL_PATH/sysbench ${opt} run | tee -a ${log_file}; + + # parse log file & submit to test result + sed -n -e '/Test execution summary\|General statistics/,/^$/p' ${log_file} | while read line; + do + id=$(echo ${line}|awk -F':' '{print $1}') + val=$(echo ${line}|awk -F':' '{print $2}') + if [ -n "${val}" ]; then + u=$(echo ${val}|sed 's/[0-9\.]*//') + v=$(echo ${val}|sed 's/\([0-9\.]*\)[a-zA-Z]*/\1/') + # let 's' to be the default unit for time measurement + [ -n "$(echo ${id}|grep 'time')" ] && [ -z "${u}" ] && u=s + [ -n "${u}" ] && o="--units ${u} --measurement ${v}" || o="--measurement ${val}" + echo "PASS: ${o}" + else + PASSORFAIL=$((PASSORFAIL+1)) + fi + + done +done + +echo "=============> Finished Test: sysbench <==============" +echo +date + +exit $PASSORFAIL diff --git a/test-scripts/bluetooth/bt-connect-test.sh b/test-scripts/bluetooth/bt-connect-test.sh deleted file mode 100644 index 4fbddde..0000000 --- a/test-scripts/bluetooth/bt-connect-test.sh +++ /dev/null @@ -1,73 +0,0 @@ -# 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 deleted file mode 100644 index f37e2c2..0000000 --- a/test-scripts/bluetooth/bt-connect-to-exist-device-test.sh +++ /dev/null @@ -1,64 +0,0 @@ -# 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 deleted file mode 100644 index 3373fce..0000000 --- a/test-scripts/bluetooth/bt-service-discovery-scan-test.sh +++ /dev/null @@ -1,61 +0,0 @@ -# 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/clock/gettime.sh b/test-scripts/clock/gettime.sh new file mode 100755 index 0000000..ee6a990 --- /dev/null +++ b/test-scripts/clock/gettime.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 +# validate that time is monotonic + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +PASSORFAIL=1 +echo "=============> Running Test Test: gettime <==============" +echo +date +RESULT="$( ($UTIL_PATH/gettimeofday02) 2>&1)" +echo "$RESULT" +echo "$RESULT" >> result.txt +GREPPASS="$( (grep "PASS" result.txt) 2>&1)" +echo "$GREPPASS" >> greppass.txt +if [ ! "$GREPPASS" ]; then + exit $PASSORFAIL +fi +WCPASS="$( (wc greppass.txt | awk '{print $1}' ) 2>&1)" +if [ "$WCPASS" == 1 ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi +rm greppass.txt +rm result.txt +echo "=============> Finished Test: EBIZZY <==============" +echo +date +exit $PASSORFAIL diff --git a/test-scripts/clock/rtc.sh b/test-scripts/clock/rtc.sh new file mode 100755 index 0000000..ccb2de6 --- /dev/null +++ b/test-scripts/clock/rtc.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 +# validate that rtc device is functional + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +PASSORFAIL=1 +echo "=============> Running Test Test: rtc <==============" +echo +date +RESULT="$( ($UTIL_PATH/rtc01) 2>&1)" +echo "$RESULT" +echo "$RESULT" >> result.txt +GREPPASS="$( (grep "Passed" result.txt) 2>&1)" +if [ ! "$GREPPASS" ]; then + exit $PASSORFAIL +fi +echo "$GREPPASS" >> greppass.txt +WCPASS="$( (wc greppass.txt | awk '{print $1}' ) 2>&1)" +if [ "$WCPASS" == 3 ]; then + PASSORFAIL=$((PASSORFAIL-1)) +fi +rm greppass.txt +rm result.txt +echo "=============> Finished Test: rtc <==============" +echo +date +exit $PASSORFAIL diff --git a/test-scripts/cpu/cpu_freq.sh b/test-scripts/cpu/cpu_freq.sh new file mode 100755 index 0000000..767227e --- /dev/null +++ b/test-scripts/cpu/cpu_freq.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 +# check cpu clock frequency transition table + + +PASSORFAIL=1 +echo "=============> Running Test Test: cpu_freq <==============" +echo +date +RESULT="$( (cat /sys/devices/system/cpu/cpufreq/policy0/stats/trans_table) 2>&1)" +echo "$RESULT" +echo "$RESULT" >> result.txt +GREPPASS="$( (grep "From" result.txt) 2>&1)" +if [ ! "$GREPPASS" ]; then + exit $PASSORFAIL +fi +rm result.txt +echo "=============> Running Test Test: cpu_freq <==============" +echo +date +PASSORFAIL=$((PASSORFAIL-1)) +exit $PASSORFAIL diff --git a/test-scripts/cpu/lscpu.sh b/test-scripts/cpu/lscpu.sh new file mode 100755 index 0000000..e794ffe --- /dev/null +++ b/test-scripts/cpu/lscpu.sh @@ -0,0 +1,54 @@ +#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 +# execute lscpu + + +echo "=============> Running Test Test: lscpu <==============" +echo +date + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +PASSORFAIL=1 +export PATH=${PATH}:$UTIL_PATH +RESULT="$( ($UTIL_PATH/lscpu) 2>&1)" +echo "$RESULT" +echo "$RESULT" >> result.txt +GREPPASS="$( (grep "CPU" result.txt) 2>&1)" +if [ ! "$GREPPASS" ]; then + exit $PASSORFAIL +fi +rm result.txt +echo "=============> Finished Test: lscpu <==============" +echo +date +PASSORFAIL=$((PASSORFAIL-1)) +exit $PASSORFAIL diff --git a/test-scripts/cpu/psci-hotplug-test.sh b/test-scripts/cpu/psci-hotplug-test.sh new file mode 100755 index 0000000..fe1e952 --- /dev/null +++ b/test-scripts/cpu/psci-hotplug-test.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 +# This test checks CPU hotplug feature by turning CPUs off, and turning them on afterwards +# This test requires Trustzone image that supports PSCI features + + +date +echo "=============> Running Test: PSCI hotplug test <===============" +echo + +RESULT=0 + +for i in {0..3}; +do + echo 0 > /sys/devices/system/cpu/cpu$i/online + dmesg | grep "psci: CPU$i killed." >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Error shutting down CPU$i" + RESULT=1 + fi + + echo 1 > /sys/devices/system/cpu/cpu$i/online + dmesg | grep "CPU$i: Booted secondary processor" >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Error turning on CPU$i" + RESULT=1 + fi + sleep 1 +done + + +if [ $RESULT -ne "0" ]; +then + echo " - - F A I L - - " +else + echo " + + P A S S + + " +fi + +echo +echo "=============> Finished Test: PSCI hotplug test <=============" +echo + +date +exit $RESULT + + + + + diff --git a/test-scripts/display/glmark.sh b/test-scripts/display/glmark.sh new file mode 100755 index 0000000..d21d8e5 --- /dev/null +++ b/test-scripts/display/glmark.sh @@ -0,0 +1,58 @@ +#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 +# execute glmark2 graphics benchmark + + + +PASSORFAIL=1 +echo "=============> Running Test: glmark FPS <===============" +echo +date +# start the X server +export DISPLAY=:0 +X &> X.log & +sleep 2 +RESULT="$( (timeout 1m glmark2) 2>&1)" +echo "$RESULT" >> result.txt +GREPPASS="$( (grep "FPS" result.txt) 2>&1)" +echo "$GREPPASS" +if [ ! "$GREPPASS" ]; then + exit $PASSORFAIL +fi + +echo "=============> Finished Test: glmark FPS <==============" +echo +date +PASSORFAIL=$((PASSORFAIL-1)) +exit $PASSORFAIL + + + + diff --git a/test-scripts/display/opengl_glxgears_test.sh b/test-scripts/display/opengl_glxgears_test.sh index 8fd632f..e4ddc60 100644..100755 --- a/test-scripts/display/opengl_glxgears_test.sh +++ b/test-scripts/display/opengl_glxgears_test.sh @@ -1,51 +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. +#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 +# This tests runs glxgears tool and measures the FPS perfomance. +# The test expects input FPS argument to assess PASS/FAIL decision. + +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 +MAX_FPS_THRESHOLD=$2 + +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + + +$UTIL_PATH/check-args-num.sh $# 2 || MIN_FPS_THRESHOLD=1 && MAX_FPS_THRESHOLD=1000000 -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 + echo "FPS test limits arguments are not properly given" + date + exit 3 fi GLX_GEARS_LOG_FILENAME="glxgears.log" @@ -83,10 +85,6 @@ 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 @@ -96,9 +94,6 @@ else 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 diff --git a/test-scripts/display/tuxracer.sh b/test-scripts/display/tuxracer.sh new file mode 100755 index 0000000..7ea61ff --- /dev/null +++ b/test-scripts/display/tuxracer.sh @@ -0,0 +1,52 @@ +#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 +# execute tuxracer + + +PASSORFAIL=1 + +echo "=============> Running Test: tuxracer <===============" +echo +date +# start the X server +export DISPLAY=:0 +X &> X.log & +sleep 2 +RESULT="$( (timeout 1m etr) 2>&1)" + +echo "=============> Finished Test: tuxracer <==============" +echo +date +PASSORFAIL=$((PASSORFAIL-1)) +exit $PASSORFAIL + + + + diff --git a/test-scripts/gpio/gpio-test.sh b/test-scripts/gpio/gpio-test.sh index 0e7f7b0..3f5f8a9 100644..100755 --- a/test-scripts/gpio/gpio-test.sh +++ b/test-scripts/gpio/gpio-test.sh @@ -1,56 +1,62 @@ -# 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. +#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. +#testing GPIO by sending and receiving signals in predefined connection points +#IMPORTANT!! before running test connect gpio points as illustrated: +#illustration 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) +# * - a white dot pointing to the the beginning 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 + $UTIL_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 ############################################################### + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + THIS_FILE_NAME=$0 -LOGGER_PATH=tiny-apts/util FAIL=1 GPIO_PATH=/sys/class/gpio diff --git a/test-scripts/gpio/leds-test.sh b/test-scripts/gpio/leds-test.sh new file mode 100755 index 0000000..133da55 --- /dev/null +++ b/test-scripts/gpio/leds-test.sh @@ -0,0 +1,55 @@ +#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 +# tests turns on and of user leds + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +TIME=$1 + +$UTIL_PATH/check-args-num.sh $# 1 || ( echo "wrong number of arguments" && exit 1 ) || exit 1 + +LED_MSG_TO_USER="$CONTENT_PATH/$($GET_ENV_VARS LED_TEST_MSG_TO_USER)" + +echo "==== testing LED_MSG_TO_USER=$LED_MSG_TO_USER ====" + +echo "=============> Running Test Test: leds_on/off <==============" +echo +date +aplay $LED_MSG_TO_USER -D 'plughw:0,0' +$UTIL_PATH/led_on-off.sh $TIME 1 +$UTIL_PATH/led_on-off.sh $TIME 2 +$UTIL_PATH/led_on-off.sh $TIME 3 +$UTIL_PATH/led_on-off.sh $TIME 4 + +echo "=============> Finished Test: leds_on/off <==============" +echo +date diff --git a/test-scripts/gpio/uart_test.sh b/test-scripts/gpio/uart_test.sh new file mode 100755 index 0000000..4380f0d --- /dev/null +++ b/test-scripts/gpio/uart_test.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/sh +# sending from 5 to 13 +# sending from 11 to 7 + +# testing UART 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 # # # # # # # # # # # # # # # # # # # # +# * # # @ @ # @ @ # # # # # # # # # # # # # +# | |=======| | +# |===============| + + + +echo "=============> Running Test: uart_test.sh <==============" +echo +date + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +export OUTPUT="$( (stty -F /dev/ttyMSM0 -g) 2>&1)" +stty -F /dev/ttyMSM1 $OUTPUT + + +$UTIL_PATH/uart.sh 0 1 || (echo "=====> uart.sh failed <====" && exit 1) || exit 1 +$UTIL_PATH/uart.sh 1 0 || (echo "=====> uart.sh failed <====" && exit 1) || exit 1 + +echo "=============> finished Running Test: uart_test.sh <==============" diff --git a/test-scripts/storage/copyfiles-flash-sdcard-test.sh b/test-scripts/storage/copyfiles-flash-sdcard-test.sh deleted file mode 100644 index e0917ad..0000000 --- a/test-scripts/storage/copyfiles-flash-sdcard-test.sh +++ /dev/null @@ -1,41 +0,0 @@ -# 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 deleted file mode 100644 index 30465cd..0000000 --- a/test-scripts/storage/copyfiles-flash-usb-test.sh +++ /dev/null @@ -1,40 +0,0 @@ -# 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 deleted file mode 100644 index 748d2b2..0000000 --- a/test-scripts/storage/copyfiles-sdcard-flash-test.sh +++ /dev/null @@ -1,41 +0,0 @@ -# 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 deleted file mode 100644 index 3f6bfe9..0000000 --- a/test-scripts/storage/copyfiles-usb-flash-test.sh +++ /dev/null @@ -1,40 +0,0 @@ -# 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/fio-test.sh b/test-scripts/storage/fio-test.sh new file mode 100755 index 0000000..c36ba7a --- /dev/null +++ b/test-scripts/storage/fio-test.sh @@ -0,0 +1,58 @@ +#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 USB mass storage INSIDE!!! +# runs fio-test.py from util directory +# receives as argument - USB mass storage device name +# run with USB mass storage device connected to DUT + +echo "==================> starting fio-test.sh <=========================" + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +USB_DEVICE=$1 + +#making sure fio package is installed on the DUT +$UTIL_PATH/install-pkg.sh fio >/dev/null \ +|| (echo "===> fio package not installed on DUT <=====" && exit 1) || exit 1 + +echo "============> running fio-test.py <==============" + +RESULT="$(($UTIL_PATH/fio-test.py $USB_DEVICE) 2>&1)" + +echo "=============> analyzing results <================" + +echo $RESULT | grep "fio_512k_read_bandwidth: PASS" &>/dev/null \ +|| (echo "======> fio-test.sh failed <======" && exit 1) || exit 1 + + +echo "==================> successfully finished fio-test.sh <=========================" + + diff --git a/test-scripts/storage/flash-access-iozone-test.sh b/test-scripts/storage/flash-access-iozone-test.sh deleted file mode 100644 index 898a63d..0000000 --- a/test-scripts/storage/flash-access-iozone-test.sh +++ /dev/null @@ -1,64 +0,0 @@ -# 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 deleted file mode 100644 index 435b19d..0000000 --- a/test-scripts/storage/random-access-flash-iozone-test.sh +++ /dev/null @@ -1,70 +0,0 @@ -# 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 index abbb86f..bc31b9c 100644..100755 --- a/test-scripts/storage/sd-card-discover-test.sh +++ b/test-scripts/storage/sd-card-discover-test.sh @@ -1,37 +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. +#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 + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt 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 +$UTIL_PATH/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 deleted file mode 100644 index 6bbc3de..0000000 --- a/test-scripts/storage/sdcard-access-iozone-test.sh +++ /dev/null @@ -1,70 +0,0 @@ -# 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/storage_copyfile_test.sh b/test-scripts/storage/storage_copyfile_test.sh new file mode 100755 index 0000000..c1b1273 --- /dev/null +++ b/test-scripts/storage/storage_copyfile_test.sh @@ -0,0 +1,299 @@ +#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 + +# +# this test copies the file from folder1 to folder2 and then from folder2 to folder1 +# and checks for file validity and desired copy speeds (KPIs) +# + + +echo +echo "=====> Running Test (copy file) <======" +echo +date + +MODE1=$1 +MODE2=$2 +FILE_SIZE_IN_MB=$3 +COPY1_KPI=$4 +COPY2_KPI=$5 +RESULT=0 + +echo mode1 is $MODE1 +echo mode2 is $MODE2 +echo file size is $FILE_SIZE_IN_MB +echo copy rate 1 pass threshold is $COPY1_KPI MBps +echo copy rate 2 pass threshold is $COPY2_KPI MBps + + +if [ -z "$MODE1" ] +then + echo ERROR: folder1 is not specified. It should be one of the following: usb, sdcard or onboard_flash + date + exit 7 +fi + +if [ -z "$MODE2" ] +then + echo ERROR: folder2 is not specified. It should be one of the following: usb, sdcard or onboard_flash + date + exit 7 +fi + +if [ -z "$FILE_SIZE_IN_MB" ] +then + echo File size in MB, not supplied. Defaulting to 1024MB + FILE_SIZE_IN_MB=1024 +fi + +if [ -z "$COPY1_KPI" ] +then + echo Copy1 KPI not given, defaulting to 0 + COPY1_KPI=0 +fi + +if [ -z "$COPY2_KPI" ] +then + echo Copy2 KPI not given, defaulting to 0 + COPY2_KPI=0 +fi + +FOLDER1='/home/linaro/folder1' +FOLDER2='/home/linaro/folder2' +FILENAME_SRC=test.bin +FILENAME_DEST=test.2.bin +FILENAME_ROUNDTRIP=test.3.bin + + +# do some ome cleanup of potenitally previously failed run +echo pre-test cleaning... +umount $FOLDER1 &> /dev/null +rm -rf $FOLDER1 &> /dev/null +umount $FOLDER2 &> /dev/null +rm -rf $FOLDER2 &> /dev/null +sleep 1 +mkdir $FOLDER1 +mkdir $FOLDER2 +echo cleaning done... +echo + +# +# gets mode argument and decides if need to mount according to this mode +# +mount_if_needed () { + MODE=$1 + FOLDER_TO_MOUNT=$2 + echo mount_if_needed $MODE, $FOLDER_TO_MOUNT called... + + unset $DEVICE_NAME + + if [ "$MODE" == "usb" ] + then + + echo "mode: usb" + echo + + DEVICE_NAME=$(lsblk | grep -o -E 'sd[a,z][1-9]') + echo USB device name is $DEVICE_NAME + + elif [ "$MODE" == "sdcard" ] + then + + echo "mode: sdcard" + echo + + DEVICE_NAME=$(lsblk | grep -o -E 'mmcblk1p[0-9]') + echo SDCARD device name is $DEVICE_NAME + + elif [ "$MODE" == "onboard_flash" ] + then + + echo "mode: onboard_flash" + echo + + else + echo + echo "ERROR: wrong mode argument given - $MODE. It should be one of the following: usb, sdcard or onboard_flash" + echo + date + exit 4 + fi + + if [ ! "$MODE" == "onboard_flash" ] + then + + echo "DEVICE_NAME is $DEVICE_NAME" + + if [ -z "$DEVICE_NAME" ] + then + echo + echo "ERROR: Mountable storage device not found. Please plugin $MODE storage properly" + echo + date + exit 2 + fi + + # mount + mount -o rw /dev/$DEVICE_NAME $FOLDER_TO_MOUNT + echo device mounted to $FOLDER_TO_MOUNT + mount | grep $FOLDER_TO_MOUNT + + fi +} + +echo "-------------- preparing FOLDER1 -------------------" +mount_if_needed $MODE1 $FOLDER1 +echo "---------------------- done ------------------------" +echo +echo "-------------- preparing FOLDER2 -------------------" +mount_if_needed $MODE2 $FOLDER2 +echo "---------------------- done ------------------------" +echo + +echo FOLDER1 is $FOLDER1 +echo FOLDER2 is $FOLDER2 + +# create the temp file $FOLDER1/$FILENAME_SRC +echo +echo creating the temp $FOLDER1/$FILENAME_SRC +dd if=/dev/urandom of=$FOLDER1/$FILENAME_SRC bs=1M count=$FILE_SIZE_IN_MB conv=fsync +sync + +echo +echo clearning cache... +echo 3 > /proc/sys/vm/drop_caches +echo +sync + +copy_file () { + SRC=$1 + DEST=$2 + LOGFILE=$3 + + echo + COMMAND_COPY="cp $SRC $DEST" + echo COMMAND_COPY is $COMMAND_COPY + + echo + echo clearning cache... + echo 3 > /proc/sys/vm/drop_caches + echo + sync + + echo + echo performing copy from $SRC to $DEST + echo "$COMMAND_COPY" > to_exec.sh + echo "sync" >> to_exec.sh + chmod 777 to_exec.sh + ( time ./to_exec.sh ) &> $LOGFILE + echo copy done + echo "======= cat to_exec.sh ========" + cat to_exec.sh + echo "======= cat LOGFILE ========" + cat $LOGFILE + + echo checking files... + if cmp -s $SRC $DEST ; then + echo files are identical - ok + else + echo ERROR: files are NOT identical! + RESULT=10 + fi + +} + +copy_file $FOLDER1/$FILENAME_SRC $FOLDER2/$FILENAME_DEST copy1.log + +FILE_SIZE=$( (ls -l $FOLDER1/$FILENAME_SRC | awk '{ print $5 }' ) ) +rm $FOLDER1/$FILENAME_SRC + +copy_file $FOLDER2/$FILENAME_DEST $FOLDER1/$FILENAME_ROUNDTRIP copy2.log + +rm $FOLDER2/$FILENAME_DEST +rm $FOLDER1/$FILENAME_ROUNDTRIP + +# post processing the results +echo +echo analyzing data... +echo + +echo file size is $FILE_SIZE bytes + +TIME_COPY1=$( (cat copy1.log | grep real | awk -F'[/ms\t]' '{print $2 * 60 + $3 }' ) ) +echo time took to copy file from $MODE1 to $MODE2: $TIME_COPY1 seconds +TIME_COPY2=$( (cat copy2.log | grep real | awk -F'[/ms\t]' '{print $2 * 60 + $3 }' ) ) +echo time took to copy file from $MODE2 to $MODE1: $TIME_COPY2 seconds + +COPY_1_SPEED=$( (echo $FILE_SIZE $TIME_COPY1 | awk '{ print $1 / $2 / 1024 / 1024 }' ) ) +COPY_1_SPEED_INT=$( (awk "BEGIN {printf \"%d\n\",$COPY_1_SPEED}") ) +echo Copy from $MODE1 to $MODE2 data rate: $COPY_1_SPEED MBps + +COPY_2_SPEED=$( (echo $FILE_SIZE $TIME_COPY2 | awk '{ print $1 / $2 / 1024 / 1024 }' ) ) +COPY_2_SPEED_INT=$( (awk "BEGIN {printf \"%d\n\",$COPY_2_SPEED}") ) +echo Copy from $MODE2 to $MODE1 data rate: $COPY_2_SPEED MBps + +echo "Copy from $MODE1 to $MODE2 data rate: $COPY_1_SPEED MBps, Copy from $MODE2 to $MODE1 data rate: $COPY_2_SPEED MBps" > test_string_ret_val.txt + +if [ "$RESULT" -eq "0" ] ; then + if [ "$COPY_1_SPEED_INT" -lt "$COPY1_KPI" ]; then + RESULT=1 + elif [ "$COPY_2_SPEED_INT" -lt "$COPY2_KPI" ]; then + RESULT=2 + else + RESULT=0 + fi +fi + + +# do some cleanup after test +echo +echo cleaning after test... +umount $FOLDER1 &> /dev/null +rm -rf $FOLDER1 &> /dev/null +umount $FOLDER2 &> /dev/null +rm -rf $FOLDER2 &> /dev/null +sleep 1 +mkdir $FOLDER1 +mkdir $FOLDER2 +echo cleaning done... +echo + +echo +if [ "$RESULT" -eq "0" ] +then + echo " + + P A S S + + " +else + echo " - - F A I L - - " +fi +echo +echo "=====> Finished Test (copy file) <=====" +echo +date +exit $RESULT + diff --git a/test-scripts/storage/storage_dd_test.sh b/test-scripts/storage/storage_dd_test.sh new file mode 100755 index 0000000..690a2b9 --- /dev/null +++ b/test-scripts/storage/storage_dd_test.sh @@ -0,0 +1,231 @@ +#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 +# script tests resd/write data rate capabilities of peripheral devices (USB flash memory, internal flash memeory, SD card) + + +echo +echo "=====> Running Test (DD read and write test) <======" +echo +date + +MODE=$1 +FILE_SIZE_IN_MB=$2 +READ_KPI=$3 +WRITE_KPI=$4 + +PASSORFAIL=2 +echo mode is $MODE +echo file size in MB is $FILE_SIZE_IN_MB +echo read pass threshold is $READ_KPI MBps +echo write pass threshold is $WRITE_KPI MBps + +if [ -z "$MODE" ] +then + echo ERROR: Mode argument is not specified. It should be one of the following: usb, sdcard or onboard_flash + date + exit 5 +fi + +if [ -z "$FILE_SIZE_IN_MB" ] +then + echo File size in MB, not supplied. Defaulting to 1024MB + FILE_SIZE_IN_MB=1024 +fi + +if [ -z "$READ_KPI" ] +then + echo Read KPI not given, defaulting to 0 + READ_KPI=0 +fi + +if [ -z "$WRITE_KPI" ] +then + echo Write KPI not given, defaulting to 0 + WRITE_KPI=0 +fi + +READ_WRITE_FOLDER='/home/linaro/read_write_folder' +FILENAME=test.bin + +# do some ome cleanup of potenitally previously failed run +echo pre-test cleaning... +umount $READ_WRITE_FOLDER &> /dev/null +rm -rf $READ_WRITE_FOLDER &> /dev/null +sleep 1 +mkdir $READ_WRITE_FOLDER +echo cleaning done... +echo +echo running test now... + +if [ "$MODE" == "usb" ] +then + + echo "mode: usb" + echo + + DEVICE_NAME=$(lsblk | grep -o -E 'sd[a,z][1-9]') + echo USB device name is $DEVICE_NAME + +elif [ "$MODE" == "sdcard" ] +then + + echo "mode: sdcard" + echo + + DEVICE_NAME=$(lsblk | grep -o -E 'mmcblk1p[0-9]') + echo SDCARD device name is $DEVICE_NAME + +elif [ "$MODE" == "onboard_flash" ] +then + + echo "mode: onboard_flash" + echo + +else + echo + echo "ERROR: wrong mode argument given - $MODE. It should be one of the following: usb, sdcard or onboard_flash" + echo + date + exit 4 +fi + +if [ ! "$MODE" == "onboard_flash" ] +then + + echo "DEVICE_NAME is $DEVICE_NAME" + + if [ -z "$DEVICE_NAME" ] + then + echo + echo "ERROR: Mountable storage device not found. Please plugin $MODE storage properly" + echo + date + exit 2 + fi + + # mount + # mount -t vfat -o rw /dev/$DEVICE_NAME $READ_WRITE_FOLDER +mount -o rw /dev/$DEVICE_NAME $READ_WRITE_FOLDER + echo USB drive mounted to $READ_WRITE_FOLDER + +fi + +echo +echo clearning cache +echo 3 > /proc/sys/vm/drop_caches +sync + +COMMAND_WRITE="dd if=/dev/urandom of=$READ_WRITE_FOLDER/$FILENAME bs=1M count=$FILE_SIZE_IN_MB conv=fsync" + +echo +echo COMMAND_WRITE is $COMMAND_WRITE + +echo +echo performing write test +echo "$COMMAND_WRITE" > to_exec.sh +echo "sync" >> to_exec.sh +chmod 777 to_exec.sh +( time ./to_exec.sh ) &> write_time.log +echo write test done + +echo +echo clearning cache +echo 3 > /proc/sys/vm/drop_caches +sync + +COMMAND_READ="dd if=$READ_WRITE_FOLDER/$FILENAME of=/dev/null bs=1M" +echo COMAND_READ is $COMMAND_READ + +echo +echo performing read test +echo "$COMMAND_READ" > to_exec.sh +echo "sync" >> to_exec.sh +chmod 777 to_exec.sh +( time ./to_exec.sh ) &> read_time.log +echo read test done + + +# post processing the results +echo +echo analyzing data... +FILE_SIZE=$( (ls -l $READ_WRITE_FOLDER/$FILENAME | awk '{ print $5 }' ) ) +echo file size is $FILE_SIZE bytes + +TIME_WRITE=$( (cat write_time.log | grep real | awk -F'[/ms\t]' '{print $2 * 60 + $3 }' ) ) +echo time took to write file: $TIME_WRITE seconds + +TIME_READ=$( (cat read_time.log | grep real | awk -F'[/ms\t]' '{print $2 * 60 + $3 }' ) ) +echo time took to read file: $TIME_READ seconds + +WRITE_SPEED=$( (echo $FILE_SIZE $TIME_WRITE | awk '{ print $1 / $2 / 1024 / 1024 }' ) ) +WRITE_SPEED_INT=$( (awk "BEGIN {printf \"%d\n\",$WRITE_SPEED}") ) +echo Write date rate: $WRITE_SPEED MBps + +READ_SPEED=$( (echo $FILE_SIZE $TIME_READ | awk '{ print $1 / $2 / 1024 / 1024 }' ) ) +READ_SPEED_INT=$( (awk "BEGIN {printf \"%d\n\",$READ_SPEED}") ) +echo Read data rate: $READ_SPEED MBps + +echo "read data rate: $READ_SPEED MBps, write data rate: $WRITE_SPEED MBps" > test_string_ret_val.txt + +if [ "$WRITE_SPEED_INT" -lt "$WRITE_KPI" ] +then + echo "ERROR: Low write date rate, actual: $WRITE_SPEED MBps, required: $WRITE_KPI MBps" + RESULT=2 +fi + +RESULT=0 +if [ "$READ_SPEED_INT" -lt "$READ_KPI" ] +then + echo "ERROR: Low read date rate, actual: $READ_SPEED MBps, required: $READ_KPI MBps" + RESULT=1 +fi + +# do some cleanup after test +echo +echo cleaning after test... +umount $READ_WRITE_FOLDER &> /dev/null +rm -rf $READ_WRITE_FOLDER &> /dev/null +sleep 1 +mkdir $READ_WRITE_FOLDER +echo cleaning done... + +echo +if [ "$RESULT" -eq "0" ] +then + echo " + + P A S S + + " +else + echo " - - F A I L - - " +fi +echo +echo "=====> Finished Test (DD read and write test) <=====" +echo +date +exit $RESULT + diff --git a/test-scripts/storage/storage_iozone_test.sh b/test-scripts/storage/storage_iozone_test.sh new file mode 100755 index 0000000..a28360c --- /dev/null +++ b/test-scripts/storage/storage_iozone_test.sh @@ -0,0 +1,222 @@ +#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 +# runs iozone - IOzone is a filesystem benchmark tool. The benchmark generates and measures a variety of file operations. + + + +echo +echo "=====> Running Test (iozone) <======" +echo +date + +MODE=$1 +RANDOM_OR_SEQUENTIAL=$2 +READ_KPI=$3 +WRITE_KPI=$4 + +echo mode is $MODE +echo random or sequential is $RANDOM_OR_SEQUENTIAL +echo read pass threshold is $READ_KPI MBps +echo write pass threshold is $WRITE_KPI MBps + + +if [ -z "$MODE" ] +then + echo ERROR: Mode argument is not specified. It should be one of the following: usb, sdcard or onboard_flash + date + exit 7 +fi + +if [ -z "$RANDOM_OR_SEQUENTIAL" ] +then + echo ERROR: Random-or-Sequential parameter not supplied. Should be random or sequential + date + exit 6 +fi +if [ "$RANDOM_OR_SEQUENTIAL" != "random" ] +then + if [ "$RANDOM_OR_SEQUENTIAL" != "sequential" ] + then + echo ERROR: Random-or-Sequential parameter has wrong value. Should be random or sequential + date + exit 5 + fi +fi + +if [ -z "$READ_KPI" ] +then + echo Read KPI not given, defaulting to 0 + READ_KPI=0 +fi + +if [ -z "$WRITE_KPI" ] +then + echo Write KPI not given, defaulting to 0 + WRITE_KPI=0 +fi + + +READ_WRITE_FOLDER='/home/linaro/read_write_folder' +FILENAME=test.bin + +# do some ome cleanup of potenitally previously failed run +echo pre-test cleaning... +umount $READ_WRITE_FOLDER &> /dev/null +rm -rf $READ_WRITE_FOLDER &> /dev/null +sleep 1 +mkdir $READ_WRITE_FOLDER +echo cleaning done... +echo +echo running test now... + +if [ "$MODE" == "usb" ] +then + + echo "mode: usb" + echo + + DEVICE_NAME=$(lsblk | grep -o -E 'sd[a,z][1-9]') + echo USB device name is $DEVICE_NAME + +elif [ "$MODE" == "sdcard" ] +then + + echo "mode: sdcard" + echo + + DEVICE_NAME=$(lsblk | grep -o -E 'mmcblk1p[0-9]') + echo SDCARD device name is $DEVICE_NAME + +elif [ "$MODE" == "onboard_flash" ] +then + + echo "mode: onboard_flash" + echo + +else + echo + echo "ERROR: wrong mode argument given - $MODE. It should be one of the following: usb, sdcard or onboard_flash" + echo + date + exit 4 +fi + +if [ ! "$MODE" == "onboard_flash" ] +then + + echo "DEVICE_NAME is $DEVICE_NAME" + + if [ -z "$DEVICE_NAME" ] + then + echo + echo "ERROR: Mountable storage device not found. Please plugin $MODE storage properly" + echo + date + exit 2 + fi + + # mount + mount -o rw /dev/$DEVICE_NAME $READ_WRITE_FOLDER + echo USB drive mounted to $READ_WRITE_FOLDER + mount | grep read_write + +fi + +echo READ_WRITE_FOLDER is $READ_WRITE_FOLDER + +COMMAND_TO_EXECUTE="" +if [ "$RANDOM_OR_SEQUENTIAL" == "random" ]; then + COMMAND_TO_EXECUTE="iozone -azecI -+n -L64 -S32 -y4k -q1024k -n64m -g64m -i0 -i2 -o -b result.xls -f $READ_WRITE_FOLDER/$FILENAME > result.txt" +elif [ "$RANDOM_OR_SEQUENTIAL" == "sequential" ]; then + COMMAND_TO_EXECUTE="iozone -azecI -+n -L64 -S32 -y512k -q512k -n1m -g1000m -i0 -i1 -o -b result.xls -f $READ_WRITE_FOLDER/$FILENAME > result.txt" +fi + + +echo +echo clearning cache... +echo 3 > /proc/sys/vm/drop_caches +echo +sync + +echo COMMAND_TO_EXECUTE is $COMMAND_TO_EXECUTE +eval $COMMAND_TO_EXECUTE + + +# post processing the results +echo +echo analyzing data... +echo +if [ "$RANDOM_OR_SEQUENTIAL" == "random" ]; then + # look only on the smallest e.g. 4K size records + READ_RES="$( (grep "65536 4" result.txt | awk '{print $5}') )" + WRITE_RES="$( (grep "65536 4" result.txt | awk '{print $6}') )" +elif [ "$RANDOM_OR_SEQUENTIAL" == "sequential" ]; then + # look on the largest records + READ_RES="$( (grep "524288" result.txt | grep '"524288" 0' -B 1 | sed -n '3p' | awk '{print $2}') 2>&1)" + WRITE_RES="$( (grep "524288" result.txt | grep '"524288" 0' -B 1 | sed -n '1p' | awk '{print $2}') 2>&1)" +fi + +echo "The read criteria to pass is $READ_KPI KBps and the result is $READ_RES KBps" +echo "The write criteria to pass is $WRITE_KPI KBps and the result is $WRITE_RES KBps" + + +if [ "$WRITE_RES" -lt $WRITE_KPI ]; then + RESULT=1 +elif [ "$READ_RES" -lt $READ_KPI ]; then + RESULT=2 +else + RESULT=0 +fi + +#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 + +# do some cleanup after test +echo +echo cleaning after test... +umount $READ_WRITE_FOLDER &> /dev/null +rm -rf $READ_WRITE_FOLDER &> /dev/null +sleep 1 +mkdir $READ_WRITE_FOLDER +echo cleaning done... + +echo +if [ "$RESULT" -eq "0" ] +then + echo " + + P A S S + + " +else + echo " - - F A I L - - " +fi +echo +echo "=====> Finished Test (iozone) <=====" +echo +date +exit $RESULT + diff --git a/test-scripts/storage/usb-discover-test.sh b/test-scripts/storage/usb-discover-test.sh index ab87816..6b416ed 100644..100755 --- a/test-scripts/storage/usb-discover-test.sh +++ b/test-scripts/storage/usb-discover-test.sh @@ -1,37 +1,62 @@ -# 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. +#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 + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + 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 + + + +cat /sys/block/sd*/removable | grep 1 || ( echo "=====> no mass storage device connected <=========" && exit 1) || exit 1 + +readlink /sys/block/sd* | grep usb || ( echo "=====> no mass storage device connected <=========" && exit 1) || exit 1 + + + + + + + + + + + + + + + diff --git a/test-scripts/storage/usb_mass_storage_iozone_sequential-test.sh b/test-scripts/storage/usb_mass_storage_iozone_sequential-test.sh deleted file mode 100644 index 76e0ee8..0000000 --- a/test-scripts/storage/usb_mass_storage_iozone_sequential-test.sh +++ /dev/null @@ -1,112 +0,0 @@ -# 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/Video-1080p-24fps-MOV-Audio-HDMI-stability-test.sh b/test-scripts/video/Video-1080p-24fps-MOV-Audio-HDMI-stability-test.sh new file mode 100755 index 0000000..2fa9f0d --- /dev/null +++ b/test-scripts/video/Video-1080p-24fps-MOV-Audio-HDMI-stability-test.sh @@ -0,0 +1,83 @@ +#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 +# plays gst for 14 hours +# Please connect HDMI to DUT + + +date +echo "=============> Running Test: Video-1080p-24fps-MOV-Audio-HDMI-stability-test.sh <===============" +echo + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +FILE_TO_PLAY="$CONTENT_PATH/$($GET_ENV_VARS VIDEO_FILE_1080P_24FPS_MOV)" + +GST_PIPELINE="! qtdemux name=demuxer demuxer. ! queue ! avdec_aac ! audioconvert ! audioresample ! alsasink device='hw:0,0' demuxer. ! queue ! h264parse ! avdec_h264 ! glimagesink" + +# 94 iterations of 9 MIN is 14.1 Hours +NUM_ITER=94 +COUNTER=0 + +START_TIME=$(date +%s) + +#run the whole video +while [ $COUNTER -lt $NUM_ITER ] +do + echo "COUNTER=$COUNTER" + echo "NUM_ITER=$NUM_ITER" + + # it plays for 540 seconds = 9 MIN. approximately the length of the movie file. + $UTIL_PATH/play-gstreamer-and-check.sh $FILE_TO_PLAY "$GST_PIPELINE" 540 || (echo "utility failed! - play-gstreamer-and-check.sh" && exit 1) || exit 1 + + sleep 2 + + COUNTER=$((COUNTER+1)) +done + +END_TIME=$(date +%s) +RUN_TIME=$(($END_TIME-$START_TIME)) +EXIT_VAL=0 + +#14 hours in seconds is : 50400. suppose to be more than 14 hours +if [ $RUN_TIME -lt 50400 ]; then + echo "test run less then 14 hours" + EXIT_VAL=1 +fi + +echo "=============> RUN_TIME=$RUN_TIME >======================" + + +echo "=============> test finished: Video-1080p-24fps-MOV-Audio-HDMI-stability-test.sh <===============" +echo + +exit $EXIT_VAL + + diff --git a/test-scripts/video/Video-play-video-File-test.sh b/test-scripts/video/Video-play-video-File-test.sh new file mode 100755 index 0000000..2f50cc6 --- /dev/null +++ b/test-scripts/video/Video-play-video-File-test.sh @@ -0,0 +1,115 @@ +#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 args: +# arg 1 - file to play - variable name from "environmentVars.txt" file representing the video file +# e.g "VIDEO_FILE_720P_24FPS_MOV" +# arg 2 - audio output (e.g HDMI, analog, USB) + + + +############################# functions definition ############################################### +analog_mic_conf () +{ + #configuring sound card + #routing the Tombak codec + #====================================== + amixer -c 0 cset name='PRI_MI2S_RX Audio Mixer MultiMedia1' 1 &>/dev/null + amixer -c 0 cset name='RX1 MIX1 INP1' 'RX1' &>/dev/null + amixer -c 0 cset name='RX2 MIX1 INP1' 'RX2' &>/dev/null + amixer -c 0 cset name='RDAC2 MUX' 'RX2' &>/dev/null + + #Turn on both sides of the headphones + #======================================== + amixer -c 0 cset name='HPHL' 'Switch' &>/dev/null + amixer -c 0 cset name='HPHR' 'Switch' &>/dev/null + amixer -c 0 cset name='MI2S_RX Channels' 'Two' &>/dev/null + + + # Before analog playback + amixer set PCM -- -2200 + amixer cset iface=MIXER,name='RX1 MIX1 INP1' 'RX1' &>/dev/null + amixer cset iface=MIXER,name='RX2 MIX1 INP1' 'RX2' &>/dev/null + amixer cset iface=MIXER,name='RDAC2 MUX' 'RX2' &>/dev/null + amixer cset iface=MIXER,name='HPHL' 1 &>/dev/null + amixer cset iface=MIXER,name='HPHR' 1 &>/dev/null + amixer cset iface=MIXER,name='RX1 Digital Volume' 80 &>/dev/null + amixer cset iface=MIXER,name='RX2 Digital Volume' 80 &>/dev/null +} + +parse_audio_output () +{ + if [ $AUDIO_OUTPUT = "HDMI" ]; then + AUDIO_OUTPUT="0,0" + elif [ $AUDIO_OUTPUT = "analog" ]; then + analog_mic_conf + AUDIO_OUTPUT="0,1" + elif [ $AUDIO_OUTPUT = "USB" ]; then + # parse USB card and device numbers to play in USB headphones (e.g. plughw:1,0) + local PLAYBACK_HW_CARD=$(aplay -l | grep "USB Audio" | cut -d":" -f1 | cut -d" " -f2) + local PLAYBACK_HW_DEVICE=$(aplay -l | grep "USB Audio" | cut -d":" -f2 | cut -d"," -f2 | cut -d" " -f3) + AUDIO_OUTPUT="$PLAYBACK_HW_CARD,$PLAYBACK_HW_DEVICE" + else + return 1 + fi +} +################################# test execution ##################################################### +date +echo "=============> Running Test: Video-720p-24fps-MOV-Audio-HDMI-test.sh <===============" +echo + +VIDEO_ENV_VARIABLE=$1 + +AUDIO_OUTPUT=$2 + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +$UTIL_PATH/check-args-num.sh $# 2 || ( echo "wrong number of arguments" && exit 1 ) || exit 1 + +parse_audio_output || ( echo "========> ERROR: wrong argument!! - user must supply:\ +\"USB\", \"analog\", \"HDMI\" strings as 2nd argument <========" && exit 1) || exit 1 + + +FILE_TO_PLAY="$CONTENT_PATH/$($GET_ENV_VARS $VIDEO_ENV_VARIABLE)" + +echo "====testing FILE_TO_PLAY=$FILE_TO_PLAY ========" + +GST_PIPELINE="! qtdemux name=demuxer \ + demuxer. ! queue ! avdec_aac ! audioconvert ! audioresample ! alsasink device="hw:$AUDIO_OUTPUT" \ + demuxer. ! queue ! h264parse ! avdec_h264 ! glimagesink" + +echo "==============> GST_PIPELINE=$GST_PIPELINE <================" + + +$UTIL_PATH/play-gstreamer-and-check.sh $FILE_TO_PLAY "$GST_PIPELINE" || (echo "utility failed! - play-gstreamer-and-check.sh" && exit 1) || exit 1 + + +echo "=============> test finished: Video-720p-24fps-MOV-Audio-HDMI-test.sh <===============" +echo diff --git a/test-scripts/video/h264-mp4-gstreamer-playback-test.sh b/test-scripts/video/h264-mp4-gstreamer-playback-test.sh deleted file mode 100644 index 6664dd4..0000000 --- a/test-scripts/video/h264-mp4-gstreamer-playback-test.sh +++ /dev/null @@ -1,160 +0,0 @@ -# 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 deleted file mode 100644 index 7391606..0000000 --- a/test-scripts/video/usbcam_gstreamer_video-test.sh +++ /dev/null @@ -1,108 +0,0 @@ -# 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 index 07442de..5bcebb5 100644..100755 --- a/test-scripts/wifi/wifi-connect-WPA2-PSK-security-test.sh +++ b/test-scripts/wifi/wifi-connect-WPA2-PSK-security-test.sh @@ -1,32 +1,43 @@ -# 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. +#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 +#connecting to WPA2-PSK secure wifi AP +# arg 1 - ssid +# arg 2 - password + + +echo "============================> starting wifi-connect-WPA2-PSK-security-test.sh <============================" + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +$UTIL_PATH/check-args-num.sh $# 2 || ( echo "wrong number of arguments" && exit 1 ) || exit 1 CONF="ctrl_interface=/run/wpa_supplicant update_config=1 @@ -39,9 +50,11 @@ network={ export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin":$PATH + export +$UTIL_PATH/get-wifi-config-and-connect.sh "$CONF" || (echo "connection failed" && exit 1) || exit 1 -tiny-apts/util/get-wifi-config-and-connect.sh "$CONF" +echo "============================> successfully ended wifi-connect-WPA2-PSK-security-test.sh <============================" diff --git a/test-scripts/wifi/wifi-connect-open-security-test.sh b/test-scripts/wifi/wifi-connect-open-security-test.sh index 23f3d55..6be49b2 100644..100755 --- a/test-scripts/wifi/wifi-connect-open-security-test.sh +++ b/test-scripts/wifi/wifi-connect-open-security-test.sh @@ -1,32 +1,44 @@ -# 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. +#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 +#connecting to open security wifi AP. $1 - wifi AP + + + +echo "================> starting wifi-connect-open-security-test.sh <=======================" + + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +$UTIL_PATH/check-args-num.sh $# 1 || ( echo "wrong number of arguments" && exit 1 ) || exit 1 + CONF="ctrl_interface=/run/wpa_supplicant update_config=1 @@ -40,9 +52,9 @@ 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" - +$UTIL_PATH/get-wifi-config-and-connect.sh "$CONF" || (echo "connection failed" && exit 1) || exit 1 +echo "================> successfully ended wifi-connect-open-security-test.sh <=======================" diff --git a/test-scripts/wifi/wifi-soft-ap-connect-test.sh b/test-scripts/wifi/wifi-soft-ap-connect-test.sh deleted file mode 100644 index cf90d7f..0000000 --- a/test-scripts/wifi/wifi-soft-ap-connect-test.sh +++ /dev/null @@ -1,167 +0,0 @@ -# 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/test-scripts/wifi/wifi-softap-WPA2-PSK-secure-connect-test.sh b/test-scripts/wifi/wifi-softap-WPA2-PSK-secure-connect-test.sh new file mode 100755 index 0000000..2a9fbfe --- /dev/null +++ b/test-scripts/wifi/wifi-softap-WPA2-PSK-secure-connect-test.sh @@ -0,0 +1,126 @@ +#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 +#secure WPA2-TKIP-PSK connection to Wifi softap +#creates softap on board that transmits the wifi AP. uses another board to connect to the wifi AP +#receives no arguments + + +########################################### function definition ############################################################ +FUNC_createHostapConf () +{ + HOSTAPD_CONF=" +interface=$CURR_WLAN +ctrl_interface=/var/run/hostapd +driver=nl80211 +hw_mode=g +channel=6 +ssid=$SOFTAP_SSID + +#for high throughput 20Mhz +country_code=JP +#advertises the country_code and the set of allowed channels and transmit power levels based on the regulatory limits +ieee80211d=1 + +ieee80211n=1 +wmm_enabled=1 + +auth_algs=1 +wpa=2 +wpa_key_mgmt=WPA-PSK +wpa_pairwise=TKIP CCMP +wpa_passphrase=$SOFTAP_PASS +rsn_pairwise=CCMP +macaddr_acl=0 +" + + echo "=================> HOSTAPD_CONF=$HOSTAPD_CONF" +} + +FUNC_createWpa_suppConf () +{ + + WPA_CONF="ctrl_interface=/run/wpa_supplicant +update_config=1 + +network={ + ssid=\"$SOFTAP_SSID\" + psk=\"$SOFTAP_PASS\" +} +" + echo "===========> WPA_CONF=$WPA_CONF" +} + +############################################## test execution ############################################################# +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +echo "============ testing UTIL_PATH=$UTIL_PATH ============================" +SOFTAP_SSID="softapTestSecure" +SOFTAP_PASS="12345678" + +echo "=================> starting wifi-softap-WPA2-PSK-secure-connect-test.sh <=========================" + +FUNC_createHostapConf +FUNC_createWpa_suppConf + +$UTIL_PATH/connect-helperSTA-to-DUTsoftap.sh "$WPA_CONF" "$HOSTAPD_CONF" \ +|| (echo "utility failed! - connect-helperSTA-to-DUTsoftap.sh" && exit 1) || exit 1 + +$UTIL_PATH/disconnect-helperSTA-from-DUTsoftap.sh \ +|| (echo "utility failed! - disconnect-helperSTA-from-DUTsoftap.sh" && exit 1) || exit 1 + +echo "===============> successfully finished wifi-softap-WPA2-PSK-secure-connect-test.sh script <====================" +exit 0 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test-scripts/wifi/wifi-softap-all-channels-connect-test.sh b/test-scripts/wifi/wifi-softap-all-channels-connect-test.sh new file mode 100755 index 0000000..e36cd5e --- /dev/null +++ b/test-scripts/wifi/wifi-softap-all-channels-connect-test.sh @@ -0,0 +1,58 @@ +#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 is using wifi-softap-non-secure-connect-test.sh scripts to iterate through all channels +# test receives no arguments + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +echo "======> starting test wifi-softap-all-channels-connect-test.sh <===================" + + +for CHANNEL in $(seq 1 11) +do + echo "=======> starting connection in channel=$CHANNEL <==============" + + $CURR_PATH/wifi-softap-non-secure-connect-test.sh -c $CHANNEL || \ +( echo "====> script wifi-softap-non-secure-connect-test.sh failed in channel=$CHANNEL <====" && exit 1 ) || exit 1 + + echo "=======> successfully finished connecting in channel=$CHANNEL <==============" + +done + + +echo "======> successfully finished test wifi-softap-all-channels-connect-test.sh <===================" + + + + + + + diff --git a/test-scripts/wifi/wifi-softap-disassoc-sta-test.sh b/test-scripts/wifi/wifi-softap-disassoc-sta-test.sh new file mode 100755 index 0000000..69e7107 --- /dev/null +++ b/test-scripts/wifi/wifi-softap-disassoc-sta-test.sh @@ -0,0 +1,146 @@ +#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 softap functionality - removing a connected station +#scripts connects HELPER board(DB410) to DUT's softap, then from softap disassociates HELPER board. +#receives no arguments + + +########################################### function definition ############################################################ +FUNC_createHostapConf () +{ + HOSTAPD_CONF=" +interface=$CURR_WLAN +ctrl_interface=/var/run/hostapd +driver=nl80211 +hw_mode=g +channel=6 +ssid=$SOFTAP_SSID + +#for high throughput 20Mhz +country_code=JP +#advertises the country_code and the set of allowed channels and transmit power levels based on the regulatory limits +ieee80211d=1 + +ieee80211n=1 +wmm_enabled=1 + +auth_algs=1 +wpa=2 +wpa_key_mgmt=WPA-PSK +wpa_passphrase=$SOFTAP_PASS +rsn_pairwise=CCMP +macaddr_acl=0 +" + echo "=================> HOSTAPD_CONF=$HOSTAPD_CONF" +} + +FUNC_createWpa_suppConf () +{ + WPA_CONF="ctrl_interface=/run/wpa_supplicant +update_config=1 + +network={ + ssid=\"$SOFTAP_SSID\" + psk=\"$SOFTAP_PASS\" +} +" + echo "===========> WPA_CONF=$WPA_CONF" +} + +FUNC_getConnect_time () #if fails to get connection time echos 0 +{ + HELPER_MAC=$(FUNC_getHelperMacFromHelper) + CONNECTED_TIME=$(hostapd_cli all_sta | grep -io "$HELPER_MAC" -A 11 | grep "connected_time") + echo $CONNECTED_TIME | cut -d"=" -f2 +} +############################################## test execution ############################################################# +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH +########### environment variables from get-env-var-val-target.sh file ###### + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt +# defines common used functions in softap tests scripts +source $UTIL_PATH/softap-HELPER-funcs.sh + +echo "=================> starting wifi-softap-disassoc-sta-test.sh <=========================" +SOFTAP_SSID="softapTestDisassocSTA" +SOFTAP_PASS="23456789" + +FUNC_createHostapConf +FUNC_createWpa_suppConf +######################## connecting two DB410 via wifi STA to softap ################################## +$UTIL_PATH/connect-helperSTA-to-DUTsoftap.sh "$WPA_CONF" "$HOSTAPD_CONF" || (echo "utility failed! - connect-helperSTA-to-DUTsoftap.sh" && exit 1) || exit 1 +########################################## testing ################################################### +sleep 5 +TEST_RESULT=1 +echo "test result before=$TEST_RESULT" +#connected time before - all_sta - get mac addres connected time +CON_TIME_BEFORE=$(FUNC_getConnect_time) || (echo "FUNC_getConnect_time failed! before hostapd_cli disassociate. CON_TIME_BEFORE=$CON_TIME_BEFORE" && exit 1) || exit 1 + +hostapd_cli disassociate $(FUNC_getHelperMacFromDUT) +sleep 15 + +#connected time after all_sta - get mac addres connected time +CON_TIME_AFTER=$(FUNC_getConnect_time) || (echo "FUNC_getConnect_time failed! after hostapd_cli disassociate. CON_TIME_AFTER=$CON_TIME_AFTER" && exit 1) || exit 1 + +echo "CON_TIME_AFTER=$CON_TIME_AFTER" +if [ $CON_TIME_BEFORE -gt $CON_TIME_AFTER ]; then + echo "inside if statement: $CON_TIME_BEFORE is bigger than $CON_TIME_AFTER" + TEST_RESULT=0 +fi +echo "test result after=$TEST_RESULT" +################################ disconnecting ######################################## +$UTIL_PATH/disconnect-helperSTA-from-DUTsoftap.sh +(exit $TEST_RESULT ) || (echo "==> failed wifi-softap-disassoc-sta-test.sh <===" && exit 1) || exit 1 + +echo "===============> successfully finished wifi-softap-disassoc-sta-test.sh <====================" +exit 0 + + + + + + + + + + + + + + + + + + + + + + diff --git a/test-scripts/wifi/wifi-softap-get-station-info-test.sh b/test-scripts/wifi/wifi-softap-get-station-info-test.sh new file mode 100755 index 0000000..2e29dcf --- /dev/null +++ b/test-scripts/wifi/wifi-softap-get-station-info-test.sh @@ -0,0 +1,132 @@ +#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 softap functionality - getting information on connected clients +#scripts connects HELPER board(DB410) to DUT's softap, gets info(MAC addres) of HELPER that's connected to him +#tests passes if the MAC address gotten from DUT's softap is identical to HELPER MAC address thats connected to softap + +#creates softap on board that transmits the wifi AP. uses another board to connect to the wifi AP +#receives no arguments + + + +########################################### function definition ############################################################ +FUNC_createHostapConf () +{ + HOSTAPD_CONF=" +interface=$CURR_WLAN +ctrl_interface=/var/run/hostapd +driver=nl80211 +hw_mode=g +channel=6 +ssid=$SOFTAP_SSID + +#for high throughput 20Mhz +country_code=JP +#advertises the country_code and the set of allowed channels and transmit power levels based on the regulatory limits +ieee80211d=1 + +ieee80211n=1 +wmm_enabled=1 + +auth_algs=1 +wpa=2 +wpa_key_mgmt=WPA-PSK +wpa_passphrase=$SOFTAP_PASS +rsn_pairwise=CCMP +macaddr_acl=0 +" + echo "=================> HOSTAPD_CONF=$HOSTAPD_CONF" +} + +FUNC_createWpa_suppConf () +{ + WPA_CONF="ctrl_interface=/run/wpa_supplicant +update_config=1 + +network={ + ssid=\"$SOFTAP_SSID\" + psk=\"$SOFTAP_PASS\" +} +" + echo "===========> WPA_CONF=$WPA_CONF" +} + +############################### test execution ######################################################## +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH +########### environment variables from get-env-var-val-target.sh file ###### + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt +# defines common used functions in softap tests scripts +source $UTIL_PATH/softap-HELPER-funcs.sh + +echo "=================> starting wifi-softap-get-station-info-test.sh <=========================" +SOFTAP_SSID="softapTestGetSTAInfo" +SOFTAP_PASS="23456789" + +FUNC_createHostapConf +FUNC_createWpa_suppConf + +$UTIL_PATH/connect-helperSTA-to-DUTsoftap.sh "$WPA_CONF" "$HOSTAPD_CONF" || (echo "utility failed! - connect-helperSTA-to-DUTsoftapV2.sh" && exit 1) || exit 1 + +echo "=============> comparing MAC addresses <=================" +TEST_RESULT=0 +echo "FUNC_getHelperMacFromHelper=$(FUNC_getHelperMacFromHelper)" +echo "FUNC_getHelperMacFromDUT=$(FUNC_getHelperMacFromDUT)" +FUNC_getHelperMacFromHelper | grep -i "$(FUNC_getHelperMacFromDUT)" || TEST_RESULT=1 + +$UTIL_PATH/disconnect-helperSTA-from-DUTsoftap.sh + +(exit $TEST_RESULT) || (echo "==> failed wifi-softap-get-station-info-test.sh <===" && exit 1) || exit 1 + +echo "===============> successfully finished wifi-softap-get-station-info-test.sh <====================" +exit 0 + + + + + + + + + + + + + + + + + + + + + + diff --git a/test-scripts/wifi/wifi-softap-non-secure-connect-test.sh b/test-scripts/wifi/wifi-softap-non-secure-connect-test.sh new file mode 100755 index 0000000..05c9aab --- /dev/null +++ b/test-scripts/wifi/wifi-softap-non-secure-connect-test.sh @@ -0,0 +1,125 @@ +#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 +#non secure connection to Wifi softap +#creates softap on board that transmits the wifi AP. uses another board to connect to the wifi AP +# arg1 - channel number to bring up softap with. if no channel is given defaults to 6 + + +########################################### function definition ############################################################ +FUNC_createHostapConf () +{ + HOSTAPD_CONF=" +interface=$CURR_WLAN +ctrl_interface=/var/run/hostapd +driver=nl80211 +hw_mode=g +channel=$SOFTAP_CHANNEL +ssid=$SOFTAP_SSID + +#for high throughput 20Mhz +country_code=JP +#advertises the country_code and the set of allowed channels and transmit power levels based on the regulatory limits +ieee80211d=1 + +ieee80211n=1 +wmm_enabled=1 +" + echo "=================> HOSTAPD_CONF=$HOSTAPD_CONF" +} + +FUNC_createWpa_suppConf () +{ + WPA_CONF="ctrl_interface=/run/wpa_supplicant +update_config=1 + +network={ + ssid=\"$SOFTAP_SSID\" + key_mgmt=NONE +} +" + echo "===========> WPA_CONF=$WPA_CONF" +} + +FUNC_define_channel () +{ + if [ "$CHANNEL_FLAG" != "-c" ]; then + SOFTAP_CHANNEL=6 + else #if we get channel flag then, check we get the channel number + $UTIL_PATH/check-args-num.sh $# 2 + fi +} +############################################## test execution ############################################################# +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH +########### environment variables from get-env-var-val-target.sh file ###### + +# defines general variables used in most tests +source $(dirname $(readlink -f $0))/../../util/generally-used-variables.txt + +# no checking arguments number because suppling arguments is optional +CHANNEL_FLAG=$1 +SOFTAP_CHANNEL=$2 + +FUNC_define_channel +echo "=================> starting wifi-softap-non-secure-connect-test.sh <=========================" +SOFTAP_SSID="softapTestNonSecure" + +FUNC_createHostapConf +FUNC_createWpa_suppConf + +$UTIL_PATH/connect-helperSTA-to-DUTsoftap.sh "$WPA_CONF" "$HOSTAPD_CONF" || (echo "utility failed! - connect-helperSTA-to-DUTsoftapV2.sh" && exit 1) || exit 1 + +$UTIL_PATH/disconnect-helperSTA-from-DUTsoftap.sh + +echo "===============> successfully finished wifi-softap-non-secure-connect-test.sh script <====================" +exit 0 + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tiny-apts.sh b/tiny-apts.sh index 465ed8a..8b5e63c 100644..100755 --- a/tiny-apts.sh +++ b/tiny-apts.sh @@ -1,29 +1,29 @@ -# 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. +#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) @@ -34,29 +34,23 @@ #running the test-job scripts on target device #looging results -####################################### function decleration ################################################################## ####################################### test execution ################################################################## chmod a+xw * -R +find . -type f -name "*~" -delete 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" +PRINT_END="tiny-apts finished. test results see test-log.txt, verbose err log file see: verbose-test-log.txt \nATTENTION- verbose-test-log.txt will be deleted when reached 10 Megabyte" echo $PRINT_BEGIN -./file-transferor.sh $GET_ENV_VARS || (echo $PRINT_END && echo "file transferor failed" && exit $EXIT_ERR) || exit $EXIT_ERR +./file-transferor.sh || (echo $PRINT_END && echo "file transferor failed" && exit $EXIT_ERR) || exit $EXIT_ERR -echo $PRINT_RUNNING -./test-executor.sh $GET_ENV_VARS +./test-executor.sh echo "-----------" >> verbose-test-log.txt echo "-----------" >> test-log.txt -echo $PRINT_END +echo -e $PRINT_END diff --git a/util/bringUp-softap.sh b/util/bringUp-softap.sh new file mode 100755 index 0000000..773dd4f --- /dev/null +++ b/util/bringUp-softap.sh @@ -0,0 +1,170 @@ +#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 +#brings up softap and dhcp server +#receives as args: $1 - softap(hostapd) configuration $2 - dhcp server (dhcpd) configuration + + + +########################################### function definition ############################################################ +FUNC_createConf () # $1 - configuration file path $2 - configuration content +{ + echo "FUNC_createConf arg1 conf path = $1" + echo "FUNC_createConf arg2 conf content = $2" + + echo "$2" > $1 + echo "========> for debug. configuration of file :$1 are:" + cat $1 +} + +FUNC_Cleanup () +{ + $UTIL_PATH/kill-process-ids.sh wpa_supplicant + $UTIL_PATH/kill-process-ids.sh hostapd + $UTIL_PATH/kill-process-ids.sh dhcpd + rfkill unblock all + + rm $HOSTAPD_CONF_PATH 2>/dev/null + rm $DHCPD_CONF_PATH 2>/dev/null + rm $HOSTAPD_RET_VAL_LOG 2>/dev/null + rm $DHCPD_RET_VAL_LOG 2>/dev/null + + ifconfig $CURR_WLAN down + sleep 3 + ifconfig $CURR_WLAN up +} + +FUNC_parseDhcpdConf () #$1 - conf file path $2 - softap static ip $3 - softap netmask +{ + SOFTAP_NETMASK=$(awk '/netmask/ {print $3}' $DHCPD_CONF_PATH) + SOFTAP_STATIC_IP=$(awk 'count && !--count; /option routers/ {count=1}' $DHCPD_CONF_PATH | cut -d";" -f1) || (echo "cut failed" && exit 1) || exit 1 + + echo "==================> in function(FUNC_parseDhcpdConf)SOFTAP_NETMASK=$SOFTAP_NETMASK" + echo "==================> in function(FUNC_parseDhcpdConf)SOFTAP_STATIC_IP=$SOFTAP_STATIC_IP" +} + +FUNC_run_command_multipule_attempts () # $1 - command to execute $2 - attempts num $3 - time between attempts +{ + local COMMAND="$1" + local ATTEMPTS=$2 + local TIME=$3 + local COUNT=0 + local RESULT=0 + + while [ $COUNT -lt $ATTEMPTS ] + do + echo "====> giving time for hostapd enablment - sleeping 30 sec <=====" + sleep $TIME + echo "==========> COMMAND=$COMMAND <===========" + eval $COMMAND + RESULT=$? + echo "==========> RESULT=$RESULT <===========" + if [ $RESULT -eq 0 ]; then + break + fi + + COUNT=$((COUNT=COUNT+1)) + done + + return $RESULT +} + +exit_cleanup_and_posting () # $1 - string to echo +{ + EXIT_STATMENT="$1" + + echo + +} + +############################################## test execution ############################################################# +######### arguments ############## +HOSTAPD_CONF=$1 #$1 - softap configuration +DHCPD_CONF=$2 #$2 - dhcp server (dhcpd) configuration + +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH +########### environment variables from get-env-var-val-target.sh file ######################## +# defines general variables used in most tests +source "$(dirname $(readlink -f $0))/generally-used-variables.txt" + +#UTIL_PATH="$(dirname $(readlink -f $0))" + + + +echo "===========> starting bring up softap utility <=========================" +echo "====> arguments are: arg1 - hostapd configuration. arg2 - dhcpd configuration" +echo "====> arg1 HOSTAPD_CONF=$HOSTAPD_CONF" +echo "====> arg2 DHCPD_CONF=$DHCPD_CONF" + +echo "===========> cleaning up before setup <=========================" +HOSTAPD_CONF_PATH=/etc/hostap.conf +DHCPD_CONF_PATH=/etc/dhcp/dhcpd-test.conf +HOSTAPD_RET_VAL_LOG=hostapd_ret_val.log +DHCPD_RET_VAL_LOG=dhcpd_ret_val.log +FUNC_Cleanup +echo "===========> give time (5 sec) for killed processes to release resources <============" +sleep 5 + +echo "===========> verifying wifi driver supports softap interface mode <============" +RESULT=$(iw list | grep "Supported interface modes" -A 10 | grep "* AP$" ) \ +|| (echo "===> wifi driver do not support AP mode <==" && exit 1) || exit 1 + +echo "===========> creating configuration files <=========================" +FUNC_createConf "$HOSTAPD_CONF_PATH" "$HOSTAPD_CONF" +FUNC_createConf "$DHCPD_CONF_PATH" "$DHCPD_CONF" +sleep 5 +echo "===========> starting HOSTAPD <=========================" +hostapd -d $HOSTAPD_CONF_PATH >> $HOSTAPD_RET_VAL_LOG & +FUNC_run_command_multipule_attempts 'cat $HOSTAPD_RET_VAL_LOG | grep "$CURR_WLAN: AP-ENABLED"' 5 30 \ +|| (echo "====> hostapd failed! <====" && exit 1) || exit 1 + +echo "===========> starting DHCP server <=========================" +FUNC_parseDhcpdConf || (echo "FUNC_parseDhcpdConf failed" && exit 1) || exit 1 +echo "==================> SOFTAP_NETMASK=$SOFTAP_NETMASK" +echo "==================> SOFTAP_STATIC_IP=$SOFTAP_STATIC_IP" +ifconfig $CURR_WLAN up $SOFTAP_STATIC_IP netmask $SOFTAP_NETMASK +sleep 4 +dhcpd -d -cf $DHCPD_CONF_PATH $CURR_WLAN 2>> $DHCPD_RET_VAL_LOG & +sleep 3 +grep "Server starting service" $DHCPD_RET_VAL_LOG || (echo "====> dhcpd failed! <=====" && exit 1) || exit 1 + +############################## end of execution. now cleanup ################################################# + +rm $HOSTAPD_CONF_PATH 2>/dev/null +rm $DHCPD_CONF_PATH 2>/dev/null +#rm $HOSTAPD_RET_VAL_LOG 2>/dev/null +rm $DHCPD_RET_VAL_LOG 2>/dev/null + +sleep 5 +echo "===========> bring up softap utility successfully ended <=========================" + + + + + diff --git a/util/check-args-num.sh b/util/check-args-num.sh index 560d908..24b9730 100644..100755 --- a/util/check-args-num.sh +++ b/util/check-args-num.sh @@ -1,49 +1,55 @@ -# 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. +#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 +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 + RET_VAL=1 fi exit $RET_VAL + + + + + + + + + + + + + diff --git a/util/check-ret-val-and-log.sh b/util/check-ret-val-and-log.sh index 6ca46db..d7b70d9 100644..100755 --- a/util/check-ret-val-and-log.sh +++ b/util/check-ret-val-and-log.sh @@ -1,34 +1,36 @@ -# 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. +#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 @@ -48,4 +50,3 @@ 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/connect-helperSTA-to-DUTsoftap.sh b/util/connect-helperSTA-to-DUTsoftap.sh new file mode 100755 index 0000000..f266c11 --- /dev/null +++ b/util/connect-helperSTA-to-DUTsoftap.sh @@ -0,0 +1,125 @@ +#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 +#terminology: +#DUT = board that creates a softap +#HELPER = board that connects to the wifi AP + +#receives as args: $1 - wpa_supplicant configuration , $2 - hostapd configuration + + +########################################### function definition ############################################################ +FUNC_createDhcpdConf () #$1 - softap static ip $2 - softap netmask +{ + DHCPD_CONF=" +ddns-update-style none; +ignore client-updates; +authoritative; +option local-wpad code 252 = text; + +subnet +192.168.8.0 netmask 255.255.255.0 { +# --- default gateway +option routers +192.168.8.1; +# --- Netmask +option subnet-mask +255.255.255.0; +# --- Broadcast Address +option broadcast-address +192.168.8.255; +# --- Domain name servers, tells the clients which DNS servers to use. +option domain-name-servers +192.168.8.1, 8.8.8.8, 8.8.4.4; +option time-offset +0; +range 192.168.8.3 192.168.8.128; +default-lease-time 1209600; +max-lease-time 1814400; +} +" +} + +FUNC_Cleanup () +{ + echo "doing cleanup" +$UTIL_PATH/kill-process-ids.sh wpa_supplicant +$UTIL_PATH/kill-process-ids.sh hostapd +$UTIL_PATH/kill-process-ids.sh dhcpd +# /usr/sbin/rfkill unblock all + rfkill unblock all +} + +FUNC_movingFilesToClient () +{ + ssh $HELPER_ADDR mkdir $BASE_PATH + ssh $HELPER_ADDR mkdir $TEST_SCRIPTS_PATH + ssh $HELPER_ADDR mkdir $DEVICE_UTIL_PATH + scp $UTIL_PATH/* $HELPER_ADDR:$DEVICE_UTIL_PATH +} + +############################################## test execution ############################################################# +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH +########### environment variables from get-env-var-val-target.sh file ## + +# defines general variables used in most tests +source "$(dirname $(readlink -f $0))/generally-used-variables.txt" + +THIS_FILE_NAME=$0 +FAIL=1 +LOG=3 +######### arguments ############## +echo "===============> starting utility: connect-helperSTA-to-DUTsoftapV2.sh <============================" +WPA_SUPP_CONF="$1" +echo "==========================> argument 1 WPA_SUPP_CONF=$WPA_SUPP_CONF" +HOSTAPD_CONF="$2" +echo "==========================> argument 2 HOSTAPD_CONF=$HOSTAPD_CONF" + +FUNC_Cleanup +sleep 1 + +FUNC_createDhcpdConf +$UTIL_PATH/bringUp-softap.sh "$HOSTAPD_CONF" "$DHCPD_CONF" || (echo "==> bringup softap util failed <==" && exit 1) || exit 1 + +echo "===============> transferring wifi connection scripts to CLIENT device <============================" +FUNC_movingFilesToClient +echo "=================> connecting from CLIENT <=================================" +STDERR="$( (ssh $HELPER_ADDR "$DEVICE_UTIL_PATH/get-wifi-config-and-connect.sh '$WPA_SUPP_CONF'") 2>&1)" \ +|| (echo "STDERR=$STDERR. failed to connect to softap" && exit 1) || exit +echo "STDERR=$STDERR" +sleep 5 +echo "===============> successfully finished connect-helperSTA-to-DUTsoftapV2.sh <============================" + + + + + + + diff --git a/util/copyfiles-flashdestination.sh b/util/copyfiles-flashdestination.sh deleted file mode 100644 index b11c3fc..0000000 --- a/util/copyfiles-flashdestination.sh +++ /dev/null @@ -1,76 +0,0 @@ -# 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 deleted file mode 100644 index 716b794..0000000 --- a/util/copyfiles-flashsource.sh +++ /dev/null @@ -1,74 +0,0 @@ -# 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/disconnect-helperSTA-from-DUTsoftap.sh b/util/disconnect-helperSTA-from-DUTsoftap.sh new file mode 100755 index 0000000..b1d4a45 --- /dev/null +++ b/util/disconnect-helperSTA-from-DUTsoftap.sh @@ -0,0 +1,93 @@ +#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 +#terminates Wifi connection correctly between helper-DB410 from DUT's softap +#receives no arguments +#terminology: +#HELPER = board that connects to the wifi AP created by the DUT + + + +########### environment variables from get-env-var-val-target.sh file ## +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH +# defines general variables used in most tests +source "$(dirname $(readlink -f $0))/generally-used-variables.txt" + +# defines common used functions in softap tests scripts +source $UTIL_PATH/softap-HELPER-funcs.sh + + +echo "============> starting disconnect-helperSTA-from-DUTsoftap.sh <========================" + +echo "ssh command remove client test jobs" +ssh $HELPER_ADDR rm -r $TEST_SCRIPTS_PATH + +echo "ssh command remove client util path" +ssh $HELPER_ADDR rm -r $DEVICE_UTIL_PATH + +echo "ssh command wpa_cli disconnect" +ssh $HELPER_ADDR 'wpa_cli disconnect' + +echo "ssh command kill wpa_supplicant" +ssh $HELPER_ADDR 'kill -9 $(pidof wpa_supplicant)' + +FUNC_checkHELPERHasOnlyOneWlan +HELPER_WLAN="$(ssh $HELPER_ADDR ifconfig -a | grep wlan | cut -d" " -f1)" +echo "ssh command dhclient $HELPER_WLAN -r" +ssh $HELPER_ADDR dhclient $HELPER_WLAN -r + +echo "ssh command $HELPER_WLAN down" +ssh $HELPER_ADDR ifconfig $HELPER_WLAN down +sleep 2 + +echo "ssh command $HELPER_WLAN up" +ssh $HELPER_ADDR ifconfig $HELPER_WLAN up + +echo "DUT command kill hostapd" +kill -9 $(pidof hostapd) +sleep 1 + +echo "DUT command kill dhcpd" +kill -9 $(pidof dhcpd) +sleep 1 + +echo "DUT command $CURR_WLAN down" +ifconfig $CURR_WLAN down +sleep 3 + +echo "DUT command $CURR_WLAN up" +ifconfig $CURR_WLAN up +sleep 3 + + +echo "============> finished disconnect-helperSTA-from-DUTsoftap.sh <========================" + + + + diff --git a/util/generally-used-variables.txt b/util/generally-used-variables.txt new file mode 100755 index 0000000..59479bb --- /dev/null +++ b/util/generally-used-variables.txt @@ -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. + + +# this file is run by most scripts to define environment variables + + +CURR_PATH="$(dirname $(readlink -f $0))" +#relative path from test scripts to util folder +UTIL_PATH="$CURR_PATH/../../util/" + +# changing ralative util path to curr dir +CURR_DIR=$(echo $CURR_PATH | rev | cut -d"/" -f1 | rev) +if [ $CURR_DIR = "util" ]; then + UTIL_PATH=$CURR_PATH +elif [ -n "$(ls $CURR_PATH | grep tiny-apts.sh)" ]; then + UTIL_PATH="$CURR_PATH/util" +fi + +export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:$PATH:$UTIL_PATH +GET_ENV_VARS="$UTIL_PATH/get-env-var-val-target.sh" +BASE_PATH="$($GET_ENV_VARS TARGET_BASE_PATH)" +TEST_SCRIPTS_PATH="$BASE_PATH/$($GET_ENV_VARS TEST_SCRIPT_DIR)" +WIFI_TEST_PATH="$TEST_SCRIPTS_PATH/$($GET_ENV_VARS WIFI_TESTS_DIR)" +DEVICE_UTIL_PATH="$BASE_PATH/$($GET_ENV_VARS UTIL_DIR)" +CONTENT_PATH="$BASE_PATH/$($GET_ENV_VARS CLIENT_CONTENT_DIR)" + +MSG_TO_USER="$CONTENT_PATH/$($GET_ENV_VARS SOUND_FILE_MSG_TO_USER)" +USER_NAME="$($GET_ENV_VARS TARGET_DEVICE_USER)" +TARGET_ADDR="root@$($GET_ENV_VARS TARGET_DEVICE_IP)" +HELPER_ADDR="root@$($GET_ENV_VARS HELPER_DEVICE_IP)" +CURR_WLAN="$(ifconfig -a | grep wlan | cut -d" " -f1)" + +# working station general variables +WSTATION_TEST_SCRIPTS_PATH="$CURR_PATH/$($GET_ENV_VARS TEST_SCRIPT_DIR)" +WSTATION_UTIL_PATH="$CURR_PATH/$($GET_ENV_VARS UTIL_DIR)" +WSTATION_CONTENT_FILE_PATH="$($GET_ENV_VARS CONTENT_FILE_PATH)" +WSTATION_LOGGER_PATH="$CURR_PATH/logger.sh" +WSTATION_TEST_ARGS_PATH="$CURR_PATH/selectTestsWithARGS.txt" +STATION_TEST_SCRIPTS_DIR="$($GET_ENV_VARS STATION_TEST_DIR)" diff --git a/util/get-env-var-val-station.sh b/util/get-env-var-val-station.sh deleted file mode 100644 index 0a8722f..0000000 --- a/util/get-env-var-val-station.sh +++ /dev/null @@ -1,39 +0,0 @@ -# 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 index 8d1a9d8..f242c46 100644..100755 --- a/util/get-env-var-val-target.sh +++ b/util/get-env-var-val-target.sh @@ -1,42 +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. +#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 +#receives an environment variable #reads from environmentVars.txt #and prints the variable value on stdout -#usage - $(getEnvVarVal <SOME_ENV_VAR>) - -# $1 environmet var +#usage - "$(getEnvVarVal <SOME_ENV_VAR>)" -ENV_VAR_PATH=$(find -name "environmentVars.txt") +# $1 environment var -grep "$1" $ENV_VAR_PATH | cut -d"=" -f2 +DIR="$(dirname $(readlink -f $0))" +(grep "$1" $DIR/environmentVars.txt | grep -v "#" | cut -d"=" -f2) diff --git a/util/get-wifi-config-and-connect.sh b/util/get-wifi-config-and-connect.sh index 16dc010..ced4dba 100644..100755 --- a/util/get-wifi-config-and-connect.sh +++ b/util/get-wifi-config-and-connect.sh @@ -1,35 +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. +#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 { @@ -82,17 +84,17 @@ 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" + runCmdCheckAndLog "udhcpc -i $CURR_WLAN" "obtained" "udhcpc shulden't fail" 4 4 "ip: not found" + + runCmdCheckAndLog "ifconfig $CURR_WLAN" "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" || + LINE_CONTAINING_GATEWAY_IP=$(ip route show | grep $CURR_WLAN | grep default) && echo "LINE_CONTAINING_GATEWAY_IP=$LINE_CONTAINING_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 + for ITEM in $LINE_CONTAINING_GATEWAY_IP; do if [ $ITEM != "dev" ]; then PREV=$ITEM else @@ -102,38 +104,40 @@ pingGatewayOfConnectedWifiAp () 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 + runCmdCheckAndLog "ping -c 1 $GATEWAY_IP" "received, 0% packet loss" "faild to ping gateway IP" 5 7 "0 packets received" || exit 1 } ############################## test run ##################################################################################### +echo "==================> starting get-wifi-config-and-connect.sh <=======================================" +export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/sbin/ip":$PATH -THIS_FILE_NAME=$0 +# defines general variables used in most tests +source "$(dirname $(readlink -f $0))/generally-used-variables.txt" -GET_ENV_VARS=$(find -name "get-env-var-val-target.sh") -UTIL_PATH="$($GET_ENV_VARS UTIL_PATH)" +CONF_INFO="$1" +THIS_FILE_NAME=$0 LOG=-2 WPA_SUPP_CONF_PATH=/etc/wpa_supplicant_test.conf -CONF_INFO="$1" +$UTIL_PATH/kill-process-ids.sh wpa_supplicant +$UTIL_PATH/kill-process-ids.sh udhcpc -$UTIL_PATH/kill-process-ids.sh "wpa" -$UTIL_PATH/kill-process-ids.sh "udhcpc" createWpaConf "$CONF_INFO" $WPA_SUPP_CONF_PATH - +echo "=======> sole argument of script: wpa_supplicant configuration: <===================" echo "CONF_INFO: $CONF_INFO" -/usr/sbin/rfkill unblock all +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 "wpa_supplicant -B -i $CURR_WLAN -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 +runCmdCheckAndLog "wpa_cli status" "wpa_state=COMPLETED" "wpa_cli status - dose not show:\"wpa_state=COMPLETED\"" 6 20 "wpa_state=DISCONNECTED" || exit 1 getIpFromUdhcp || exit 1 pingGatewayOfConnectedWifiAp || exit 1 -#rm $WPA_SUPP_CONF_PATH +rm $WPA_SUPP_CONF_PATH diff --git a/util/install-pkg.sh b/util/install-pkg.sh new file mode 100755 index 0000000..0d48827 --- /dev/null +++ b/util/install-pkg.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 +# script installs desired package with opkg on OE build + + +PKG_NAME=$1 + +echo "=============== starting install-pkg.sh =======================" +SOURCE="http://10.18.167.14/ipk" +OPKG_CONF=/etc/opkg/opkg.conf + +# check opkg binaries present +which opkg || ( echo "no binaries of opkg. script fails" && exit 1 ) || exit 1 + +# if package already installed leave script successfully +opkg list-installed | grep $PKG_NAME && echo "=== package already installed! successfully finished install-pkg.sh ====" && exit 0 + +touch /etc/init.d/ifup +grep "$SOURCE" $OPKG_CONF || echo "src/gz OE_OPKG $SOURCE" >> $OPKG_CONF +opkg update || ( echo "======> opkg install failed to update! <=======" && exit 1 ) || exit 1 + +# check package in source +opkg list | grep $PKG_NAME || ( echo "package $PKG_NAME not in source $SOURCE!!! script fails" && exit 1 ) || exit 1 + +opkg install $PKG_NAME || ( echo "======> opkg install failed to install! <=======" && exit 1 ) || exit 1 + +sleep 2 + +opkg list-installed | grep $PKG_NAME || ( echo "======> opkg install failed! <=======" && exit 1 ) || exit 1 + +echo "=============== successfully finished install-pkg.sh =======================" +exit 0 + + diff --git a/util/kill-process-ids.sh b/util/kill-process-ids.sh index aa747a4..3f1f700 100644..100755 --- a/util/kill-process-ids.sh +++ b/util/kill-process-ids.sh @@ -1,41 +1,45 @@ -# 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. +#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" +# the sed is to remove leading blankspace +PROCESS_PIDS="$(echo $(echo "$PROCESSES" | sed -e 's/^[ \t]*//') | cut -d" " -f1)" +echo "PROCESS_PIDS=$PROCESS_PIDS" + + for ITEM in $PROCESS_PIDS; do echo "ITEM=$ITEM" diff --git a/util/led_on-off.sh b/util/led_on-off.sh new file mode 100755 index 0000000..031a93a --- /dev/null +++ b/util/led_on-off.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 +# turns on user leds + + + +TIME=$1 +USER_LED_NUM=$2 + +echo 1 > /sys/class/leds/apq8016-sbc:green:user$USER_LED_NUM/brightness +sleep $TIME +echo 0 > /sys/class/leds/apq8016-sbc:green:user$USER_LED_NUM/brightness + + diff --git a/util/logger.sh b/util/logger.sh index 7b5741a..2a96689 100644..100755 --- a/util/logger.sh +++ b/util/logger.sh @@ -1,44 +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. - -#receives $1 = name of test, $2 = result of test (0-success, 0< - fail, 0> - log msg). $3 = if verbose status, $4 - verbose err msg +#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 = (-v)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=$3 # -v small verbose msg under (48894 chars), -vb - large msg VERBOSE_ERRMSG=$4 VERBOSE_ERR_LINE_NO=$5 +################ function definition ######################### +deleteLogIfToBig () #deletes if log file largger then 10 Megabyte +{ + LOG_FILE_SIZE=$(ls -al | awk '/'"$VERBOSE_LOG_FILE_NAME"'/ {print $5}') + if [ $LOG_FILE_SIZE -gt 17000000 ]; then + rm $VERBOSE_LOG_FILE_NAME 2>/dev/null + fi +} -#/home/linaro/tiny-apts/log -#tiny-apts/log +#################### script execution ############################ + +VERBOSE_LOG_FILE_NAME=verbose-test-log.txt +touch $VERBOSE_LOG_FILE_NAME +deleteLogIfToBig if [ $TEST_RESULT -eq 0 ]; then TEST_RESULT="PASS" @@ -51,15 +64,28 @@ 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 + echo "date:$(date). file name:$TEST_NAME - "LOG MSG", ERRMSG=$VERBOSE_ERRMSG. errLineNum:$VERBOSE_ERR_LINE_NO" >> $VERBOSE_LOG_FILE_NAME + +elif [ "$VERBOSE" = -vb ]; then + echo "$VERBOSE_ERRMSG" >> $VERBOSE_LOG_FILE_NAME else ADDITIONAL_INFO=$VERBOSE - echo "date:$(date) $TEST_NAME - $TEST_RESULT $ADDITIONAL_INFO" >> test-log.txt + echo "date:$(date) $TEST_NAME - $TEST_RESULT $ADDITIONAL_INFO" >> test-log.txt + fi +#if [ -n "$VERBOSE_ERRMSG" ]; then + + + +#else + +#fi + +#date:Sun Aug 28 16:14:43 IDT 2016 test-executor.sh - LOG MSG -vb + + diff --git a/util/play-gstreamer-and-check.sh b/util/play-gstreamer-and-check.sh new file mode 100755 index 0000000..41b67cb --- /dev/null +++ b/util/play-gstreamer-and-check.sh @@ -0,0 +1,195 @@ +#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 +# this tests plays an H264 file using gstreamer pipeline +# this test also captures cpu temperature and cpu usage and prints this out. +# recievs: +# arg1 = path to file to paly +# arg2 = gstreamr pipeline +# arg3 = duration in seconds to play file and monitor cpu + + +date +echo "=============> Running utility: play-gstreamer-and-check.sh <===============" +echo + + + +FILE_TO_PLAY=$1 +echo file "arg1 - file to play - $FILE_TO_PLAY" +GST_PIPELINE=$2 +echo "arg2- GST_PIPELINE=$GST_PIPELINE" +TIMEOUT=$3 +echo "arg3 - duration in seconds to play file and monitor cpu=$TIMEOUT" + +if [ -z "$TIMEOUT" ]; then + echo "arg3 is empty string. setting default value of 60 seconds to play file and monitor cpu" + TIMEOUT=60 +fi + +UTIL_PATH="$(dirname $(readlink -f $0))" +$UTIL_PATH/setPerformanceModeCpu.sh + +# 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 +kill -9 $(pidof "X") &>/dev/null +sleep 1 +echo +echo "done cleanup & setup, running test..." + +# activate X - windows system +export DISPLAY=:0 +sleep 2 +X & +pidof X &>/dev/null || (echo "X server failed to run" && exit 1) || exit 1 +sleep 2 +# change screen resolution +HDMI_OUTPUT_NAME="$(xrandr -d :0 | grep connected | awk {'print $1'})" +# if xrandr fails to change resolution util keeps running +xrandr "-d" ":0" "--output" "$HDMI_OUTPUT_NAME" "--mode" "1920x1080" || ( echo "xrandr failed to change resolution" && exit 1 ) +sleep 1 + +# executing gstreamer +COMMAND="gst-launch-1.0 -v filesrc location=$FILE_TO_PLAY $GST_PIPELINE" +echo "Running Command: $COMMAND" +eval $COMMAND &> $GSTREAMER_LOG_FILE & + +sleep 3 + +# 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 + +COUNTER=1 +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 +kill -9 $(pidof "X") &>/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 + + + +#writing result to file, to be read by test-executor.sh and used in log files +echo "max cpu usage:$MAX_GST_CPU_USAGE%" > test_string_ret_val.txt + + +echo +echo "=============> Finished utility: play-gstreamer-and-check.sh <===============" +echo + +date +exit $RESULT + + + diff --git a/util/pre-execution-setup.sh b/util/pre-execution-setup.sh new file mode 100755 index 0000000..16052b0 --- /dev/null +++ b/util/pre-execution-setup.sh @@ -0,0 +1,56 @@ +#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 +# ====> the script shutsdown the device. the user need to turn it back on <==== +# this script enables pulseaudio access to audio. + + +# ======= pulseAudio-access- enablment ===================== + +EXIT_COMMAND='( echo "gpasswd in script $0 faild" && exit 1 ) || exit 1' + +gpasswd -a linaro audio &>/dev/null || eval $EXIT_COMMAND +gpasswd -a linaro lp &>/dev/null || eval $EXIT_COMMAND +gpasswd -a pulse audio &>/dev/null || eval $EXIT_COMMAND +gpasswd -a pulse lp &>/dev/null || eval $EXIT_COMMAND +gpasswd -a root audio &>/dev/null || eval $EXIT_COMMAND +gpasswd -a root lp &>/dev/null || eval $EXIT_COMMAND +sleep 2 + +reboot + + + + + + + + + + diff --git a/util/pulseaudio-run-daemon.sh b/util/pulseaudio-run-daemon.sh new file mode 100755 index 0000000..389749c --- /dev/null +++ b/util/pulseaudio-run-daemon.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 +# IMPORTANT this script must be run as user not root!!!! usage: su <user, e.g:linaro> -lc <this script> + + + +export DISPLAY=:0.0 + +pulseaudio --exit-idle-time=1000000000000000000 & +sleep 5 +pactl set-default-source alsa_input.platform-7702000.sound.HiFi__plughw_0_2__source || (echo "set-default-source failed" && exit 1) || exit 1 +pactl set-source-port alsa_input.platform-7702000.sound.HiFi__plughw_0_2__source "[In] Secondarymic" || (echo "set-source-port failed" && exit 1) + + diff --git a/util/search-cmd-output.sh b/util/search-cmd-output.sh index 41bfe31..749ee63 100644..100755 --- a/util/search-cmd-output.sh +++ b/util/search-cmd-output.sh @@ -1,43 +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. +#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 + +# defines general variables used in most tests +source "$(dirname $(readlink -f $0))/generally-used-variables.txt" + 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 +LOGGER_PATH=$UTIL_PATH FAIL=1 TRUE="true" diff --git a/util/setPerformanceModeCpu.sh b/util/setPerformanceModeCpu.sh new file mode 100755 index 0000000..fe8de0e --- /dev/null +++ b/util/setPerformanceModeCpu.sh @@ -0,0 +1,44 @@ +#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 +# script sets governor in all CPU's to performance mode +# installs cpufreq using opkg + + +echo "=============> Running utility: setPerformanceModeCpu.sh <===============" + +CURR_PATH="$(dirname $(readlink -f $0))" +$CURR_PATH/install-pkg.sh cpufrequtils + +echo "setting all CPU's governor to performance mode" +cpufreq-set -g performance || ( echo "cpufreq-set failed in util: setPerformanceModeCpu.sh" && exit 1 ) || exit 1 + +cpufreq-info | grep "The governor" || ( echo "cpufreq-info failed to grep the governor in util: setPerformanceModeCpu.sh" && exit 1 ) || exit 1 + +echo "==================> end of util - setPerformanceModeCpu.sh <===================" + diff --git a/util/softap-HELPER-funcs.sh b/util/softap-HELPER-funcs.sh new file mode 100755 index 0000000..ce8fdd0 --- /dev/null +++ b/util/softap-HELPER-funcs.sh @@ -0,0 +1,52 @@ +#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. + + +# this file will be run by the comand "source" in scripts that shares these functions + + +FUNC_checkHELPERHasOnlyOneWlan () +{ + if [ $(ssh $HELPER_ADDR "ifconfig | grep -c wlan") -gt 1 ]; then + echo "====> ERROR:found more then one wlan device in HELPER device <========" + exit 1 + fi +} + + +FUNC_getHelperMacFromHelper () +{ + FUNC_checkHELPERHasOnlyOneWlan + + local IFCONFIG_RESULT=$(ssh $HELPER_ADDR "ifconfig | grep wlan") + echo $IFCONFIG_RESULT | cut -d" " -f5 +} + +FUNC_getHelperMacFromDUT () +{ + hostapd_cli all_sta | grep "Selected interface" -A1 | grep "Selected" -v +} diff --git a/util/uart.sh b/util/uart.sh new file mode 100755 index 0000000..1a7051b --- /dev/null +++ b/util/uart.sh @@ -0,0 +1,96 @@ +#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=3 +FIRST=$1 +SEC=$2 + +UTIL_PATH="$(dirname $(readlink -f $0))" +INPUT="hello first terminal I'm second" + +#first terminal +touch fromsecterminal.txt +touch sec.txt +echo $INPUT > sec.txt +cat /dev/ttyMSM$SEC > fromsecterminal.txt & +#second terminal +eval busybox sh $UTIL_PATH/uartsecter.sh $FIRST + +#first terminal +OUT="$( (cat fromsecterminal.txt) 2>&1)" +# check output from second terminal +echo "$OUT" | grep "$INPUT" || (echo "failed to receive input from second terminal" && exit 1) || exit 1 + +WC="$( (wc sec.txt fromsecterminal.txt) 2>&1)" +echo "$WC" +export PSTTY="$( (ps | grep "cat /dev/ttyMSM" | sed -n '1p' | awk '{print $1}' ) 2>&1)" +OUT="$( (kill -9 $PSTTY) 2>&1)" + +LINE1="$( (wc sec.txt fromsecterminal.txt | sed -n '1p') 2>&1)" +LINE2="$( (wc sec.txt fromsecterminal.txt | sed -n '2p') 2>&1)" +FIRSTIN1="$( ( echo $LINE1 | awk '{print $1}') 2>&1)" +FIRSTIN2="$( ( echo $LINE2 | awk '{print $1}') 2>&1)" + +if [ "$FIRSTIN1" != "$FIRSTIN2" ]; then + rm fromsecterminal.txt + rm sec.txt + exit $PASSORFAIL +fi +PASSORFAIL=$((PASSORFAIL-1)) + +SECIN1="$( ( echo $LINE1 | awk '{print $2}') 2>&1)" +SECIN2="$( ( echo $LINE2 | awk '{print $2}') 2>&1)" +if [ "$SECIN1" != "$SECIN2" ]; then + rm fromsecterminal.txt + rm sec.txt + exit $PASSORFAIL +fi +PASSORFAIL=$((PASSORFAIL-1)) + +THIN1="$( ( echo $LINE1 | awk '{print $3}') 2>&1)" +THIN2="$( ( echo $LINE2 | awk '{print $3}') 2>&1)" +RESULT="$( (echo $THIN2 $THIN1 | awk '{print $1 - $2}') 2>&1)" + +if [ "$RESULT" != 1 ]; then + rm fromsecterminal.txt + rm sec.txt + exit $PASSORFAIL +fi +PASSORFAIL=$((PASSORFAIL-1)) + + + +rm fromsecterminal.txt +rm sec.txt +echo $PASSORFAIL +exit $PASSORFAIL + + diff --git a/util/uartsecter.sh b/util/uartsecter.sh new file mode 100755 index 0000000..baeadb0 --- /dev/null +++ b/util/uartsecter.sh @@ -0,0 +1,31 @@ +#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 "hello first terminal I'm second" > /dev/ttyMSM$1 |