X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fexecute.sh;h=04dbd1f45d302713d7851145ea535c21189b3c76;hp=1c77009a2f966c089917f687c79125459d0b8da9;hb=30db1d740b360cc46dec051f503c8c20f51141b0;hpb=a13474af714b2713c20c6f7966e3ec776bcc6d50 diff --git a/automated-tests/execute.sh b/automated-tests/execute.sh index 1c77009..04dbd1f 100755 --- a/automated-tests/execute.sh +++ b/automated-tests/execute.sh @@ -1,20 +1,31 @@ #!/bin/bash -TEMP=`getopt -o sr --long serial,rerun -n 'execute.sh' -- "$@"` +TEMP=`getopt -o hsr --long help,serial,rerun -n 'execute.sh' -- "$@"` if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" -opt_parallel=1 +function usage +{ + echo -e "Usage: execute.sh\t\tExecute test cases from all modules in parallel" + echo -e " execute.sh \tExecute test cases from the given module in parallel" + echo -e " execute.sh -s\t\tExecute test cases in serial using Testkit-Lite" + echo -e " execute.sh -r\t\tExecute test cases in parallel, re-running failed test cases in serial afterwards" + echo -e " execute.sh \tFind and execute the given test case" + exit 2 +} + +opt_serial=0 opt_rerun="" while true ; do case "$1" in - -s|--serial) opt_parallel=0 ; shift ;; + -h|--help) usage ;; + -s|--serial) opt_serial=1 ; shift ;; -r|--rerun) opt_rerun="-r" ; shift ;; --) shift; break;; - *) echo "Internal error $1!" ; exit 1 ;; + *) echo "Internal error $1!" ; exit 1 ;; esac done @@ -25,6 +36,8 @@ function execute scripts/add_style.pl $1 } + + # Clean up old test results rm -f tct*core-tests.xml @@ -35,34 +48,59 @@ fi find build \( -name "*.gcda" \) -exec rm '{}' \; -if [ $opt_parallel = 1 ] ; then +ASCII_BOLD="\e[1m" +ASCII_RESET="\e[0m" +if [ $opt_serial = 1 ] ; then + # Run all test case executables serially, create XML output if [ -n "$1" ] ; then - if [ -f "build/src/$1/tct-$1-core" ] ; then - build/src/$1/tct-$1-core -p $opt_rerun - fi + execute $1 $* else for mod in `ls -1 src/ | grep -v CMakeList ` do if [ $mod != 'common' ] && [ $mod != 'manual' ]; then - echo EXECUTING $mod - build/src/$mod/tct-$mod-core -p $opt_rerun + + echo -ne "$ASCII_BOLD" + echo -e "Executing $mod$ASCII_RESET" + execute $mod $* fi done fi + scripts/summarize.pl else - if [ -n "$1" ] ; then - execute $1 $* + # if $1 is an executable filename, execute it· + + if [ -z "$1" ] ; then + # No arguments: + # Execute each test executable in turn, using parallel execution + for mod in `ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual` + do + echo -e "$ASCII_BOLD" + echo -e "Executing $mod$ASCII_RESET" + build/src/$mod/tct-$mod-core $opt_rerun + done + + elif [ -f "build/src/$1/tct-$1-core" ] ; then + # First argument is an executable filename - execute only that with any + # remaining arguments + module=$1 + shift; + build/src/$module/tct-$module-core $opt_rerun $* + else - for mod in `ls -1 src/ | grep -v CMakeList ` + # First argument is not an executable. Is it a test case name? + # Try executing each executable with the test case name until success/known failure + for mod in `ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual` do - if [ $mod != 'common' ] && [ $mod != 'manual' ]; then - echo EXECUTING $mod - execute $mod $* + output=`build/src/$mod/tct-$mod-core $1` + ret=$? + if [ $ret -ne 6 ] ; then + echo $output + if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi + exit $ret fi done + echo $1 not found fi - - scripts/summarize.pl fi