Enable test.sh to support mono
authorKangho Hur <kangho.hur@samsung.com>
Mon, 5 Sep 2016 05:52:48 +0000 (14:52 +0900)
committerKangho Hur <kangho.hur@samsung.com>
Mon, 5 Sep 2016 05:52:48 +0000 (14:52 +0900)
Change-Id: I33b2dca8a9954ac22bffe84af7234318268cb086

test/ElmSharp.Test/test.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 6e7fb57..976dfd2
@@ -24,6 +24,9 @@ usage() {
   echo "        -b, --build        Build test cases"
   echo "        -i, --install      Install test cases to target device"
   echo "        -r, --install-res  Install resource files for test cases to target device"
+  echo "        -r, --install-res  Install resource files for test cases to target device"
+  echo "        -s, --install-lib  Install System libraries to target device"
+  echo "        -m, --use-mono     Execute test case by using mono instead of corerun"
 }
 
 build() {
@@ -36,8 +39,8 @@ install() {
   sdb root on
   sdb_cmd "rm -fr $TARGET_DIR"
   sdb_cmd "mkdir -p $TARGET_DIR"
-  sdb push $TO_COPY_FILES/*.dll $TARGET_DIR
-  sdb push $TO_COPY_FILES/*.exe $TARGET_DIR
+  sdb push $TO_COPY_FILES/ElmSharp*.dll $TARGET_DIR
+  sdb push $TO_COPY_FILES/ElmSharp*.exe $TARGET_DIR
   exit_on_error $?
 }
 
@@ -49,13 +52,28 @@ install_res() {
   exit_on_error $?
 }
 
+install_lib() {
+  sdb root on
+  sdb_cmd "rm -fr $TARGET_DIR"
+  sdb_cmd "mkdir -p $TARGET_DIR"
+  sdb push $TO_COPY_FILES/System*.dll $TARGET_DIR
+  sdb push $TO_COPY_FILES/Microsoft*.dll $TARGET_DIR
+  exit_on_error $?
+}
+
 run() {
   sdb root on
+  sdb_cmd "/opt/usr/share/tizen.net/corerun $TARGET_DIR/ElmSharp.Test.exe $1"
+  exit_on_error $?
+}
+
+run_mono() {
+  sdb root on
   sdb_cmd "MONO_TRACE_LISTENER=Console.Error mono $TARGET_DIR/ElmSharp.Test.exe $1"
   exit_on_error $?
 }
 
-OPTS=`getopt -o hbir --long help,build,install,install-res -n 'test' -- "$@"`
+OPTS=`getopt -o hbirsm --long help,build,install,install-res,install-lib,use-mono -n 'test' -- "$@"`
 if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; usage; exit 1 ; fi
 eval set -- "$OPTS"
 
@@ -63,6 +81,8 @@ FLAG_HELP=false
 FLAG_BUILD=false
 FLAG_INSTALL=false
 FLAG_INSTALL_RES=false
+FLAG_INSTALL_LIB=false
+FLAG_USE_MONO=false
 
 while true; do
   case "$1" in
@@ -70,6 +90,8 @@ while true; do
     -b|--build) FLAG_BUILD=true; shift ;;
     -i|--install) FLAG_INSTALL=true; shift ;;
     -r|--install-res) FLAG_INSTALL_RES=true; shift ;;
+    -r|--install-lib) FLAG_INSTALL_LIB=true; shift ;;
+    -m|--use-mono) FLAG_USE_MONO=true; shift ;;
     --) shift; break ;;
     *) break ;;
   esac
@@ -80,6 +102,4 @@ if $FLAG_HELP; then usage; exit 1; fi
 if $FLAG_BUILD; then build; fi
 if $FLAG_INSTALL; then install; fi
 if $FLAG_INSTALL_RES; then install_res; fi
-
-run $@
-
+if $FLAG_USE_MONO; then run_mono $@; else run $@; fi