31 Commits

Author SHA1 Message Date
Dave Wallace
8800f732f8 tests: refactor asf framework code
- Make framework.py classes a subset of asfframework.py classes
- Remove all packet related code from asfframework.py
- Add test class and test case set up debug output to log
- Repatriate packet tests from asf to test directory
- Remove non-packet related code from framework.py and
  inherit them from asfframework.py classes
- Clean up unused import variables
- Re-enable BFD tests on Ubuntu 22.04 and fix
  intermittent test failures in echo_looped_back
  testcases (where # control packets verified but
  not guaranteed to be received during test)
- Re-enable Wireguard tests on Ubuntu 22.04 and fix
  intermittent test failures in handshake ratelimiting
  testcases and event testcase
- Run Wiregard testcase suites solo
- Improve debug output in log.txt
- Increase VCL/LDP post sleep timeout to allow iperf server
  to finish cleanly.
- Fix pcap history files to be sorted by suite and testcase
  and ensure order/timestamp is correct based on creation
  in the testcase.
- Decode pcap files for each suite and testcase for all
  errors or if configured via comandline option / env var
- Improve vpp corefile detection to allow complete corefile
  generation
- Disable vm vpp interfaces testcases on debian11
- Clean up failed unittest dir when retrying failed testcases
  and unify testname directory and failed linknames into
  framwork functions

Type: test

Change-Id: I0764f79ea5bb639d278bf635ed2408d4d5220e1e
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2023-11-03 05:06:43 +00:00
Dave Wallace
670724c51e tests: disable failing tests on ubuntu-22.04 debian-11
Type: test

Change-Id: I7b2314a731c83b3dcd69c999edb8ebed53839724
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-09-27 03:26:15 +00:00
Klement Sekera
d9b0c6fbf7 tests: replace pycodestyle with black
Drop pycodestyle for code style checking in favor of black. Black is
much faster, stable PEP8 compliant code style checker offering also
automatic formatting. It aims to be very stable and produce smallest
diffs. It's used by many small and big projects.

Running checkstyle with black takes a few seconds with a terse output.
Thus, test-checkstyle-diff is no longer necessary.

Expand scope of checkstyle to all python files in the repo, replacing
test-checkstyle with checkstyle-python.

Also, fixstyle-python is now available for automatic style formatting.

Note: python virtualenv has been consolidated in test/Makefile,
test/requirements*.txt which will eventually be moved to a central
location.  This is required to simply the automated generation of
docker executor images in the CI.

Type: improvement
Change-Id: I022a326603485f58585e879ac0f697fceefbc9c8
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2022-05-10 18:52:08 +00:00
Dmitry Valter
3ace4d62e2 tests: fix core file message
Prevent crashing on nonexistent VPP binary path class member when creating
testsuite core message.

Type: fix
Fixes: b23ffd7ef216463c35b75c831e6a27e58971f4ec
Signed-off-by: Dmitry Valter <d-valter@yandex-team.ru>
Change-Id: Ib9b3dc8c69317e6561e5404bbdcbf672e417cbcd
2022-03-27 09:21:34 +00:00
Klement Sekera
c0a2f0ec9b tests: support skipping to test method with STEP
Allow entering a test name on stack trace window with STEP=y option
instead of a number. This allows to run a whole suite and skip all tests
until a particular test is hit.

Type: improvement
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: I23e45f8022b82545365b8921390e0e106e02b39c
2022-01-31 14:52:44 +00:00
Paul Vinciguerra
e061dad55e tests: py2 cleanup - remove subclassing of object
Type: refactor

Change-Id: I9096e3b473110350e1e8e5936e3c4c164f8969a7
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2020-12-07 08:17:10 +00:00
Paul Vinciguerra
496b0dee7f tests: refactor VppDiedError.
- Move Exception into same module as TestCase.
- Move the error reporting logic inside the error.
- Allows testing of the returncode and signal_name for tests to consume.
- Fix the signal reporting code:
	VppDiedError: VPP subprocess died unexpectedly with returncode -6 [unknown].
    displays as:
	VppDiedError: VPP subprocess died unexpectedly with return code: -6 [SIGABRT].

Type: test

Change-Id: I8488ab318a596c9b737308829cedfb7e96e57302
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-06-24 16:03:09 +00:00
Naveen Joy
64f7530fff make-test: fix ValueError raised by hook in python3
Without this patch, the hook module raises a ValueError
when tests are run using python3. This patch updates the
exception being caught by ipaddress to ValueError.

