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 if [ -d ../build/tizen ] ; then
81 rm -f ../build/tizen/dali/.libs/*.gcda
84 find build \( -name "*.gcda" \) -exec rm '{}' \;
89 modules=`ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
90 if [ -f summary.xml ] ; then unlink summary.xml ; fi
92 if [ $opt_tct == 1 ] ; then
94 # Run all test case executables serially, create XML output
100 if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
102 echo -ne "$ASCII_BOLD"
103 echo -e "Executing $mod$ASCII_RESET"
112 # Execute test cases using own test harness
114 if [ -z "$1" ] ; then
116 # Execute each test executable in turn (by default, runs tests in parallel)
120 echo -e "$ASCII_BOLD"
121 echo -e "Executing $mod$ASCII_RESET"
122 build/src/$mod/tct-$mod-core $opt_serial $opt_noFailedRerun
126 elif [ -f "build/src/$1/tct-$1-core" ] ; then
127 # First argument is an executable filename - execute only that with any
128 # remaining arguments
132 build/src/$module/tct-$module-core $opt_serial $opt_noFailedRerun $*
136 # First argument is not an executable. Is it a test case name?
137 # Try executing each executable with the test case name until success/known failure
140 output=`build/src/$mod/tct-$mod-core $1`
142 if [ $ret -ne 6 ] ; then
143 if [ $opt_debug -ne 0 ] ; then
145 gdb --args build/src/$mod/tct-$mod-core $1
149 if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi
158 if [ -f summary.xml ] ; then
159 scripts/output_summary.pl