#!/bin/bash # Authors: # Kangho Kim , Yoonki Park # # Description: front hand of app launcher APP_PATH_PREFIX=/opt/apps SDK_TOOLS_PATH=/home/developer/sdk_tools print_usage() { echo "usage: $0 -p -e -m [-P ] [-attach ] -t []" } 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 launch_app_mode="__LAUNCH_APP_MODE__ SYNC" result_mode="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 launch_app_mode="__LAUNCH_APP_MODE__ SYNC" result_mode="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 if [ "" != "$result_mode" ] then result_mode="DEBUG,$result_mode" else result_mode="DEBUG" fi cmd="/usr/bin/launch_app $pkgid.$exe __AUL_SDK__ $result_mode __DLP_DEBUG_ARG__ :$port $launch_app_mode $args" # 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 $launch_app_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" fi fi # execute command $cmd $args