Commit Graph

6 Commits

Author SHA1 Message Date
Alexander Couzens d1f4095df8 ttcn3-tcpdump-start.sh: reduce snaplen of tcpdump
Improve speed of tcpdump startup. -s 0 sets the snaplen is 256k.
tcpdump will request the snaplen multiplied by the buffer as
a contigous buffer in the kernel. This could lead to higher
start time.

Change-Id: I8a372e71798b366faa3b723573c60de6e8fd128f
2018-05-15 20:54:54 +00:00
Harald Welte d71c343818 ttcn3-tcpdump-start.sh: Don't call tcpdump log files ".log"
The problem is that we use ttcn3_logmerge FOO_Tests.*.log and that the
tcpdump stdout log files also match this pattern.  Call them
.pcap.stdout in order to avoid them falling into the globbing pattern of
the TITAN log files.

Change-Id: Iac1ae217b006182121d86375ffa4d3c00ef37e8b
2018-02-18 14:14:44 +01:00
Pau Espin 8fdd3130fe ttcn3-tcpdump-start.sh: Wait for tcpdump to start recording
We generate some fake transit and we wait until we catch tcpdump already
saved some packet into the pcap file, this way making sure it is already
recording before starting the test.

The -U flag (--packet-buffered) is added to increase the chances to
sleep less time waiting for stuff being saved into the pcap file.
According to tcpdump manual:
"""
If  the  -w option is specified, make the saved raw packet output ``packet-buffered''; i.e., as each packet is saved, it will
              be written to the output file, rather than being written only when the output buffer fills.
"""

Change-Id: I91cfd84ff5356857a13af1901abfe2204a93f76d
2018-02-15 17:22:52 +00:00
Pau Espin b01d313b83 ttcn3-tcpdump-start.sh: Wait for pcap file creation to start test
It was spotted in the jenkins artficats that pcap files for some tests
are missing. It is probably due to the fact that tcpdump is started in
the background and immediately after the test is started. Some tests are
really quick, which means they are executing before tcpdump starts
creating the file and recording.
While still having the file created doesn't mean tcpdump is already
recording, we at least ensure the file is created and we can see it's
empty at the end. Running this patch in my PC indeed shows that usually
the pcap file is not created immediately after and it waits for 1 second
to continue.

The hack to make sure tcpdump is already recording before starting the
test is to create some traffic (ie ping 127.0.0.1) and then check the
following condition: $(tcpdump -r file.pcap | wc -l) -gt 0

Change-Id: I17a456a27c8e33571f333f4b7efdf61161ebb174
2018-02-15 17:22:52 +00:00
Pau Espin ef59855ac7 ttcn3-tcpdump-start.sh: Log tcpdump output to file
This can be useful in case there was an error in tcpdump, or to make
sure no packets were lost while capturing.

Change-Id: I8d7570bba3c21c017ba38d36185f6ae042967599
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