Change-Id: I5e11e292a05ddf350fc04ebaf19cfd7dad2bd9d0
Signed-off-by: Naveen Joy <najoy@cisco.com>
2019-03-27 23:53:49 +00:00
Paul Vinciguerra
a7427ec6f8 VPP-1508: Use scapy.compat to manage packet level library differences.
Change-Id: Icdf6abc9e53d33b26fd1d531c7dda6be0bb9cb55
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-11 08:11:16 +00:00
Paul Vinciguerra
a1bfb3a4d2 Test: Fix hook.py: AttributeError
File "/vpp/test/hook.py", line 84, in on_crash
    self.testcase.vpp_bin, core_path)
AttributeError: 'PollHook' object has no attribute 'testcase'

Change-Id: I84d9d86a5c6a5769a43a91cf23ce8a1141f7cd12
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-03-11 01:09:32 +00:00
Naveen Joy
05e18829d9 Remove unused imports from hooks
Change-Id: I087b057da526c18f8cce1902dcb594dd5ce0a4b8
Signed-off-by: Naveen Joy <najoy@cisco.com>
2019-02-28 08:46:41 -08:00
Paul Vinciguerra
38a4ec7342 make test: Add exception handling around subprocess.
This cleans up exception catching to identify oserrors.  By raising the
specific exception closer to the offending call, we get additional stack history
and can add clearer error logging to assist in troubleshooting.

Change-Id: I592e4d46844b822a816485bf54910f8daed92088
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-02-26 09:39:00 +00:00
Paul Vinciguerra
895e2f8506 Fix inheritance problem in test/hook.py.
Subclasses cannot modify the signature of their constructors.

     def __init__(self, test):
-        super(PollHook, self).__init__(test.logger)
+        super(PollHook, self).__init__(test)

Change-Id: I764df8871128f9198a03fac4ec2f45528547467a
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-02-04 15:37:38 +00:00
Paul Vinciguerra
9e315958d6 VTL: Fix issue with ipaddress library use under python2.
If you pass in a non-unicode 4-byte ipv6 address to ip_address,
ipaddress interprets this as an IPv4Address.

Under python2, ip_address  interprets 'a7::' as a packed ipv4:
 97.55.58.58

You can test with:
---
import ipaddress
try:
    text_type = unicode
except NameError:
    text_type = str

addr = ipaddress.ip_address('a7::')
print(addr)
---

Change-Id: I06c561e0ab7315869cc89d0bb08c05e743a90982
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2019-02-01 08:51:59 +00:00
Paul Vinciguerra
1314ec6170 test/hook.py. Add human-friendly annotations to log msgs.
*  Add human-friendly annotations to packed data values in
   the logs.

Examples:
vpp-unittest-TestNAT66-_JdbMS/log.txt:22:31:29,152 API: ip_neighbor_add_del (is_static=0, is_no_adj_fib=0, is_add=1, sw_if_index=2, dst_address='\xfd\x01\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02 (fd01:2::2)', mac_address='\x02\x02\x00\x00\xff\x02 (02:02:00:00:ff:02)', is_ipv6=1)

vpp-unittest-TestACL_dot1ad_bridged-xEdhrj/log.txt:22:31:17,130 API: ip_neighbor_add_del (is_static=0, is_no_adj_fib=0, is_add=1, sw_if_index=5, dst_address='\xfd\x01\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xc9 (fd01:5::c9)', mac_address='\x02\x05\xc9\x00\xff\xc9 (02:05:c9:00:ff:c9)', is_ipv6=1)
vpp-unittest-TestACL_dot1ad_bridged-xEdhrj/log.txt:22:31:17,240 API: sw_interface_add_del_address (address_length=24, del_all=0, is_add=1, sw_if_index=6, address='\xac\x10\x06\x01 (172.16.6.1)', is_ipv6=0)
vpp-unittest-TestACL_dot1ad_bridged-xEdhrj/log.txt:22:31:17,314 API: sw_interface_add_del_address (address_length=64, del_all=0, is_add=1, sw_if_index=6, address='\xfd\x01\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01 (fd01:6::1)', is_ipv6=1)

Change-Id: Id6991569ee0ff853f76fae8fac941e8a26468a19
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
2018-12-13 14:32:10 +00:00
juraj.linkes
40dd73bcfa Setup, teardown, DEBUG=core, FAILFAST fixes
- Fixed a bug when an error occuring in tearDownClass would not result in
test being marked as failed
- Improved test results reporting in cases when an error occurs in setUpClass
and tearDownClass
- Fixed DEBUG=core when the core is produced in setUpClass or
tearDownClass
- Reworked DEBUG=core to always be handled after all tests have been
executed
- Fixed FAILFAST=1 for parallel test runs

