3 TEMP=`getopt -o dhsSmfq --long debug,help,failnorerun,quiet,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][-q] [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 -q|--quiet ...\tExecute test cases, but don't write output"
20 echo -e " execute.sh <testcase>\tFind and execute the given test case"
33 -d|--debug) opt_debug=1 ; shift ;;
34 -s|--tct) opt_tct=1 ; shift ;;
35 -f|--nofailedrerun) opt_noFailedRerun="-f" ; shift ;;
36 -S|--serial) opt_serial="-s" ; shift ;;
37 -q|--quiet) opt_quiet="-q" ; shift ;;
38 -m|--modules) opt_modules=1 ; shift ;;
40 *) echo "Internal error $1!" ; exit 1 ;;
46 scripts/tctestsgen.sh $1 `pwd` desktop $2
47 testkit-lite -f `pwd`/tests.xml -o tct-${1}-core-tests.xml -A --comm localhost
48 scripts/add_style.pl $1
51 function summary_start
53 start=`date +"%Y-%m-%d_%H_%M_%S"`
54 cat > summary.xml <<EOF
55 <?xml version="1.0" encoding="UTF-8"?>
56 <?xml-stylesheet type="text/xsl" href="./style/summary.xsl"?>
57 <result_summary plan_name="Core">
58 <other xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string" />
59 <summary test_plan_name="Dali">
60 <start_at>$start</start_at>
61 <end_at>$start</end_at>
68 cat >> summary.xml <<EOF
75 start=`date +"%Y-%m-%d_%H_%M_%S"`
76 cat > tct-${1}-core-tests.xml <<EOF
77 <?xml version="1.0" encoding="UTF-8"?>
78 <?xml-stylesheet type="text/xsl" href="./style/testresult.xsl"?>
80 <environment build_id="" device_id="localhost" device_model="" device_name="N/A" host="Ubuntu" manufacturer="" resolution="N/A" screen_size="N/A"><other /></environment>
81 <summary test_plan_name="Empty test_plan_name"><start_at>$start</start_at><end_at>$start</end_at></summary>
82 <suite category="Core APIs" name="tct-$1-core-tests">
83 <set name="default" set_debug_msg="automated-tests.auto.suite_1_set_1.dlog">
90 cat >> tct-${1}-core-tests.xml <<EOF
98 if [ $opt_modules == 1 ] ; then
104 # Clean up old test results
105 rm -f tct*core-tests.xml
107 # Clean up old coverage data
108 [ -d ../build/tizen ] && rm -f ../build/tizen/dali/.libs/*.gcda
109 [ -d ../build/tizen-cmake ] && find ../build/tizen-cmake/ -name \*.gcda -exec rm {} \;
111 find build \( -name "*.gcda" \) -exec rm '{}' \;
116 modules=`ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
117 if [ -f summary.xml ] ; then unlink summary.xml ; fi
119 if [ $opt_tct == 1 ] ; then
121 # Run all test case executables serially, create XML output
122 if [ -n "$1" ] ; then
127 if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
129 echo -ne "$ASCII_BOLD"
130 echo -e "Executing $mod$ASCII_RESET"
139 # Execute test cases using own test harness
141 if [ -z "$1" ] ; then
143 # Execute each test executable in turn (by default, runs tests in parallel)
147 echo -e "$ASCII_BOLD"
148 echo -e "Executing $mod$ASCII_RESET"
150 dbus-launch build/src/$mod/tct-$mod-core $opt_serial $opt_noFailedRerun $opt_quiet
155 elif [ -f "build/src/$1/tct-$1-core" ] ; then
156 # First argument is an executable filename - execute only that with any
157 # remaining arguments
161 output_start ${module}
162 dbus-launch build/src/$module/tct-$module-core $opt_serial $opt_noFailedRerun $opt_quiet $*
167 # First argument is not an executable. Is it a test case name?
168 # Try executing each executable with the test case name until success/known failure
171 output=`build/src/$mod/tct-$mod-core $1`
173 if [ $ret -ne 6 ] ; then
174 if [ $opt_debug -ne 0 ] ; then
176 dbus-launch gdb --args build/src/$mod/tct-$mod-core $1
180 if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi
189 if [ -f summary.xml ] ; then
190 scripts/output_summary.pl