adapt suite to IVI profile 20/27120/1 accepted/tizen/common/20140904.154805 accepted/tizen/ivi/20140905.151537 submit/tizen/20140904.154719
authorNicolas Zingilé <nicolas.zingile@open.eurogiciel.org>
Thu, 4 Sep 2014 15:45:33 +0000 (17:45 +0200)
committerNicolas Zingilé <nicolas.zingile@open.eurogiciel.org>
Thu, 4 Sep 2014 15:45:33 +0000 (17:45 +0200)
Change-Id: Id59686b3ea7a56d509fd49560d697e8a4ea070ad
Signed-off-by: Nicolas Zingilé <nicolas.zingile@open.eurogiciel.org>
TESTDIR/00-common/A0-sanity/02-multimedia/gst.sh
TESTDIR/00-common/A0-sanity/02-multimedia/init.sh
TESTDIR/00-common/A0-sanity/02-multimedia/post.sh
TESTDIR/runme.sh
TESTDIR/util.sh [new file with mode: 0644]

index 7554f6aec7c2298edc8a1c832bc0a4b3a59dd2d6..a691dd6583e90208c760b4c61dd0b612b0860627 100755 (executable)
@@ -1,9 +1,21 @@
 #!/bin/bash -x
 
-# Copyright (c) 2013 Intel Corporation. All rights reserved.
-# Use of this source code is governed by a LGPL v2.1 license that can be
-# found in the LICENSE file in the db directory.
-# Author : Ewan Le Bideau-Canevet
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Authors : Ewan le Bideau Canevet <ewan.lebideau-canevet@open.eurogiciel.org>
+#           Nicolas Zingile <nicolas.zingile@open.eurogiciel.org>
 
 
 FILE=$1
@@ -16,6 +28,7 @@ echo $COMMAND
 $COMMAND &>$tmplog &
 pid=$!
 (sleep 5; [ -e /proc/$pid ] && kill $pid;) &
+
 while [ -e /proc/$pid ]; do
        sleep 1
        if grep "$UNWANTED" $tmplog ; then
@@ -25,4 +38,11 @@ while [ -e /proc/$pid ]; do
                exit 1
        fi
 done
-exit 0
+
+wait $pid
+
+if [[ (( $? == 137 )) || (( $? == 143 )) || (( $? == 0 )) ]]; then
+    exit 0
+else
+    echo "a core dump has occured, test failed" && exit 1
+fi
index 24599bb338813657e81d4c6da256a42f5344ea9c..adff1ff1f6eaf5ff8576efa036635756315c4e43 100755 (executable)
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # Authors : Ewan le Bideau Canevet <ewan.lebideau-canevet@open.eurogiciel.org>
+#          Nicolas Zingile <nicolas.zingile@open.eurogiciel.org>
+
+source util.sh
 
 FILE=$1
-cp $FILE ~guest
+user=$(gettestuser)
+
+cp $FILE /home/$user
index a0dd115e64189a84b554c129bc8dbd4711c3b3a5..26569b50e45b17a7f7776ae57cff5ef7409248fc 100755 (executable)
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # Authors : Ewan le Bideau Canevet <ewan.lebideau-canevet@open.eurogiciel.org>
+#           Nicolas Zingile <nicolas.zingile@open.eurogiciel.org>
+
+source util.sh
 
 FILE=$1
-rm -rf ~guest/$FILE
+user=$(gettestuser)
+
+rm -rf /home/$user/$FILE
index 59769d7e99a771d4640135a51091573195f42af9..177868608c9b3ada1d31588798ac3149972db723 100755 (executable)
@@ -1,14 +1,38 @@
 #!/bin/bash -x
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Authors : Ewan le Bideau Canevet <ewan.lebideau-canevet@open.eurogiciel.org>
+#           Nicolas Zingile <nicolas.zingile@open.eurogiciel.org>
+
+source util.sh
+
 CMD="$@"
 tmpscript=$(mktemp)
+user=$(gettestuser)
+process=$(gettestprocess $user)
+
 trap "rm -rf $tmpscript" INT QUIT TERM STOP EXIT
 echo "#!/bin/bash " > $tmpscript
-tr '\0' '\n' </proc/$(pgrep tz-launcher -u guest)/environ | awk 'FS="=" {if ($1 != "_") { print "export",$0;} }' >> $tmpscript
+tr '\0' '\n' </proc/$(pgrep $process -u $user)/environ | awk 'FS="=" {if ($1 != "_") { print "export",$0;} }' >> $tmpscript
 echo export PATH=$QAPATH:\$PATH >> $tmpscript
-#echo env >> $tmpscript
 echo $CMD >> $tmpscript
 chmod 777 $tmpscript
-su - guest -c $tmpscript
+
+su - $user -c $tmpscript
+
 if [ $? -eq 0 ]; then
        exit 0
 else
diff --git a/TESTDIR/util.sh b/TESTDIR/util.sh
new file mode 100644 (file)
index 0000000..6c4f370
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/bash
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Authors: Nicolas Zingile <nicolas.zingile@open.eurogiciel.org>
+
+
+#--- some util functions to retrieve test user ---#
+
+function gettestuser()
+{
+    local testuser=""
+
+    if [[ -n $(getent passwd guest) ]]; then
+       testuser=guest
+    elif [[ -n $(getent passwd app) ]]; then
+       testuser=app
+    else
+       echo "No suitable user" && exit 1
+    fi
+
+    echo $testuser 
+}
+
+function gettestprocess ()
+{
+    local testprocess=""
+    
+    if [[ -z $1 ]]; then
+       echo "A user should be defined" && exit 1
+    else
+       case $1 in
+           "guest")
+               testprocess=tz-launcher
+               ;;
+           "app")
+               testprocess=weston-desktop
+               ;;
+           *)
+               echo "Cannot get the process" && exit 1
+       esac
+       echo $testprocess
+    fi
+}