blob: 2323a5ad7d9a11f945fd69a85c115adb537645db [file] [log] [blame]
Woojoong Kim2fce4fa2017-11-14 14:16:13 -08001#! /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
16source ../config/cp_config.cfg
17
18APP_PATH="./build"
19APP="ngic_controlplane"
20
21ARGS="-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
29USAGE=$"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
34if [ -z "$1" ]; then
35
36 $APP_PATH/$APP $ARGS
37
38elif [ "$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
47elif [ "$1" == "debug" ];then
48
49 GDB_EX="-ex 'set print pretty on'"
50 gdb $GDB_EX --args $APP_PATH/$APP $ARGS
51
52else
53 echo "$USAGE"
54fi