osmith has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/41206?usp=email )
Change subject: testenv: add a --fast argument ......................................................................
testenv: add a --fast argument
The ttcn3-{tcpdump,dumpcap}-*.sh scripts can easily spend 5s or more for each test with: * Waiting until the pcap gets created. * Waiting until pcap size does not increase anymore after the test. * Saving the talloc report.
Add --fast to skip all this, to allow running a whole testsuite significantly faster locally to check for regressions. Developers can then still run failing tests again without --fast to get the pcap and talloc reports.
Change-Id: Ief3488293e5c5c1a1c98244f80ffd56eadb040c5 --- M _testenv/testenv/__init__.py M _testenv/testenv/testsuite.py M ttcn3-dumpcap-start.sh M ttcn3-dumpcap-stop.sh M ttcn3-tcpdump-start.sh M ttcn3-tcpdump-stop.sh 6 files changed, 35 insertions(+), 12 deletions(-)
Approvals: osmith: Looks good to me, approved Jenkins Builder: Verified fixeria: Looks good to me, but someone else must approve jolly: Looks good to me, but someone else must approve
diff --git a/_testenv/testenv/__init__.py b/_testenv/testenv/__init__.py index c9e63b4..44259c2 100644 --- a/_testenv/testenv/__init__.py +++ b/_testenv/testenv/__init__.py @@ -112,6 +112,12 @@ "--titan-version", help="which eclipse-titan version to use", ) + group.add_argument( + "-f", + "--fast", + action="store_true", + help="skip recording pcaps (+ sleep before/after) and talloc reports", + )
group = sub_run.add_argument_group("source/binary options", "All components are built from source by default.") group.add_argument( diff --git a/_testenv/testenv/testsuite.py b/_testenv/testenv/testsuite.py index 0007c57..97a340e 100644 --- a/_testenv/testenv/testsuite.py +++ b/_testenv/testenv/testsuite.py @@ -151,6 +151,9 @@ env["OSMO_SUT_HOST"] = host env["OSMO_SUT_PORT"] = port
+ if testenv.args.fast: + env["TESTENV_FAST"] = "1" + env = testenv.cmd.generate_env(env, testenv.args.podman)
cmd = [start_testsuite, suite, section_data["config"]] diff --git a/ttcn3-dumpcap-start.sh b/ttcn3-dumpcap-start.sh index 4bdd3ec..d0b31ad 100755 --- a/ttcn3-dumpcap-start.sh +++ b/ttcn3-dumpcap-start.sh @@ -18,6 +18,10 @@ echo "------ $TESTCASE ------" date
+if [ "$TESTENV_FAST" = 1 ]; then + exit 0 +fi + if [ "z$TTCN3_PCAP_PATH" = "z" ]; then TTCN3_PCAP_PATH=/tmp/pcap mkdir -p "$TTCN3_PCAP_PATH" diff --git a/ttcn3-dumpcap-stop.sh b/ttcn3-dumpcap-stop.sh index 1ac8e7b..8c5d347 100755 --- a/ttcn3-dumpcap-stop.sh +++ b/ttcn3-dumpcap-stop.sh @@ -15,6 +15,10 @@ printf "\033[1;31m------ $TESTCASE $VERDICT ------\033[0m\n\n" fi
+if [ "$TESTENV_FAST" = 1 ]; then + exit 0 +fi + if [ "z$TTCN3_PCAP_PATH" = "z" ]; then TTCN3_PCAP_PATH=/tmp fi diff --git a/ttcn3-tcpdump-start.sh b/ttcn3-tcpdump-start.sh index 4b5244c..d193b1d 100755 --- a/ttcn3-tcpdump-start.sh +++ b/ttcn3-tcpdump-start.sh @@ -11,7 +11,14 @@ GSMTAP_PORT=4729
TESTCASE=$1 +echo "$TESTCASE" > "$TTCN3_PCAP_PATH/.current_test"
+echo "------ $TESTCASE ------" +date + +if [ "$TESTENV_FAST" = 1 ]; then + exit 0 +fi
SUDOSTR="" if ! [ "$(id -u)" = "0" ]; then @@ -20,9 +27,6 @@ # and this script will hang indefinitely fi
-echo "------ $TESTCASE ------" -date - if [ "z$TTCN3_PCAP_PATH" = "z" ]; then TTCN3_PCAP_PATH=/tmp/pcap mkdir -p "$TTCN3_PCAP_PATH" @@ -112,5 +116,3 @@ fi done kill $PID - -echo "$TESTCASE" > "$TTCN3_PCAP_PATH/.current_test" diff --git a/ttcn3-tcpdump-stop.sh b/ttcn3-tcpdump-stop.sh index 65aeb2a..41d29ec 100755 --- a/ttcn3-tcpdump-stop.sh +++ b/ttcn3-tcpdump-stop.sh @@ -8,13 +8,6 @@ TESTCASE=$1 VERDICT="$2"
-SUDOSTR="" -if ! [ "$(id -u)" = "0" ]; then - SUDOSTR="sudo -n" - # Otherwise, if sudo /usr/bin/kill, sudo /usr/bin/tcpdump cannot be run without a password prompt, - # and this script will hang indefinitely -fi - date
if [ x"$VERDICT" = x"pass" ]; then @@ -23,6 +16,17 @@ printf "\033[1;31m------ $TESTCASE $VERDICT ------\033[0m\n\n" fi
+if [ "$TESTENV_FAST" = 1 ]; then + exit 0 +fi + +SUDOSTR="" +if ! [ "$(id -u)" = "0" ]; then + SUDOSTR="sudo -n" + # Otherwise, if sudo /usr/bin/kill, sudo /usr/bin/tcpdump cannot be run without a password prompt, + # and this script will hang indefinitely +fi + if [ "z$TTCN3_PCAP_PATH" = "z" ]; then TTCN3_PCAP_PATH=/tmp fi