Skip to content

Commit

Permalink
Add shell formatting to pull_request.yml (#14)
Browse files Browse the repository at this point in the history
* Add shell formatting to pull_request.yml
* Apply formatting
  • Loading branch information
krsna1729 committed Nov 14, 2019
1 parent 8f746cf commit b79e033
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 42 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ jobs:
wget https://raw.githubusercontent.com/NetSys/bess/master/core/.clang-format
clang-format -style=file -i $SRC
rm .clang-format
- name: Shell Format
run: |
wget -qO shfmt https://github.com/mvdan/sh/releases/download/v2.6.4/shfmt_v2.6.4_linux_amd64
chmod +x shfmt && sudo mv shfmt /bin
shfmt -w -l .
- name: Commit and push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git
git config --global user.email "actions@github"
git config --global user.name "Github Actions"
hub commit -a -m "Apply clang-format" && hub push || echo "Nothing to commit"
hub commit -a -m "Apply formatting" && hub push || echo "Nothing to commit"
4 changes: 2 additions & 2 deletions core/utils/gtp_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ struct ipcan_dp_bearer_cdr {
* the bearer relates to*/
char sponsor_id[MAX_DNS_SPON_ID_LEN]; /* to identify the 3rd party
* organization (the sponsor)
* willing to pay for the operator's
* charge*/
* willing to pay for the
* operator's charge*/
struct service_data_list service_data_list; /* List of service*/
uint32_t rating_group; /* rating group of this bearer*/
uint64_t vol_threshold; /* volume threshold in MBytes*/
Expand Down
13 changes: 6 additions & 7 deletions docker_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ nhmacaddrs=(68:05:ca:31:fa:7a 68:05:ca:31:fa:7b)
# In the order of ("{r-s1u}" "{r-sgi}")
routes=("11.1.1.128/27 11.1.1.160/27 11.1.1.192/27 11.1.1.224/27" "13.1.1.128/27 13.1.1.160/27 13.1.1.192/27 13.1.1.224/27")


num_ifaces=${#ifaces[@]}
num_ipaddrs=${#ipaddrs[@]}

# Set up static route and neighbor table entries of the SPGW
function setup_trafficgen_routes() {
for ((i = 0; i < num_ipaddrs; i++)); do
sudo ip netns exec bess ip neighbor add "${nhipaddrs[$i]}" lladdr "${nhmacaddrs[$i]}" dev "${ifaces[$i%num_ifaces]}"
sudo ip netns exec bess ip neighbor add "${nhipaddrs[$i]}" lladdr "${nhmacaddrs[$i]}" dev "${ifaces[$i % num_ifaces]}"
routelist=${routes[$i]}
for route in $routelist; do
sudo ip netns exec bess ip route add "$route" via "${nhipaddrs[$i]}"
Expand All @@ -61,9 +60,9 @@ function setup_trafficgen_routes() {
}

# Assign IP address(es) of gateway interface(s) within the network namespace
function setup_addrs(){
function setup_addrs() {
for ((i = 0; i < num_ipaddrs; i++)); do
sudo ip netns exec bess ip addr add "${ipaddrs[$i]}" dev "${ifaces[$i%$num_ifaces]}"
sudo ip netns exec bess ip addr add "${ipaddrs[$i]}" dev "${ifaces[$i % $num_ifaces]}"
done
}

Expand Down Expand Up @@ -146,6 +145,6 @@ docker run --name bess-web -d --restart unless-stopped \

# Run bess-cpiface
docker run --name bess-cpiface -td --restart unless-stopped \
--net container:bess \
--entrypoint zmq-cpiface \
cpiface
--net container:bess \
--entrypoint zmq-cpiface \
cpiface
64 changes: 32 additions & 32 deletions tests/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,46 @@ TMUX2=2:0.0
ILTRAFFICGEN_PATH=~/il_trafficgen/pktgen

function SET_VAL() {
sed_cmd="s/$1=/$1=$2\#/g"
sed -i -e $sed_cmd ${ILTRAFFICGEN_PATH}/autotest/user_input.cfg
sed_cmd="s/$1=/$1=$2\#/g"
sed -i -e $sed_cmd ${ILTRAFFICGEN_PATH}/autotest/user_input.cfg
}

for ((i = 0; i < num_entries; i++)); do
for ((j = 0; j < num_subs; j++)); do
SET_VAL "pps" "${PPS[$i]}"
SET_VAL "pkt_size" "${PKTSIZE[$i]}"
SET_VAL "flows" "${SUBS[$j]}"
for ((j = 0; j < num_subs; j++)); do
SET_VAL "pps" "${PPS[$i]}"
SET_VAL "pkt_size" "${PKTSIZE[$i]}"
SET_VAL "flows" "${SUBS[$j]}"

source ${ILTRAFFICGEN_PATH}/autotest/user_input.cfg
source ${ILTRAFFICGEN_PATH}/autotest/user_input.cfg

sudo rm -rf ${ILTRAFFICGEN_PATH}/autotest/log/*
sudo rm -rf ${ILTRAFFICGEN_PATH}/autotest/log/*

# Spawn processes
tmux send-keys -t $TMUX1 './il_nperf.sh -g' Enter &
sleep $INIT_TIME
tmux send-keys -t $TMUX2 './il_nperf.sh -r' Enter &
sleep $INIT_TIME
# Spawn processes
tmux send-keys -t $TMUX1 './il_nperf.sh -g' Enter &
sleep $INIT_TIME
tmux send-keys -t $TMUX2 './il_nperf.sh -r' Enter &
sleep $INIT_TIME

# Start pktgen
tmux send-keys -t $TMUX2 'start 0' &
tmux send-keys -t $TMUX1 'start 0' &
tmux send-keys -t $TMUX2 ' ' Enter &
tmux send-keys -t $TMUX1 ' ' Enter &
tmux send-keys -t $TMUX2 ' ' Enter &
tmux send-keys -t $TMUX1 ' ' Enter &
sleep $TEST_DURATION
# Start pktgen
tmux send-keys -t $TMUX2 'start 0' &
tmux send-keys -t $TMUX1 'start 0' &
tmux send-keys -t $TMUX2 ' ' Enter &
tmux send-keys -t $TMUX1 ' ' Enter &
tmux send-keys -t $TMUX2 ' ' Enter &
tmux send-keys -t $TMUX1 ' ' Enter &
sleep $TEST_DURATION

# Quit processes
tmux send-keys -t $TMUX1 'quit' &
tmux send-keys -t $TMUX1 ' ' Enter &
tmux send-keys -t $TMUX2 'quit' &
tmux send-keys -t $TMUX2 ' ' Enter &
sleep $DEINIT_TIME
# Quit processes
tmux send-keys -t $TMUX1 'quit' &
tmux send-keys -t $TMUX1 ' ' Enter &
tmux send-keys -t $TMUX2 'quit' &
tmux send-keys -t $TMUX2 ' ' Enter &
sleep $DEINIT_TIME

tmux send-keys -t $TMUX1 ' ' Enter &
tmux send-keys -t $TMUX2 ' ' Enter &
tmux send-keys -t $TMUX1 ' ' Enter &
tmux send-keys -t $TMUX2 ' ' Enter &

sudo mv ${ILTRAFFICGEN_PATH}/autotest/log/* ${ILTRAFFICGEN_PATH}/autotest/trial_${SUBS[$j]}_${PPS[$i]}_${PKTSIZE[$i]}.log
cp ${ILTRAFFICGEN_PATH}/autotest/user_input.cfg.bk ${ILTRAFFICGEN_PATH}/autotest/user_input.cfg
done
sudo mv ${ILTRAFFICGEN_PATH}/autotest/log/* ${ILTRAFFICGEN_PATH}/autotest/trial_${SUBS[$j]}_${PPS[$i]}_${PKTSIZE[$i]}.log
cp ${ILTRAFFICGEN_PATH}/autotest/user_input.cfg.bk ${ILTRAFFICGEN_PATH}/autotest/user_input.cfg
done
done

0 comments on commit b79e033

Please sign in to comment.