README (3eb66e91a25497065c5322b1268cbc3953642227) | README (489ce2f42514b4324e5c63e93ae7570cab995254) |
---|---|
1tdc - Linux Traffic Control (tc) unit testing suite 2 3Author: Lucas Bates - lucasb@mojatatu.com 4 5tdc is a Python script to load tc unit tests from a separate JSON file and 6execute them inside a network namespace dedicated to the task. 7 8 9REQUIREMENTS 10------------ 11 12* Minimum Python version of 3.4. Earlier 3.X versions may work but are not 13 guaranteed. 14 | 1tdc - Linux Traffic Control (tc) unit testing suite 2 3Author: Lucas Bates - lucasb@mojatatu.com 4 5tdc is a Python script to load tc unit tests from a separate JSON file and 6execute them inside a network namespace dedicated to the task. 7 8 9REQUIREMENTS 10------------ 11 12* Minimum Python version of 3.4. Earlier 3.X versions may work but are not 13 guaranteed. 14 |
15* The kernel must have network namespace support | 15* The kernel must have network namespace support if using nsPlugin |
16 17* The kernel must have veth support available, as a veth pair is created | 16 17* The kernel must have veth support available, as a veth pair is created |
18 prior to running the tests. | 18 prior to running the tests when using nsPlugin. |
19 20* The kernel must have the appropriate infrastructure enabled to run all tdc 21 unit tests. See the config file in this directory for minimum required 22 features. As new tests will be added, config options list will be updated. 23 24* All tc-related features being tested must be built in or available as 25 modules. To check what is required in current setup run: 26 ./tdc.py -c --- 21 unchanged lines hidden (view full) --- 48RUNNING TDC 49----------- 50 51To use tdc, root privileges are required. This is because the 52commands being tested must be run as root. The code that enforces 53execution by root uid has been moved into a plugin (see PLUGIN 54ARCHITECTURE, below). 55 | 19 20* The kernel must have the appropriate infrastructure enabled to run all tdc 21 unit tests. See the config file in this directory for minimum required 22 features. As new tests will be added, config options list will be updated. 23 24* All tc-related features being tested must be built in or available as 25 modules. To check what is required in current setup run: 26 ./tdc.py -c --- 21 unchanged lines hidden (view full) --- 48RUNNING TDC 49----------- 50 51To use tdc, root privileges are required. This is because the 52commands being tested must be run as root. The code that enforces 53execution by root uid has been moved into a plugin (see PLUGIN 54ARCHITECTURE, below). 55 |
56If nsPlugin is linked, all tests are executed inside a network 57namespace to prevent conflicts within the host. | 56Tests that use a network device should have nsPlugin.py listed as a 57requirement for that test. nsPlugin executes all commands within a 58network namespace and creates a veth pair which may be used in those test 59cases. To disable execution within the namespace, pass the -N option 60to tdc when starting a test run; the veth pair will still be created 61by the plugin. |
58 59Running tdc without any arguments will run all tests. Refer to the section 60on command line arguments for more information, or run: 61 ./tdc.py -h 62 63tdc will list the test names as they are being run, and print a summary in 64TAP (Test Anything Protocol) format when they are done. If tests fail, 65output captured from the failing test will be printed immediately following --- 83 unchanged lines hidden (view full) --- 149 -l, --list List all test cases, or those only within the 150 specified category 151 -s, --show Display the selected test cases 152 -i, --id Generate ID numbers for new test cases 153 154netns: 155 options for nsPlugin (run commands in net namespace) 156 | 62 63Running tdc without any arguments will run all tests. Refer to the section 64on command line arguments for more information, or run: 65 ./tdc.py -h 66 67tdc will list the test names as they are being run, and print a summary in 68TAP (Test Anything Protocol) format when they are done. If tests fail, 69output captured from the failing test will be printed immediately following --- 83 unchanged lines hidden (view full) --- 153 -l, --list List all test cases, or those only within the 154 specified category 155 -s, --show Display the selected test cases 156 -i, --id Generate ID numbers for new test cases 157 158netns: 159 options for nsPlugin (run commands in net namespace) 160 |
157 -n, --namespace 158 Run commands in namespace as specified in tdc_config.py | 161 -N, --no-namespace 162 Do not run commands in a network namespace. |
159 160valgrind: 161 options for valgrindPlugin (run command under test under Valgrind) 162 163 -V, --valgrind Run commands under valgrind 164 165 166PLUGIN ARCHITECTURE 167------------------- 168 169There is now a plugin architecture, and some of the functionality that 170was in the tdc.py script has been moved into the plugins. 171 172The plugins are in the directory plugin-lib. The are executed from 173directory plugins. Put symbolic links from plugins to plugin-lib, | 163 164valgrind: 165 options for valgrindPlugin (run command under test under Valgrind) 166 167 -V, --valgrind Run commands under valgrind 168 169 170PLUGIN ARCHITECTURE 171------------------- 172 173There is now a plugin architecture, and some of the functionality that 174was in the tdc.py script has been moved into the plugins. 175 176The plugins are in the directory plugin-lib. The are executed from 177directory plugins. Put symbolic links from plugins to plugin-lib, |
174and name them according to the order you want them to run. | 178and name them according to the order you want them to run. This is not 179necessary if a test case being run requires a specific plugin to work. |
175 176Example: 177 178bjb@bee:~/work/tc-testing$ ls -l plugins 179total 4 180lrwxrwxrwx 1 bjb bjb 27 Oct 4 16:12 10-rootPlugin.py -> ../plugin-lib/rootPlugin.py 181lrwxrwxrwx 1 bjb bjb 25 Oct 12 17:55 20-nsPlugin.py -> ../plugin-lib/nsPlugin.py 182-rwxr-xr-x 1 bjb bjb 0 Sep 29 15:56 __init__.py --- 35 unchanged lines hidden (view full) --- 218implementation file in plugin-lib, and add a symbolic link to it from 219plugins. It will be detected at run time and invoked at the 220appropriate times. There are a few examples in the plugin-lib 221directory: 222 223 - rootPlugin.py: 224 implements the enforcement of running as root 225 - nsPlugin.py: | 180 181Example: 182 183bjb@bee:~/work/tc-testing$ ls -l plugins 184total 4 185lrwxrwxrwx 1 bjb bjb 27 Oct 4 16:12 10-rootPlugin.py -> ../plugin-lib/rootPlugin.py 186lrwxrwxrwx 1 bjb bjb 25 Oct 12 17:55 20-nsPlugin.py -> ../plugin-lib/nsPlugin.py 187-rwxr-xr-x 1 bjb bjb 0 Sep 29 15:56 __init__.py --- 35 unchanged lines hidden (view full) --- 223implementation file in plugin-lib, and add a symbolic link to it from 224plugins. It will be detected at run time and invoked at the 225appropriate times. There are a few examples in the plugin-lib 226directory: 227 228 - rootPlugin.py: 229 implements the enforcement of running as root 230 - nsPlugin.py: |
226 sets up a network namespace and runs all commands in that namespace | 231 sets up a network namespace and runs all commands in that namespace, 232 while also setting up dummy devices to be used in testing. |
227 - valgrindPlugin.py 228 runs each command in the execute stage under valgrind, 229 and checks for leaks. 230 This plugin will output an extra test for each test in the test file, 231 one is the existing output as to whether the test passed or failed, 232 and the other is a test whether the command leaked memory or not. 233 (This one is a preliminary version, it may not work quite right yet, 234 but the overall template is there and it should only need tweaks.) --- 15 unchanged lines hidden --- | 233 - valgrindPlugin.py 234 runs each command in the execute stage under valgrind, 235 and checks for leaks. 236 This plugin will output an extra test for each test in the test file, 237 one is the existing output as to whether the test passed or failed, 238 and the other is a test whether the command leaked memory or not. 239 (This one is a preliminary version, it may not work quite right yet, 240 but the overall template is there and it should only need tweaks.) --- 15 unchanged lines hidden --- |