3 TEMP=`getopt -o dhsSmf --long debug,help,failnorerun,serial,tct,modules -n 'execute.sh' -- "$@"`
5 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
7 # Note the quotes around `$TEMP': they are essential!
12 echo -e "Usage: execute.sh [-d][-s|-S|-r] [module|testcase]"
13 echo -e " execute.sh\t\tExecute test cases from all modules in parallel"
14 echo -e " execute.sh -f \tExecute test cases from all modules in parallel without rerunning failed test cases"
15 echo -e " execute.sh -d <testcase>\tDebug testcase"
16 echo -e " execute.sh [module]\tExecute test cases from the given module in parallel"
17 echo -e " execute.sh -s [module]\t\tExecute test cases in serial using Testkit-Lite"
18 echo -e " execute.sh -S [module]\t\tExecute test cases in serial"
19 echo -e " execute.sh <testcase>\tFind and execute the given test case"
31 -d|--debug) opt_debug=1 ; shift ;;
32 -s|--tct) opt_tct=1 ; shift ;;
33 -f|--nofailedrerun) opt_noFailedRerun="-f" ; shift ;;
34 -S|--serial) opt_serial="-s" ; shift ;;
35 -m|--modules) opt_modules=1 ; shift ;;
37 *) echo "Internal error $1!" ; exit 1 ;;
43 scripts/tctestsgen.sh $1 `pwd` desktop $2
44 testkit-lite -f `pwd`/tests.xml -o tct-${1}-core-tests.xml -A --comm localhost
45 scripts/add_style.pl $1
48 function summary_start
50 start=`date +"%Y-%m-%d_%H_%M_%S"`
51 cat > summary.xml <<EOF
52 <?xml version="1.0" encoding="UTF-8"?>
53 <?xml-stylesheet type="text/xsl" href="./style/summary.xsl"?>
54 <result_summary plan_name="Core">
55 <other xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" />
56 <summary test_plan_name="Dali">
57 <start_at>$start</start_at>
58 <end_at>$start</end_at>
65 cat >> summary.xml <<EOF
70 if [ $opt_modules == 1 ] ; then
76 # Clean up old test results
77 rm -f tct*core-tests.xml
79 # Clean up old coverage data
80 [ -d ../build/tizen ] && rm -f ../build/tizen/dali/.libs/*.gcda
81 [ -d ../build/tizen-cmake ] && find ../build/tizen-cmake/ -name \*.gcda -exec rm {} \;
83 find build \( -name "*.gcda" \) -exec rm '{}' \;
88 modules=`ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
89 if [ -f summary.xml ] ; then unlink summary.xml ; fi
91 if [ $opt_tct == 1 ] ; then
93 # Run all test case executables serially, create XML output
99 if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
101 echo -ne "$ASCII_BOLD"
102 echo -e "Executing $mod$ASCII_RESET"
111 # Execute test cases using own test harness
113 if [ -z "$1" ] ; then
115 # Execute each test executable in turn (by default, runs tests in parallel)
119 echo -e "$ASCII_BOLD"
120 echo -e "Executing $mod$ASCII_RESET"
121 build/src/$mod/tct-$mod-core $opt_serial $opt_noFailedRerun
125 elif [ -f "build/src/$1/tct-$1-core" ] ; then
126 # First argument is an executable filename - execute only that with any
127 # remaining arguments
131 build/src/$module/tct-$module-core $opt_serial $opt_noFailedRerun $*
135 # First argument is not an executable. Is it a test case name?
136 # Try executing each executable with the test case name until success/known failure
139 output=`build/src/$mod/tct-$mod-core $1`
141 if [ $ret -ne 6 ] ; then
142 if [ $opt_debug -ne 0 ] ; then
144 gdb --args build/src/$mod/tct-$mod-core $1
148 if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi
157 if [ -f summary.xml ] ; then
158 scripts/output_summary.pl