From: Subrata <sub...@us...> - 2008-05-22 12:03:36
|
Update of /cvsroot/ltp/ltp/testcases/realtime In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26900/ltp/testcases/realtime Modified Files: run.sh Log Message: Profiled Tests: Basically this was done to enhance the pass/fail criteria usage and allow the user to setup tests configurations according to specific needs. Imagine a test series that may validate a hardware for some latencies (case #1) while another series would validate other criteria (case #2). The same test used in situation #1 will not have the same configuration (arguments) in situation #2. Scripting has to be done for this to achieve. The profile system does this for you. You just have to configure. Not only pass/fail criteria can be set since the profile system simply runs command lines defined in profiles. So any argument can be choosen. ie: a profile can define criteria for tests with or without saving statistics (-s) or simulate jvm (-j). A profile comes as a single file so it is easy to copy from a test machine to another. With this patch, profiles can be used either for test global run (./run.sh) or for an individual directory (./run_auto.sh). For more information, read doc/AUTOMATED_RUN. This patch is intentionnally global as splitting changes would not make sense. This includes: - changes of scripts for automated tests to feature profiles - individual changes for tests using automation - a default profile (to be used as an example) - documentation writing/modifying. Signed-off-by: Gilles Carry <gil...@bu...>, Reviewed-by: Ankita Garg <an...@in...>. Index: run.sh =================================================================== RCS file: /cvsroot/ltp/ltp/testcases/realtime/run.sh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** run.sh 24 Mar 2008 09:54:58 -0000 1.4 --- run.sh 22 May 2008 12:03:14 -0000 1.5 *************** *** 33,37 **** function usage() { ! echo -e "\nUsage: run.sh -t test-argument [-l loop num_of_iterations] [-t test-argument1 [-l loop ...]] ..." echo -e "\nWhere test-argument = func | stress | perf | all | list | clean | test_name " echo -e "\n and: \n" --- 33,37 ---- function usage() { ! echo -e "\nUsage: run.sh [-p profile] -t test-argument [-l loop num_of_iterations] [-t test-argument1 [-l loop ...]] ..." echo -e "\nWhere test-argument = func | stress | perf | all | list | clean | test_name " echo -e "\n and: \n" *************** *** 42,45 **** --- 42,46 ---- echo -e " clean = all logs deleted, make clean performed " echo -e " test_name = only test_name subdir will be run (e.g: func/pi-tests) " + echo -e " -p profile = use profile instead of default " echo -e " -h = help" echo -e "\n" *************** *** 67,93 **** function run_test() { iter=0 if [ -z "$2" ]; then ! LOOPS=1 else ! LOOPS=$2 fi #Test if $LOOPS is a integer if [[ ! $LOOPS =~ ^[0-9]+$ ]]; then ! echo "\"$LOOPS\" doesn't appear to be a number" ! usage ! exit fi if [ -d "$test" ]; then ! pushd $test >/dev/null ! if [ -f "run_auto.sh" ]; then echo " Running $LOOPS runs of $subdir " for((iter=0; $iter < $LOOPS; iter++)); do ! ./run_auto.sh done else echo -e "\n Failed to find run script in $test \n" ! fi ! pushd $TESTS_DIR >/dev/null else echo -e "\n $test is not a valid test subdirectory " --- 68,99 ---- function run_test() { + local profile + + profile=$1 + shift + iter=0 if [ -z "$2" ]; then ! LOOPS=1 else ! LOOPS=$2 fi #Test if $LOOPS is a integer if [[ ! $LOOPS =~ ^[0-9]+$ ]]; then ! echo "\"$LOOPS\" doesn't appear to be a number" ! usage ! exit fi if [ -d "$test" ]; then ! pushd $test >/dev/null ! if [ -f "run_auto.sh" ]; then echo " Running $LOOPS runs of $subdir " for((iter=0; $iter < $LOOPS; iter++)); do ! ./run_auto.sh $profile done else echo -e "\n Failed to find run script in $test \n" ! fi ! pushd $TESTS_DIR >/dev/null else echo -e "\n $test is not a valid test subdirectory " *************** *** 103,110 **** for mfile in `find -name "Makefile"`; do ! target_dir=`dirname $mfile` ! pushd $target_dir >/dev/null ! make clean ! pushd $TESTS_DIR >/dev/null done } --- 109,116 ---- for mfile in `find -name "Makefile"`; do ! target_dir=`dirname $mfile` ! pushd $target_dir >/dev/null ! make clean ! pushd $TESTS_DIR >/dev/null done } *************** *** 112,158 **** find_test() { ! case $1 in func) ! TESTLIST="func" ! ;; ! stress) ! TESTLIST="stress" ! ;; ! perf) ! TESTLIST="perf" ! ;; ! all) ! # Run all tests which have run_auto.sh ! TESTLIST="func stress java perf" ! ;; list) ! # This will only display subdirs which have run_auto.sh ! list_tests ! exit ! ;; ! clean) ! # This will clobber logs, out files, .o's etc ! make_clean ! exit ! ;; ! *) ! # run the tests in the individual subdirectory if it exists ! TESTLIST="$1" ! ;; ! esac ! for subdir in $TESTLIST; do ! if [ -d $subdir ]; then ! pushd $subdir >/dev/null ! for name in `find -name "run_auto.sh"`; do ! test="`dirname $name`" ! run_test "$test" "$2" ! pushd $subdir > /dev/null ! done ! pushd $TESTS_DIR >/dev/null ! else ! echo -e "\n $subdir not found; check name/path with run.sh list " ! fi ! done } --- 118,170 ---- find_test() { ! local profile ! ! profile=$1 ! shift ! ! case $1 in func) ! TESTLIST="func" ! ;; ! stress) ! TESTLIST="stress" ! ;; ! perf) ! TESTLIST="perf" ! ;; ! all) ! # Run all tests which have run_auto.sh ! TESTLIST="func stress java perf" ! ;; list) ! # This will only display subdirs which have run_auto.sh ! list_tests ! exit ! ;; ! clean) ! # This will clobber logs, out files, .o's etc ! make_clean ! exit ! ;; ! *) ! # run the tests in the individual subdirectory if it exists ! TESTLIST="$1" ! ;; ! esac ! ! for subdir in $TESTLIST; do ! if [ -d $subdir ]; then ! pushd $subdir >/dev/null ! for name in `find -name "run_auto.sh"`; do ! test="`dirname $name`" ! run_test "$profile" "$test" "$2" ! pushd $subdir > /dev/null ! done ! pushd $TESTS_DIR >/dev/null ! else ! echo -e "\n $subdir not found; check name/path with run.sh list " ! fi ! done } *************** *** 162,166 **** if [ $# -lt 1 ]; then ! usage fi pushd $TESTS_DIR >/dev/null --- 174,178 ---- if [ $# -lt 1 ]; then ! usage fi pushd $TESTS_DIR >/dev/null *************** *** 175,210 **** ISLOOP=0 index=0 ! while getopts ":t:l:h" option do ! case "$option" in ! t ) ! if [ $ISLOOP -eq 1 ]; then ! LOOP=1 ! tests[$index]=$LOOP index=$((index+1)) ! fi ! ! tests[$index]="$OPTARG" ! index=$((index+1)) ! TESTCASE="$OPTARG" ! ISLOOP=1 ! ;; ! l ) ! ISLOOP=0 ! tests[$index]="$OPTARG" ! LOOP="$OPTARG" ! index=$((index+1)) ! ;; h ) ! usage ! ;; * ) echo "Unrecognized option specified" ! usage ! ;; ! esac done for(( i=0; $i < $index ; $((i+=2)) )); do ! find_test ${tests[$i]} ${tests[$((i+1))]} done --- 187,225 ---- ISLOOP=0 index=0 ! while getopts ":t:l:hp:" option do ! case "$option" in ! t ) ! if [ $ISLOOP -eq 1 ]; then ! LOOP=1 ! tests[$index]=$LOOP ! index=$((index+1)) ! fi ! ! tests[$index]="$OPTARG" index=$((index+1)) ! TESTCASE="$OPTARG" ! ISLOOP=1 ! ;; ! l ) ! ISLOOP=0 ! tests[$index]="$OPTARG" ! LOOP="$OPTARG" ! index=$((index+1)) ! ;; ! p ) ! profile=$OPTARG ! ;; h ) ! usage ! ;; * ) echo "Unrecognized option specified" ! usage ! ;; ! esac done for(( i=0; $i < $index ; $((i+=2)) )); do ! find_test "$profile" ${tests[$i]} ${tests[$((i+1))]} done |