Change-Id: I3e9cd3b97ba6fa802fa0aa2dd7678ff82eee09ec
Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
2018-10-10 16:05:37 +00:00
juraj.linkes
be460e72d5 Fix the default step when using STEP=1 while testing
Change-Id: I6b2950dfd0d9023b20e24845b3bce20cf4ba66df
Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
2018-08-30 10:17:54 +00:00
juraj.linkes
184870ac5a CSIT-1139: Implement parallel test execution
The implementation of parallel test execution in VPP Test Framework.
- VPPTestCase test methods are grouped together
- tests are running in separate processes
- VPP instances spawned by tests are assigned to different cores
- output from these processes is redirected through pipes and printed
out testcase by testcase
- TEST_JOBS env var is used to specify the number of parallel processes
- improved test summary
- a bit of code cleanup

Change-Id: I9ca93904d9fe2c3daf980500c64a8611838ae28c
Signed-off-by: juraj.linkes <juraj.linkes@pantheon.tech>
2018-08-23 14:19:35 +00:00
Andrew Yourtchenko
57612ebcf3 make test: print a warning in case a core_pattern contains a filter program
The default config on Ubuntu 16.04.4 desktop results in truncated cores
when running make test which coredumps. Uninstalling the filter program
(apport) makes the corefiles normal size. Print a warning about that fact,
so the others potentially affected didn't have to wonder.

Change-Id: Iba4b0a2765a25100d6e24fd7f4de0e0339efd835
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-03-31 12:49:40 +00:00
Klement Sekera
9b6ece7952 make test: enhance core-file information
Change-Id: I1283960a9a49f6d70b9d7b7793cfb345c22ccdea
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-03-24 15:17:30 +00:00
Klement Sekera
13a83ef4d4 make test: code cleanup
Change-Id: Ic689de569e5b6e6209d16d6acdb13c489daca1f5
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-03-23 12:57:41 +00:00
Klement Sekera
05742265d4 make test: early core detection, code cleanup
Change-Id: I503d69f902f1c8d3107fb3f2b9f31b0083ebb747
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-03-14 19:14:54 +00:00
Klement Sekera
75e7d13014 IPv4/6 reassembly
Change-Id: Ic5dcadd13c88b8a5e7896dab82404509c081614a
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2018-02-01 23:41:17 +00:00
Klement Sekera
b90be67b35 make test: fix DEBUG=core error
Change-Id: I703b2866a1607d6a2fad215e90b5cf2d7afdfd0d
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-11-06 19:24:41 +00:00
Klement Sekera
909a6a1eb9 make test: detect hung tests
Run tests in a forked process with a set of pipes to communicate
keep-alives and overall result. This allows us to detect when e.g.
vpp dies mid-API call causing the test to hang waiting for response
(which will never come since vpp died).

Support setting a (per test case) TIMEOUT make test option to set timeout,
with a default timeout of 120 seconds.

Example - fail the test suite if any test-case fails to finish within
300s:

make TIMEOUT=300 test

Change-Id: I0d04f26a7232968f4bf043adf5d5b508f5018717
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-08-10 00:14:59 +00:00
Klement Sekera
da505f608e make test: improve documentation and PEP8 compliance
Change-Id: Ib4f0353aab6112fcc3c3d8f0bcbed5bc4b567b9b
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-01-11 23:26:16 +00:00
Klement Sekera
0e3c0de1ed BFD: basic asynchronous session up/down
This is a work-in-progress basic BFD session handling. Only
asynchronous mode is supported at the moment. Setting the session flags
doesn't work.

Change-Id: Idba27f721b5c35be5a66a6d202a63d23ff7ecf6f
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-12-07 19:54:12 +00:00
Klement Sekera
085f5c0066 make test: detect early vpp crash
If VPP process dies right at start, do a quick detection instead of being
stuck in the connect timeout (60s).

Change-Id: I41675181635fb81a6a7d93fbf652480a16bf78a0
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-11-28 11:54:47 +00:00
Klement Sekera
01bbbe91fa Improve debug-cli in test framework
Opening debug-cli only makes sense if there is time for user to use it,
so either the run must be debugged or stepped. Only open the debug-cli
in these cases.

Change-Id: Ied276071797a549880d730cda43c59230a412efe
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-11-02 14:14:28 +00:00
Klement Sekera
277b89c946 add vpp debugging support to test framework
improve test documentation

Change-Id: Ia9678aa2532ecb4cb33736aedb4a31aa3f2a3f93
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2016-10-31 23:48:25 +00:00
Klement Sekera
f62ae1288a refactor test framework
Change-Id: I31da3b1857b6399f9899276a2d99cdd19436296c
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Signed-off-by: Matej Klotton <mklotton@cisco.com>
Signed-off-by: Jan Gelety <jgelety@cisco.com>
Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
2016-10-26 17:42:19 +02:00