Woojoong Kim | 2fce4fa | 2017-11-14 14:16:13 -0800 | [diff] [blame] | 1 | #! /bin/bash |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | source ../config/cp_config.cfg |
| 17 | |
| 18 | APP_PATH="./build" |
| 19 | APP="ngic_controlplane" |
| 20 | |
| 21 | ARGS="-c {{ cpu_hexacode }} -n 4 --socket-mem $MEMORY,0 --file-prefix cp --no-pci -- \ |
| 22 | -s $S11_SGW_IP \ |
| 23 | -m $S11_MME_IP \ |
| 24 | -w $S1U_SGW_IP \ |
| 25 | -i $IP_POOL_IP \ |
| 26 | -p $IP_POOL_MASK \ |
| 27 | -a $APN" |
| 28 | |
| 29 | USAGE=$"Usage: run.sh [ debug | log ] |
| 30 | debug: executes $APP under gdb |
| 31 | log: executes $APP with logging enabled to date named file under |
| 32 | $APP_PATH/logs. Requires Control-C to exit even if $APP exits" |
| 33 | |
| 34 | if [ -z "$1" ]; then |
| 35 | |
| 36 | $APP_PATH/$APP $ARGS |
| 37 | |
| 38 | elif [ "$1" == "log" ]; then |
| 39 | |
| 40 | if [ "$#" -eq "2" ]; then |
| 41 | FILE="${FILE/.log/.$2.log}" |
| 42 | echo "logging as $FILE" |
| 43 | fi |
| 44 | trap "killall $APP; exit" SIGINT |
| 45 | stdbuf -oL -eL $APP_PATH/$APP $ARGS </dev/null &>$FILE & tail -f $FILE |
| 46 | |
| 47 | elif [ "$1" == "debug" ];then |
| 48 | |
| 49 | GDB_EX="-ex 'set print pretty on'" |
| 50 | gdb $GDB_EX --args $APP_PATH/$APP $ARGS |
| 51 | |
| 52 | else |
| 53 | echo "$USAGE" |
| 54 | fi |