Commit Graph

18 Commits

Author SHA1 Message Date
Vadim Yanitskiy 80726d8e8f fixup: ttcn3-tcpdump*.sh: Fix output of special chars
On ArchLinux /bin/sh is actually a symlink to bash, so bash is running
in limited mode and emulating the Bourne Shell.  The shell detection
logic added in [1] does not work correctly for me because the cmdline
would be 'sh' or '/bin/sh', not 'bash'.  This is what I am getting:

  \033[1;32m====== FooBar_Tests.TC_foo_bar pass ======\033[0m

Let's switch to printf, which does interpret the backslash escapes
as expected by default, regardless of the actual shell in use.

Also fix ttcn3-dumpcap-stop.sh, which was left untouched by [1].

Change-Id: Id28193a7ca00b5501a6852e5b4a5412fbaa5e063
Fixes: [1] bf45a5cff8
2022-12-20 15:05:55 +00:00
arehbein e66c1f8e5a ttcn3-tcpdump*.sh: Fix tcpdump procs not being killed
Also: Fix possibly empty files not being deleted.

Fixes: cf8c450ed5
Fixes: OS#5796
Change-Id: I4e17d8313755c36f130982c921abf69d78c98ae6
2022-11-28 22:52:52 +01:00
arehbein be074e1964 ttcn3-tcpdump-stop.sh: Don't use lsof
`lsof` isn't available in the docker image, use /proc fs instead to get
the shell type

Related: OS#5736
Change-Id: I38e132f49b0711d611d08b61c28b3092c991a191
2022-11-25 23:35:51 +01:00
arehbein bf45a5cff8 ttcn3-tcpdump*.sh: Fix output of special chars
Don't print '-e' option in non-bash shells.

Related: OS#5736
Change-Id: Idac0f902d2f5eb142a3f130409451c8f77b111f6
2022-11-25 23:35:36 +01:00
arehbein bc85a324be ttcn3-tcpdump*.sh: Log stderr separately to file
The old output is preserved, too, in order to ensure
compatibility with expectations regarding legacy behavior.

Related: OS#5736

Change-Id: Ia92ff32c8ce09ab7805c5509837ec88fa4b864c5
2022-11-25 23:26:06 +01:00
arehbein cf8c450ed5 ttcn3-tcpdump*.sh: Fix scripts hanging on sudo prompt
Related: OS#5736

Change-Id: I05687f9bc0bb87c6f1d5c42ba235dbb90a49aeb6
2022-11-25 16:22:00 +01:00
Oliver Smith 9678c22cec ttcn3-tcpdump-stop: add timeout for talloc report
Prevent the script from idling for several minutes without any output if
obtaining the talloc report does not work. It seems to get killed
eventually, but trying for 5s should be enough.

Change-Id: I1bc5baeb94ecd25e1cdab98b060b99747c19d1f9
2021-12-17 12:25:29 +01:00
Vadim Yanitskiy 23d6665945 ttcn3-tcpdump-stop.sh: order the SUT to print talloc report
The idea is to generate a talloc report after execution of a test
case and store it together with PCAP files.  This might be useful
for detecting memory leaks and finding the relevant test cases.

To enable this feature, make sure that osmo_interact_vty.py from
osmo-python-tests is installed (see [1]), and the following
variables are set (see [2]):

* OSMO_SUT_HOST (e.g. "127.0.0.1"), and
* OSMO_SUT_PORT (e.g. 4242).

Change-Id: I1b03b17426d8760c55976e3b78ca2f3af248c055
Depends: [1] Ida8e08e7fe4f171f934a2d4eef4568da7c398f5c
Related: [2] Icd4c2d80db934535d499598282ed9416d8088163
Related: OS#5328
2021-11-30 18:25:49 +03:00
Vadim Yanitskiy eb662c87e2 fixup ttcn3-tcpdump-stop.sh: add flag '--force' to gzip
When a directory path for the "build artifacts" is not specified,
'/tmp' would be used by default.  When running the same text
case more than once, gzip will be asking for confirmation whether
to overwrite the existing capture file.  Let's do this by default.

Change-Id: I357f3d9c5dc5963f4b709166bb659f3f66a721b8
2020-07-13 05:55:17 +07:00
Vadim Yanitskiy f949f465ba ttcn3-tcpdump-stop.sh: compress capture files with gzip
Since we have enabled the GSMTAP logging, test case capture files
now contain a lot of textual information that can be efficiently
compressed with gzip.  That would make the "Build artifacts"
take much less space on Jenkins.

Change-Id: Ibdf5312bb9ff802d7ce7d00c690facdd79839782
2020-07-12 15:57:33 +07:00
Vadim Yanitskiy aa94d32fa2 ttcn3-tcpdump-stop.sh: fix echo: add -e to enable colors
This change enables interpretation of backslash escapes for echo,
so the test case execution summary is always printed in color.

Change-Id: I0cc77b4de764c7afd6416512a181c4c1610ce369
2020-05-21 20:36:37 +07:00
Pau Espin ad931f236b Create dummy gsmtap sink with netcat
otherwise ICMP messages appear in pcap files and some messages are lost
since they seem to be dropped by the kernel.

Change-Id: Id69d98db63f8260067ad6bc1525fb05c936912f2
2019-10-04 16:09:27 +00:00
Max 81487c8b36 Use dumpcap for ttcn3-tcpdump-*.sh if available
Check if dumpcap is installed (either as suid or with appropriate
capabilities) and use it for packet capture instead of
'sudo tcpdump' if available. This makes it easier to use TTCN-3
testsuite as regular user without altering sudoers.

Change-Id: I77df04d51a469c924cf727f0596cc33565909746
2019-03-19 10:28:46 +00:00
Max e521445fee Generalize ttcn3-tcpdump-*.sh
Prepare for supporting alternative packet dumpers:
* reword comments
* rename pidfile
* move tcpdump-specific option inside if
* move comment about sudo closer to actual sudo invocation

Those are cosmetic changes which do not affect how packet dump is made
but makes it easier to support alternative packet dumpers in follow-up
commit.

Change-Id: Ib2528db65348c0422fe8b7c7c53656fbce4f6405
2019-03-14 20:46:51 +00:00
Neels Hofmeyr ced8acf305 log time in tcpdump-start and -stop.sh
Also log the testcase name in tcpdump-start.sh.

The output now looks like

    ------ MSC_Tests.TC_mo_cc_bssmap_clear ------
    Thu Mar  7 13:21:00 UTC 2019
    [...]
    Thu Mar  7 13:21:04 UTC 2019
    ====== MSC_Tests.TC_mo_cc_bssmap_clear pass ======

The reason to log start and end dates came up like this: I noticed a segfault
in a tested program at a specific time. From the timestamp I tried to find out
which of the tests saw the failure. (After a segfault, all subsequent tests run
and fail, but it is not obvious which failure occured because of a segfault,
and which ones just normally failed before that.) Looking at the timestamps of
the log files didn't help, because the ttcn3_logmerge touched those after the
tests completed. So the only way is to cat each individual log file and find
the timestamp.

So this adds an overview of the timestamps without needing to open log files.

Change-Id: I0832d9b5df599baad5dec8d3a993481b4286fbb3
2019-03-07 16:33:03 +01:00
Neels Hofmeyr dadde17425 ttcn3-tcpdump-stop.sh: print colored verdict
Change-Id: I0d2d6171430f1eebb5377edac5e237a99ddbd743
2018-06-23 11:43:00 +00:00
Pau Espin dada4c5a55 ttcn3-tcpdump-stop.sh: Wait to receive last packets before stopping tcpdump
There's a time delay between packets are sent through the system and
tcpdump reads, buffers and stores them into the pcap file. We need to
give it more time to process everything before killing it, otherwise
last (or all) packets from the test are not captured.

Change-Id: I240d8f1bdb2ca6ad353e60ef15937dc2bd4cbebd
2018-02-15 17:22:52 +00:00
Harald Welte e057146df7 re-organize configuration files; add tcpdump integration
Let's make sure we share common configuration between the test
suites and split the config file into a "default" part which is
used (but not copied) in the Docker images, and a "local" part
which is basically those overrides that the user (or docker image)
wants to do from the default.

Change-Id: I3db452e24e5238aa05254d903739c64d202e61db
2018-02-14 18:50:16 +01:00