1 ################################################################################
3 ## Copyright © International Business Machines Corp., 2007, 2008 ##
5 ## This program is free software; you can redistribute it and#or modify ##
6 ## it under the terms of the GNU General Public License as published by ##
7 ## the Free Software Foundation; either version 2 of the License, or ##
8 ## (at your option) any later version. ##
10 ## This program is distributed in the hope that it will be useful, but ##
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
12 ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ##
13 ## for more details. ##
15 ## You should have received a copy of the GNU General Public License ##
16 ## along with this program; if not, write to the Free Software ##
17 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ##
19 ################################################################################
24 # Script to run the tests in testcases/realtime
26 # Usage: $0 test_argument
28 # where test-argument = func | stress | perf | all | list | clean | test_name
30 # test_name is the name of a subdirectory in func/, stress/ or perf/
32 echo "Real-time tests run"
35 echo $LTPROOT |
grep testscripts
> /dev
/null
2>&1
44 echo -e "\nUsage: test_realtime.sh -t test-argument [-l loop num_of_iterations] [-t test-argument1 [-l loop ...]] ..."
45 echo -e "\nWhere test-argument = func | stress | perf | all | list | clean | test_name"
47 echo -e " func = all functional tests will be run "
48 echo -e " stress = all stress tests will be run "
49 echo -e " perf = all perf tests will be run "
50 echo -e " all = all tests will be run "
51 echo -e " list = all available tests will be listed "
52 echo -e " clean = all logs deleted, make clean performed "
53 echo -e " test_name = only test_name subdir will be run (e.g: func/pi-tests) "
58 function check_error
()
61 echo -e "\n $1 Failed\n"
68 echo -e "\nAvailable tests are:\n"
71 for file in `find -name run_auto.sh`
73 echo -e " `dirname $file `"
86 #Test if $LOOPS is a integer
87 if [[ ! $LOOPS =~ ^
[0-9]+$
]]; then
88 echo "\"$LOOPS\" doesn't appear to be a number"
92 if [ -d "$test" ]; then
93 pushd $test >/dev
/null
94 if [ -f "run_auto.sh" ]; then
95 echo " Running $LOOPS runs of $subdir "
96 for((iter
=0; $iter < $LOOPS; iter
++)); do
100 echo -e "\n Failed to find run script in $test \n"
102 pushd $TESTS_DIR >/dev
/null
104 echo -e "\n $test is not a valid test subdirectory "
110 function make_clean
()
112 pushd $TESTS_DIR >/dev
/null
130 # Run all tests which have run_auto.sh
131 TESTLIST
="func stress java perf"
134 # This will only display subdirs which have run_auto.sh
139 # This will clobber logs, out files, .o's etc
145 # run the tests in the individual subdirectory if it exists
149 for subdir
in $TESTLIST; do
150 if [ -d $subdir ]; then
151 pushd $subdir >/dev
/null
152 for name
in `find -name "run_auto.sh"`; do
153 test="`dirname $name`"
154 run_test
"$test" "$2"
155 pushd $subdir > /dev
/null
157 pushd $TESTS_DIR >/dev
/null
159 echo -e "\n $subdir not found; check name/path with run.sh list "
165 source $LTPROOT/testcases
/realtime
/scripts
/setenv.sh
167 if [ $# -lt 1 ]; then
170 pushd $TESTS_DIR >/dev
/null
173 if [ ! -e "logs" ]; then
175 echo " creating logs directory as $TESTS_DIR/logs "
179 #Only build the library, most of the tests depend upon.
180 #The Individual tests will be built, just before they run.
188 while getopts ":t:l:h" option
193 if [ $ISLOOP -eq 1 ]; then
199 tests
[$index]="$OPTARG"
207 tests
[$index]="$OPTARG"
214 * ) echo "Unrecognized option specified"
219 for(( i
=0; $i < $index ; $
((i
+=2)) )); do
220 find_test
${tests[$i]} ${tests[$((i+1))]}