^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) tdc - Linux Traffic Control (tc) unit testing suite
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) Author: Lucas Bates - lucasb@mojatatu.com
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) tdc is a Python script to load tc unit tests from a separate JSON file and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) execute them inside a network namespace dedicated to the task.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) REQUIREMENTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) ------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Minimum Python version of 3.4. Earlier 3.X versions may work but are not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) guaranteed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * The kernel must have network namespace support if using nsPlugin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * The kernel must have veth support available, as a veth pair is created
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) prior to running the tests when using nsPlugin.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * The kernel must have the appropriate infrastructure enabled to run all tdc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) unit tests. See the config file in this directory for minimum required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) features. As new tests will be added, config options list will be updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * All tc-related features being tested must be built in or available as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) modules. To check what is required in current setup run:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) ./tdc.py -c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) Note:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) In the current release, tdc run will abort due to a failure in setup or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) teardown commands - which includes not being able to run a test simply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) because the kernel did not support a specific feature. (This will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) handled in a future version - the current workaround is to run the tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) on specific test categories that your kernel supports)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) BEFORE YOU RUN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) --------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) The path to the tc executable that will be most commonly tested can be defined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) in the tdc_config.py file. Find the 'TC' entry in the NAMES dictionary and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) define the path.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) If you need to test a different tc executable on the fly, you can do so by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) using the -p option when running tdc:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) ./tdc.py -p /path/to/tc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) RUNNING TDC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) -----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) To use tdc, root privileges are required. This is because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) commands being tested must be run as root. The code that enforces
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) execution by root uid has been moved into a plugin (see PLUGIN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) ARCHITECTURE, below).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) Tests that use a network device should have nsPlugin.py listed as a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) requirement for that test. nsPlugin executes all commands within a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) network namespace and creates a veth pair which may be used in those test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) cases. To disable execution within the namespace, pass the -N option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) to tdc when starting a test run; the veth pair will still be created
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) by the plugin.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) Running tdc without any arguments will run all tests. Refer to the section
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) on command line arguments for more information, or run:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) ./tdc.py -h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) tdc will list the test names as they are being run, and print a summary in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) TAP (Test Anything Protocol) format when they are done. If tests fail,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) output captured from the failing test will be printed immediately following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) the failed test in the TAP output.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) OVERVIEW OF TDC EXECUTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) -------------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) One run of tests is considered a "test suite" (this will be refined in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) future). A test suite has one or more test cases in it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) A test case has four stages:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) - setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) - execute
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) - verify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) - teardown
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) The setup and teardown stages can run zero or more commands. The setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) stage does some setup if the test needs it. The teardown stage undoes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) the setup and returns the system to a "neutral" state so any other test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) can be run next. These two stages require any commands run to return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) success, but do not otherwise verify the results.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) The execute and verify stages each run one command. The execute stage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) tests the return code against one or more acceptable values. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) verify stage checks the return code for success, and also compares
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) the stdout with a regular expression.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) Each of the commands in any stage will run in a shell instance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) USER-DEFINED CONSTANTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) ----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) The tdc_config.py file contains multiple values that can be altered to suit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) your needs. Any value in the NAMES dictionary can be altered without affecting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) the tests to be run. These values are used in the tc commands that will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) executed as part of the test. More will be added as test cases require.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) Example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) $TC qdisc add dev $DEV1 ingress
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) The NAMES values are used to substitute into the commands in the test cases.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) COMMAND LINE ARGUMENTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) ----------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) Run tdc.py -h to see the full list of available arguments.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) usage: tdc.py [-h] [-p PATH] [-D DIR [DIR ...]] [-f FILE [FILE ...]]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) [-c [CATG [CATG ...]]] [-e ID [ID ...]] [-l] [-s] [-i] [-v] [-N]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) [-d DEVICE] [-P] [-n] [-V]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) Linux TC unit tests
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) optional arguments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) -h, --help show this help message and exit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) -p PATH, --path PATH The full path to the tc executable to use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) -v, --verbose Show the commands that are being run
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) -N, --notap Suppress tap results for command under test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) -d DEVICE, --device DEVICE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) Execute test cases that use a physical device, where
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) DEVICE is its name. (If not defined, tests that require
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) a physical device will be skipped)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) -P, --pause Pause execution just before post-suite stage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) selection:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) select which test cases: files plus directories; filtered by categories
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) plus testids
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) -D DIR [DIR ...], --directory DIR [DIR ...]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) Collect tests from the specified directory(ies)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) (default [tc-tests])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) -f FILE [FILE ...], --file FILE [FILE ...]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) Run tests from the specified file(s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) -c [CATG [CATG ...]], --category [CATG [CATG ...]]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) Run tests only from the specified category/ies, or if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) no category/ies is/are specified, list known
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) categories.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) -e ID [ID ...], --execute ID [ID ...]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) Execute the specified test cases with specified IDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) action:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) select action to perform on selected test cases
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) -l, --list List all test cases, or those only within the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) specified category
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) -s, --show Display the selected test cases
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) -i, --id Generate ID numbers for new test cases
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) netns:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) options for nsPlugin (run commands in net namespace)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) -N, --no-namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) Do not run commands in a network namespace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) valgrind:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) options for valgrindPlugin (run command under test under Valgrind)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) -V, --valgrind Run commands under valgrind
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) PLUGIN ARCHITECTURE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) -------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) There is now a plugin architecture, and some of the functionality that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) was in the tdc.py script has been moved into the plugins.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) The plugins are in the directory plugin-lib. The are executed from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) directory plugins. Put symbolic links from plugins to plugin-lib,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) and name them according to the order you want them to run. This is not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) necessary if a test case being run requires a specific plugin to work.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) Example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) bjb@bee:~/work/tc-testing$ ls -l plugins
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) total 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) lrwxrwxrwx 1 bjb bjb 27 Oct 4 16:12 10-rootPlugin.py -> ../plugin-lib/rootPlugin.py
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) lrwxrwxrwx 1 bjb bjb 25 Oct 12 17:55 20-nsPlugin.py -> ../plugin-lib/nsPlugin.py
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) -rwxr-xr-x 1 bjb bjb 0 Sep 29 15:56 __init__.py
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) The plugins are a subclass of TdcPlugin, defined in TdcPlugin.py and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) must be called "SubPlugin" so tdc can find them. They are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) distinguished from each other in the python program by their module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) This base class supplies "hooks" to run extra functions. These hooks are as follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) pre- and post-suite
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) pre- and post-case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) pre- and post-execute stage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) adjust-command (runs in all stages and receives the stage name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) The pre-suite hook receives the number of tests and an array of test ids.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) This allows you to dump out the list of skipped tests in the event of a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) failure during setup or teardown stage.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) The pre-case hook receives the ordinal number and test id of the current test.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) The adjust-command hook receives the stage id (see list below) and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) full command to be executed. This allows for last-minute adjustment
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) of the command.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) The stages are identified by the following strings:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) - pre (pre-suite)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) - setup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) - command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) - verify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) - teardown
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) - post (post-suite)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) To write a plugin, you need to inherit from TdcPlugin in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) TdcPlugin.py. To use the plugin, you have to put the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) implementation file in plugin-lib, and add a symbolic link to it from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) plugins. It will be detected at run time and invoked at the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) appropriate times. There are a few examples in the plugin-lib
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) directory:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) - rootPlugin.py:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) implements the enforcement of running as root
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) - nsPlugin.py:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) sets up a network namespace and runs all commands in that namespace,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) while also setting up dummy devices to be used in testing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) - valgrindPlugin.py
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) runs each command in the execute stage under valgrind,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) and checks for leaks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) This plugin will output an extra test for each test in the test file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) one is the existing output as to whether the test passed or failed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) and the other is a test whether the command leaked memory or not.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) (This one is a preliminary version, it may not work quite right yet,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) but the overall template is there and it should only need tweaks.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) - buildebpfPlugin.py:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) builds all programs in $EBPFDIR.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) ACKNOWLEDGEMENTS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) ----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) Thanks to:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) Jamal Hadi Salim, for providing valuable test cases
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) Keara Leibovitz, who wrote the CLI test driver that I used as a base for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) first version of the tc testing suite. This work was presented at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) Netdev 1.2 Tokyo in October 2016.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) Samir Hussain, for providing help while I dove into Python for the first time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) and being a second eye for this code.