From 7af0ea1e884b8bd573a06e3194f9e9192c0555d7 Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Mon, 27 Jul 2020 12:04:12 +0200 Subject: [PATCH] TT#81700 run_tests.sh: -k option to capture pcap per scenario * bench.sh -K and -k options for capture Change-Id: Id2d0213e2c53f43b927ca9912a71471563466ac7 --- bench.sh | 14 +++++++++++++- run_tests.sh | 9 +++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/bench.sh b/bench.sh index 1f04135d..d89a96e4 100755 --- a/bench.sh +++ b/bench.sh @@ -2,21 +2,27 @@ SKIP_CONFIG=false PROFILE="${PROFILE:-}" GROUP="${GROUP:-scenarios}" +CAPTURE=false +SINGLE_CAPTURE=false usage() { echo "Usage: bench.sh [-p PROFILE] [-C] [num_runs]" echo "Options:" echo -e "\\t-p CE|PRO default is autodetect" echo -e "\\t-C skips configuration of the environment" + echo -e "\\t-k capture messages with tcpdump, per scenario" + echo -e "\\t-K capture messages with tcpdump. One big file for all scenarios" echo -e "\\t-x set GROUP scenario. Default: scenarios" echo -e "\\t-h this help" echo -e "num_runs default is 20" } -while getopts 'hCp:x:' opt; do +while getopts 'hCkKp:x:' opt; do case $opt in h) usage; exit 0;; C) SKIP_CONFIG=true;; + k) SINGLE_CAPTURE=true;; + K) CAPTURE=true;; p) PROFILE=${OPTARG};; x) GROUP=${OPTARG};; *) echo "Unknown option $opt"; usage; exit 1;; @@ -44,6 +50,12 @@ fi NUM=${1:-20} RUN_OPS=(-C -c -r -p"${PROFILE}" -x"${GROUP}") +if "${CAPTURE}" ; then + RUN_OPS+=(-K) +elif "${SINGLE_CAPTURE}" ; then + RUN_OPS+=(-k) +fi + # clean previous rm -rf log_* result_* diff --git a/run_tests.sh b/run_tests.sh index d513431a..3a4edc30 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -22,6 +22,7 @@ TIMEOUT=${TIMEOUT:-300} SHOW_SCENARIOS=false SKIP_CONFIG=false CAPTURE=false +SINGLE_CAPTURE=false FIX_RETRANS=false MEMDBG=false CDR=false @@ -226,7 +227,8 @@ usage() { echo -e "\\t-p CE|PRO default is autodetect" echo -e "\\t-l print available SCENARIOS in GROUP" echo -e "\\t-C skips configuration of the environment" - echo -e "\\t-K capture messages with tcpdump" + echo -e "\\t-k capture messages with tcpdump, per scenario" + echo -e "\\t-K capture messages with tcpdump. One big file for all scenarios" echo -e "\\t-x set GROUP scenario. Default: scenarios" echo -e "\\t-t set timeout in secs for pid_watcher.py [PRO]. Default: 300" echo -e "\\t-r fix retransmission issues" @@ -238,12 +240,13 @@ usage() { echo "BIN_DIR:${BIN_DIR}" } -while getopts 'hlCcp:Kx:t:rm' opt; do +while getopts 'hlCcp:kKx:t:rm' opt; do case $opt in h) usage; exit 0;; l) SHOW_SCENARIOS=true;; C) SKIP_CONFIG=true;; p) PROFILE=${OPTARG};; + k) SINGLE_CAPTURE=true;; K) CAPTURE=true;; x) GROUP=${OPTARG};; t) TIMEOUT=${OPTARG};; @@ -362,6 +365,8 @@ fi if "${CAPTURE}" ; then capture +elif "${SINGLE_CAPTURE}" ; then + OPTS+=(-K) fi for t in "${SCEN[@]}"; do