[Title] add sdk_launch script
authorho.namkoong <ho.namkoong@samsung.com>
Wed, 19 Jun 2013 12:53:22 +0000 (21:53 +0900)
committerho.namkoong <ho.namkoong@samsung.com>
Fri, 21 Jun 2013 11:23:54 +0000 (20:23 +0900)
[Type]
[Module]
[Priority]
[CQ#]
[Redmine#] 9670
[Problem]
[Cause]
[Solution]
[TestCase]

Change-Id: Ib5a7ae171186c8011b519d3d9c0b98d8a036bc92

Makefile
packaging/sdbd.spec
sdk_launch [new file with mode: 0755]

index 46c60ab..93091ab 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -95,6 +95,7 @@ OBJDIR := bin
 INSTALLDIR := usr/sbin
 INITSCRIPTDIR := etc/init.d
 RCSCRIPTDIR := etc/rc.d/rc3.d
+LAUNCH_SCRIPT := sdk_launch
 
 UNAME := $(shell uname -sm)
 ifneq (,$(findstring 86,$(UNAME)))
@@ -130,6 +131,7 @@ sdbd : $(SDBD_SRC_FILES)
 install :
        mkdir -p $(DESTDIR)/$(INSTALLDIR)
        install $(OBJDIR)/$(MODULE) $(DESTDIR)/$(INSTALLDIR)/$(MODULE)
+       install $(LAUNCH_SCRIPT) $(DESTDIR)/$(INSTALLDIR)/$(LAUNCH_SCRIPT)
 ifeq ($(MODULE),sdbd)
        mkdir -p $(DESTDIR)/$(INITSCRIPTDIR)
        install script/sdbd $(DESTDIR)/$(INITSCRIPTDIR)/sdbd
index e0640ac..de0e9f2 100644 (file)
@@ -37,6 +37,7 @@ chsmack -t /home/developer
 %manifest sdbd.manifest
 %defattr(-,root,root,-) 
 %{_prefix}/sbin/sdbd
+%{_prefix}/sbin/sdk_launch
 %{_sysconfdir}/init.d/sdbd
 
 %ifarch %{ix86}
diff --git a/sdk_launch b/sdk_launch
new file mode 100755 (executable)
index 0000000..10b2310
--- /dev/null
@@ -0,0 +1,154 @@
+#!/bin/bash
+
+# Authors:
+#      Kangho Kim <kh5325.kim@samsung.com>, Yoonki Park <yoonki.park@samsung.com>
+#
+# Description: front hand of app launcher
+
+APP_PATH_PREFIX=/opt/apps
+SDK_TOOLS_PATH=/home/developer/sdk_tools
+
+print_usage()
+{
+    echo "usage: $0 -p <pkgid> -e <executable> -m <run|debug|da|oprofile> [-P <port>] [-attach <pid>] -t <gtest,gcov> [<args...>]"
+}
+
+first="true"
+
+until [ -z "$1" ]; do
+    case "$1" in
+    -p)
+        if [ -z "$2" ]
+        then
+            print_usage
+            exit 1;
+        fi
+        pkgid=$2
+        shift 2;
+        ;;
+    -e)
+        if [ -z "$2" ]
+        then
+            print_usage
+            exit 1;
+        fi
+        exe=${2/%.exe/}
+        shift 2;
+        ;;
+    -m)
+        if [ "$2" != "run" ] && [ "$2" != "debug" ] && [ "$2" != "da" ] && [ "$2" != "oprofile" ]
+        then
+            print_usage
+            exit 1;
+        fi
+        mode=$2
+        shift 2;
+        ;;
+    -P)
+        if [ -z "$2" ]
+        then
+            print_usage
+            exit 1;
+        fi
+        port=$2
+        shift 2;
+        ;;
+    -attach)
+        if [ -z "$2" ]
+        then
+            print_usage
+            exit 1;
+        fi
+        attach_id=$2
+        shift 2;
+        ;;
+    -t)
+        if [ "$2" = "" ] || [ ${2:0:1} = "-" ]
+        then
+            shift 1;
+        else
+# parse -t option
+        OLD_IFS=$IFS;IFS=,;
+        for type in $2;do
+            if [ "$type" = "gtest" ]
+            then
+                COV_TEST_PREFIX="export LD_LIBRARY_PATH=%s/gtest/usr/lib && $COV_TEST_PREFIX"
+                if [ "" != "$result_mode" ]
+                then
+                    result_mode="$result_mode,UNIT_TEST"
+                else
+                    result_mode="OPROFILE,UNIT_TEST"
+                fi
+            fi
+            if [ "$type" = "gcov" ]
+            then
+                COV_TEST_PREFIX="export GCOV_PREFIX=/tmp/%s/data && export GCOV_PREFIX_STRIP=0 && $COV_TEST_PREFIX"
+                if [ "" != "$result_mode" ]
+                then
+                    result_mode="$result_mode,CODE_COVERAGE"
+                else
+                    result_mode="OPROFILE,CODE_COVERAGE"
+                fi
+            fi
+        done;
+        IFS=$OLD_IFS
+
+        shift 2;
+        fi
+        ;;
+    *)
+        if [ "$first" = "true" ]
+        then
+            first="false"
+            args="__DLP_UNIT_TEST_ARG__ $1"
+        else
+            args="$args","$1"
+        fi
+        shift 1;
+    esac
+done
+
+if [ "$mode" = "debug" ]
+then
+    if [ "" != "$attach_id" ]
+        #debug attach
+        then
+            cmd="$COV_TEST_PREFIX /home/developer/sdk_tools/gdbserver/gdbserver :$port --attach $attach_id"
+    #debug
+    else
+#debugging using debug_launchpad        cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ DEBUG __DLP_DEBUG_ARG__ :$port"
+        cmd="$COV_TEST_PREFIX /home/developer/sdk_tools/gdbserver/gdbserver :$port /opt/apps/$pkgid/bin/$exe"
+    fi
+else
+    if [ "$mode" = "run" ]
+    then
+        if [ "" != "$result_mode" ]
+        then
+            cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ $result_mode $args"
+        else
+            cmd="/usr/bin/launch_app $pkgid.$exe"
+        fi
+    else
+        if [ "$mode" = "da" ]
+        then
+            if [ "" != "$result_mode" ]
+            then
+                result_mode="DYNAMIC_ANALYSIS,$result_mode"
+            else
+                result_mode="DYNAMIC_ANALYSIS"
+            fi
+        fi
+        if [ "$mode" = "oprofile" ]
+        then
+            if [ "" == "$result_mode" ]
+            then
+                result_mode="OPROFILE"
+            fi
+        fi
+        cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ $result_mode $args"
+    fi
+fi
+
+# execute command
+echo $cmd
+#$cmd $args