blob: 28ddb21b122ba27ff4300619ffa3df2f0db2f26c [file] [log] [blame]
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +02001Testing VPP
2===========
3
4As of this writing, the vpp source tree includes over 1,000 unit test
5vectors. Best practices prior to pushing patches for code review: make
6sure that all of the make test test vectors pass.
7
8We attempt to maintain the top-level make test-help command so that it
9accurately describes all of the make test options.
10
11Examples
12--------
13
14Basic test run, all test vectors, single-vpp instance, optimized image:
15
16::
17
18 $ make test
19
2010-way parallel basic test run:
21
22::
23
24 $ make TEST_JOBS=10 test
25
26Run a specific test suite (mpls, in this case):
27
28::
29
30 $ make TEST=test_mpls test
31
32Run a specific test suite, debug image, pause prior to running the test
33suite; attach to the vpp image in gdb:
34
35::
36
37 $ make TEST=xxx DEBUG=gdb test-debug
38
39Detailed Documentation
40----------------------
41
42Current make test-help output:
43
44::
45
Klement Sekerab23ffd72021-05-31 16:08:53 +020046 $ make test-help
47 Running tests:
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +020048
Klement Sekerab23ffd72021-05-31 16:08:53 +020049 test - build and run (basic) functional tests
50 test-debug - build and run (basic) functional tests (debug build)
51 test-all - build and run functional and extended tests
52 test-all-debug - build and run functional and extended tests (debug build)
53 retest - run functional tests
54 retest-debug - run functional tests (debug build)
55 retest-all - run functional and extended tests
56 retest-all-debug - run functional and extended tests (debug build)
57 test-cov - generate code coverage report for test framework
58 test-gcov - build and run functional tests (gcov build)
59 test-wipe - wipe (temporary) files generated by unit tests
60 test-wipe-cov - wipe code coverage report for test framework
61 test-wipe-papi - rebuild vpp_papi sources
62 test-wipe-all - wipe (temporary) files generated by unit tests, and coverage
63 test-shell - enter shell with test environment
64 test-shell-debug - enter shell with test environment (debug build)
65 test-checkstyle - check PEP8 compliance for test framework
66 test-refresh-deps - refresh the Python dependencies for the tests
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +020067
Klement Sekerab23ffd72021-05-31 16:08:53 +020068 Arguments controlling test runs:
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +020069
Klement Sekerab23ffd72021-05-31 16:08:53 +020070 V=[0|1|2] - set test verbosity level
71 0=ERROR, 1=INFO, 2=DEBUG
72 TEST_JOBS=[<n>|auto] - use at most <n> parallel python processes for test execution, if auto, set to number of available cpus (default: 1)
73 MAX_VPP_CPUS=[<n>|auto]- use at most <n> cpus for running vpp main and worker threads, if auto, set to number of available cpus (default: auto)
74 CACHE_OUTPUT=[0|n|no] - disable cache VPP stdout/stderr and log as one block after test finishes (default: yes)
75 FAILFAST=[1|y|yes] - fail fast if 1, otherwise complete all tests
76 TIMEOUT=<timeout> - fail test suite if any single test takes longer than <timeout> (in seconds) to finish (default: 600)
77 RETRIES=<n> - retry failed tests <n> times
78 DEBUG=<type> - set VPP debugging kind
79 DEBUG=core - detect coredump and load it in gdb on crash
80 DEBUG=gdb - allow easy debugging by printing VPP PID
81 and waiting for user input before running
82 and tearing down a testcase
83 DEBUG=gdbserver - run gdb inside a gdb server, otherwise
84 same as above
85 DEBUG=attach - attach test case to already running vpp in gdb (see test-start-vpp-in-gdb)
86 STEP=[1|y|yes] - enable stepping through a testcase (for testcase debugging)
87 SANITY=[0|n|no] - disable sanity import of vpp-api/sanity vpp run before running tests
88 EXTENDED_TESTS=[1|y|yes] - run extended tests
89 TEST=<filter> - filter the set of tests:
90 by file-name - only run tests from specified file, e.g. TEST=test_bfd selects all tests from test_bfd.py
91 by file-suffix - same as file-name, but 'test_' is omitted e.g. TEST=bfd selects all tests from test_bfd.py
92 by wildcard - wildcard filter is <file>.<class>.<test function>, each can be replaced by '*'
93 e.g. TEST='test_bfd.*.*' is equivalent to above example of filter by file-name
94 TEST='bfd.*.*' is equivalent to above example of filter by file-suffix
95 TEST='bfd.BFDAPITestCase.*' selects all tests from test_bfd.py which are part of BFDAPITestCase class
96 TEST='bfd.BFDAPITestCase.test_add_bfd' selects a single test named test_add_bfd from test_bfd.py/BFDAPITestCase
97 TEST='*.*.test_add_bfd' selects all test functions named test_add_bfd from all files/classes
98 VARIANT=<variant> - specify which march node variant to unit test
99 e.g. VARIANT=skx test the skx march variants
100 e.g. VARIANT=icl test the icl march variants
101 COREDUMP_SIZE=<size> - pass <size> as unix { coredump-size <size> } argument to vpp
102 e.g. COREDUMP_SIZE=4g
103 COREDUMP_SIZE=unlimited
104 COREDUMP_COMPRESS=[1|y|yes] - compress core files if not debugging them
105 EXTERN_TESTS=<path> - path to out-of-tree test_<name>.py files containing test cases
106 EXTERN_PLUGINS=<path> - path to out-of-tree plugins to be loaded by vpp under test
107 EXTERN_COV_DIR=<path> - path to out-of-tree prefix, where source, object and .gcda files can be found for coverage report
108 PROFILE=[1|y|yes] - enable profiling of test framework via cProfile module
109 PROFILE_SORT_BY=opt - sort profiling report by opt - consult cProfile documentation for possible values (default: cumtime)
110 PROFILE_OUTPUT=file - output profiling info to file - use absolute path (default: stdout)
111 TEST_DEBUG=[1|y|yes] - enable debugging of the test framework itself (expert)
112 API_FUZZ=[1|y|yes] - enable VPP api fuzz testing
113 RND_SEED=<seed> - Seed RND with given seed
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200114
Klement Sekerab23ffd72021-05-31 16:08:53 +0200115 Starting VPP in GDB for use with DEBUG=attach:
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200116
Klement Sekerab23ffd72021-05-31 16:08:53 +0200117 test-start-vpp-in-gdb - start VPP in gdb (release)
118 test-start-vpp-debug-in-gdb - start VPP in gdb (debug)
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200119
Klement Sekerab23ffd72021-05-31 16:08:53 +0200120 Creating test code coverage report:
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200121
Klement Sekerab23ffd72021-05-31 16:08:53 +0200122 test-cov - generate code coverage report for test framework
123 test-wipe-cov - wipe code coverage report for test framework
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200124
Klement Sekerab23ffd72021-05-31 16:08:53 +0200125 Verifying code-style:
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +0200126
Klement Sekerab23ffd72021-05-31 16:08:53 +0200127 test-checkstyle - check PEP8 compliance