X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=automated-tests%2Fexecute.sh;h=7703340d40120c4061b2c8c6139110ff4f9fbf8f;hp=e4059eef3b38a4bc38584cf5d3f42b2ef838182f;hb=41d36118a13932bcf1db39b780ac437fcda8aa08;hpb=e2eda444afbe82e9591fe198eef339227f90a616 diff --git a/automated-tests/execute.sh b/automated-tests/execute.sh index e4059ee..7703340 100755 --- a/automated-tests/execute.sh +++ b/automated-tests/execute.sh @@ -1,42 +1,161 @@ #!/bin/bash -TEMP=`getopt -o ds: --long desktop,scenario: \ - -n 'build_out.sh' -- "$@"` +TEMP=`getopt -o dhsSmf --long debug,help,failnorerun,serial,tct,modules -n 'execute.sh' -- "$@"` if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$TEMP" -scenario=all -env=./_export_env.sh +function usage +{ + echo -e "Usage: execute.sh [-d][-s|-S|-r] [module|testcase]" + echo -e " execute.sh\t\tExecute test cases from all modules in parallel" + echo -e " execute.sh -f \tExecute test cases from all modules in parallel without rerunning failed test cases" + echo -e " execute.sh -d \tDebug testcase" + echo -e " execute.sh [module]\tExecute test cases from the given module in parallel" + echo -e " execute.sh -s [module]\t\tExecute test cases in serial using Testkit-Lite" + echo -e " execute.sh -S [module]\t\tExecute test cases in serial" + echo -e " execute.sh \tFind and execute the given test case" + exit 2 +} +opt_tct=0 +opt_serial="" +opt_modules=0 +opt_debug=0 +opt_noFailedRerun=""; while true ; do case "$1" in - -d|--desktop) env=./_export_desktop.sh ; shift ;; - -s|--scenario) scenario="$2" ; shift 2 ;; - --) shift ; break ;; - *) echo "Internal error!" ; exit 1 ;; - esac + -h|--help) usage ;; + -d|--debug) opt_debug=1 ; shift ;; + -s|--tct) opt_tct=1 ; shift ;; + -f|--nofailedrerun) opt_noFailedRerun="-f" ; shift ;; + -S|--serial) opt_serial="-s" ; shift ;; + -m|--modules) opt_modules=1 ; shift ;; + --) shift; break;; + *) echo "Internal error $1!" ; exit 1 ;; + esac done +function execute_tct +{ + scripts/tctestsgen.sh $1 `pwd` desktop $2 + testkit-lite -f `pwd`/tests.xml -o tct-${1}-core-tests.xml -A --comm localhost + scripts/add_style.pl $1 +} -# Source correct environment -. $env +function summary_start +{ + start=`date +"%Y-%m-%d_%H_%M_%S"` + cat > summary.xml < + + + + + $start + $start + +EOF +} +function summary_end +{ + cat >> summary.xml < +EOF +} -echo PATH=$PATH -echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH -echo TET_ROOT=$TET_ROOT -echo TET_SUITE_ROOT=$TET_SUITE_ROOT -echo ARCH=$ARCH +if [ $opt_modules == 1 ] ; then + modules= get_modules + echo $modules + exit 0 +fi -RESULT_DIR=results-$ARCH -HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html -JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal +# Clean up old test results +rm -f tct*core-tests.xml -mkdir -p $RESULT_DIR +# Clean up old coverage data +[ -d ../build/tizen ] && rm -f ../build/tizen/dali/.libs/*.gcda +[ -d ../build/tizen-cmake ] && find ../build/tizen-cmake/ -name \*.gcda -exec rm {} \; -tcc -e -j $JOURNAL_RESULT -p ./ $scenario -./tbp.pl $JOURNAL_RESULT +find build \( -name "*.gcda" \) -exec rm '{}' \; +ASCII_BOLD="\e[1m" +ASCII_RESET="\e[0m" + +modules=`ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual` +if [ -f summary.xml ] ; then unlink summary.xml ; fi + +if [ $opt_tct == 1 ] ; then + # Use Test-kit lite + # Run all test case executables serially, create XML output + if [ -n "$1" ] ; then + execute_tct $1 $* + else + for mod in $modules + do + if [ $mod != 'common' ] && [ $mod != 'manual' ]; then + + echo -ne "$ASCII_BOLD" + echo -e "Executing $mod$ASCII_RESET" + execute_tct $mod $* + fi + done + fi + + scripts/summarize.pl + +else + # Execute test cases using own test harness + + if [ -z "$1" ] ; then + # No arguments: + # Execute each test executable in turn (by default, runs tests in parallel) + summary_start + for mod in $modules + do + echo -e "$ASCII_BOLD" + echo -e "Executing $mod$ASCII_RESET" + build/src/$mod/tct-$mod-core $opt_serial $opt_noFailedRerun + done + summary_end + + elif [ -f "build/src/$1/tct-$1-core" ] ; then + # First argument is an executable filename - execute only that with any + # remaining arguments + summary_start + module=$1 + shift; + build/src/$module/tct-$module-core $opt_serial $opt_noFailedRerun $* + summary_end + + else + # 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 $modules + do + output=`build/src/$mod/tct-$mod-core $1` + ret=$? + if [ $ret -ne 6 ] ; then + if [ $opt_debug -ne 0 ] ; then + echo DEBUGGING: + gdb --args build/src/$mod/tct-$mod-core $1 + + else + echo $output + if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi + fi + exit $ret + fi + done + echo $1 not found + fi +fi + +if [ -f summary.xml ] ; then + scripts/output_summary.pl +fi + +exit $?