Updated test scripts to allow executing smaller numbers of tests
authorDavid Steele <david.steele@partner.samsung.com>
Mon, 9 Jun 2014 16:08:18 +0000 (17:08 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 11 Jun 2014 08:02:09 +0000 (09:02 +0100)
[problem] Executing test cases takes too long
[cause] Granularity is too high
[solution] Add option to run tests from a specific test case file

Change-Id: I1023fd50f65d903c16e36965370f3777293a1271
Signed-off-by: David Steele <david.steele@partner.samsung.com>
automated-tests/execute.sh
automated-tests/scripts/retriever.sh
automated-tests/scripts/tctestsgen.sh

index ec5c9e2..3b5bd62 100755 (executable)
@@ -2,7 +2,7 @@
 
 function execute
 {
 
 function execute
 {
-    scripts/tctestsgen.sh $1 `pwd` desktop
+    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
 }
     testkit-lite -f `pwd`/tests.xml -o tct-${1}-core-tests.xml  -A --comm localhost
     scripts/add_style.pl $1
 }
@@ -12,14 +12,14 @@ rm -f tct*core-tests.xml
 
 if [ -n "$1" ] ; then
   echo EXECUTING ONLY $1
 
 if [ -n "$1" ] ; then
   echo EXECUTING ONLY $1
-  execute $1
+  execute $*
 
 else
   for mod in `ls -1 src/ | grep -v CMakeList `
   do
     if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
         echo EXECUTING $mod
 
 else
   for mod in `ls -1 src/ | grep -v CMakeList `
   do
     if [ $mod != 'common' ] && [ $mod != 'manual' ]; then
         echo EXECUTING $mod
-        execute $mod
+        execute $mod $*
     fi
   done
 fi
     fi
   done
 fi
index d3b123b..37cabf6 100755 (executable)
@@ -161,14 +161,13 @@ function tc_fullinfo {
 
 
 # usage note and exit:
 
 
 # usage note and exit:
-# - argument begin with '-' but is not recognised or number of arguments is > 2,
-# - argument doesn't begin with '-' and number of arguments is > 1
-if [[ ( "$1" == -* && ( ! "$1" =~ ^-(anum|mnum|f)$ || $# > 2 ) ) || ( "$1" != -* && $# > 1 ) ]]; then
+# - argument begin with '-' but is not recognised or number of arguments is > 3,
+# - argument doesn't begin with '-' and number of arguments is > 2
+if [[ ( "$1" == -* && ( ! "$1" =~ ^-(anum|mnum|f)$ || $# > 3 ) ) || ( "$1" != -* && $# > 2 ) ]]; then
     echo -e "$USAGE"
     exit 1
 fi
 
     echo -e "$USAGE"
     exit 1
 fi
 
-
 # get directory from last argument (or assume current one)
 if [[ ! "$1" =~ ^-(anum|mnum|f)$ ]]; then
     DIR=${1:-.}
 # get directory from last argument (or assume current one)
 if [[ ! "$1" =~ ^-(anum|mnum|f)$ ]]; then
     DIR=${1:-.}
@@ -176,14 +175,30 @@ else
     DIR=${2:-.}
 fi
 
     DIR=${2:-.}
 fi
 
+# get filename from last argument
+if [[ $# == 3 && -f $DIR/$3 ]] ; then
+    FILE=$3
+elif [[ $# == 2 && -f $DIR/$2 ]] ; then
+    FILE=$2
+fi
+
+#Debug needs to be output on stderr ( calling script redirects stdout to file )
+#echo "Dir: $DIR  File: $FILE" >& 2
 
 # populate $TC_FILES with files declared in CMakeLists.txt
 
 # populate $TC_FILES with files declared in CMakeLists.txt
-get_tc_files $DIR
-if [ $? != 0 ]; then
-    exit 1
+if [[ -z $FILE ]]; then
+    get_tc_files $DIR
+    if [ $? != 0 ]; then
+        exit 1
+    fi
+    echo "Got all files" >& 2
+else
+    TC_FILES="$DIR/$FILE"
+    echo "TC_FILES: $TC_FILES" >& 2
 fi
 
 
 fi
 
 
+
 # run appropriate subcommand
 case "$1" in
     -anum)
 # run appropriate subcommand
 case "$1" in
     -anum)
index 4b920b9..1881668 100755 (executable)
@@ -60,7 +60,7 @@ print "</test_definition>"
     }' $TFILE > $FILE
 }
 
     }' $TFILE > $FILE
 }
 
-(cd $SCRIPT_DIR/..; scripts/retriever.sh -f src/$MODULE_NAME > ${TFILE}_pre)
+(cd $SCRIPT_DIR/..; scripts/retriever.sh -f src/$MODULE_NAME $4 > ${TFILE}_pre)
 if [ $? -ne 0 ]; then cat ${TFILE}_pre; exit 1; fi
 cat ${TFILE}_pre | sort -t',' -k2,2 -s > $TFILE
 gen
 if [ $? -ne 0 ]; then cat ${TFILE}_pre; exit 1; fi
 cat ${TFILE}_pre | sort -t',' -k2,2 -s > $TFILE
 gen