Merge "Added TextChanged signal to TextField" into tizen
[platform/core/uifw/dali-toolkit.git] / automated-tests / execute.sh
1 #!/bin/bash
2
3 TEMP=`getopt -o hsr --long help,serial,rerun -n 'execute.sh' -- "$@"`
4
5 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
6
7 # Note the quotes around `$TEMP': they are essential!
8 eval set -- "$TEMP"
9
10 function usage
11 {
12     echo -e "Usage: execute.sh\t\tExecute test cases from all modules in parallel"
13     echo -e "       execute.sh <testmodule>\tExecute test cases from the given module in parallel"
14     echo -e "       execute.sh -s\t\tExecute test cases in serial using Testkit-Lite"
15     echo -e "       execute.sh -r\t\tExecute test cases in parallel, re-running failed test cases in serial afterwards"
16     echo -e "       execute.sh <testcase>\tFind and execute the given test case"
17     exit 2
18 }
19
20 opt_serial=0
21 opt_rerun=""
22 while true ; do
23     case "$1" in
24         -h|--help)     usage ;;
25         -s|--serial)   opt_serial=1 ; shift ;;
26         -r|--rerun)    opt_rerun="-r" ; shift ;;
27         --) shift; break;;
28         *) echo "Internal error $1!" ; exit 1 ;;
29     esac
30 done
31
32 function execute
33 {
34     scripts/tctestsgen.sh $1 `pwd` desktop $2
35     testkit-lite -f `pwd`/tests.xml -o tct-${1}-core-tests.xml  -A --comm localhost
36     scripts/add_style.pl $1
37 }
38
39
40
41 # Clean up old test results
42 rm -f tct*core-tests.xml
43
44 # Clean up old coverage data
45 if [ -d ../build/tizen ] ; then
46     rm -f ../build/tizen/dali-core/.libs/*.gcda
47 fi
48
49 find build \( -name "*.gcda" \) -exec rm '{}' \;
50
51 ASCII_BOLD="\e[1m"
52 ASCII_RESET="\e[0m"
53
54 if [ $opt_serial = 1 ] ; then
55     # Run all test case executables serially, create XML output
56     if [ -n "$1" ] ; then
57         execute $1 $*
58     else
59         for mod in `ls -1 src/ | grep -v CMakeList `
60         do
61             if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
62
63                 echo -ne "$ASCII_BOLD"
64                 echo -e "Executing $mod$ASCII_RESET"
65                 execute $mod $*
66             fi
67         done
68     fi
69
70     scripts/summarize.pl
71 else
72     # if $1 is an executable filename, execute it·
73
74     if [ -z "$1" ] ; then
75         # No arguments:
76         # Execute each test executable in turn, using parallel execution
77         for mod in `ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
78         do
79             echo -e "$ASCII_BOLD"
80             echo -e "Executing $mod$ASCII_RESET"
81             build/src/$mod/tct-$mod-core $opt_rerun
82         done
83
84     elif [ -f "build/src/$1/tct-$1-core" ] ; then
85         # First argument is an executable filename - execute only that with any
86         # remaining arguments
87         module=$1
88         shift;
89         build/src/$module/tct-$module-core $opt_rerun $*
90
91     else
92        # First argument is not an executable. Is it a test case name?
93        # Try executing each executable with the test case name until success/known failure
94         for mod in `ls -1 src/ | grep -v CMakeList | grep -v common | grep -v manual`
95         do
96             output=`build/src/$mod/tct-$mod-core $1`
97             ret=$?
98             if [ $ret -ne 6 ] ; then
99                echo $output
100                if [ $ret -eq 0 ] ; then echo -e "\nPassed" ; fi
101                exit $ret
102             fi
103         done
104         echo $1 not found
105     fi
106 fi