selftests: tc-testing: add "depends_on" property to skip testscurrently, users can skip individual test cases by means of writing "skip": "yes"in the scenario file. Extend this functionality,
selftests: tc-testing: add "depends_on" property to skip testscurrently, users can skip individual test cases by means of writing "skip": "yes"in the scenario file. Extend this functionality, introducing 'dependsOn':it's optional property like "skip", but the value contains a command (forexample, a probe on iproute2 to check if it supports a specific feature).If such property is present, tdc executes that command and skips the testwhen the return value is non-zero.Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>Signed-off-by: Davide Caratti <dcaratti@redhat.com>Signed-off-by: Jakub Kicinski <kuba@kernel.org>
show more ...
tc-testing: introduce scapyPlugin for basic trafficThe scapyPlugin allows for simple traffic generation in tdc totest various tc features. It was tested with scapy v2.4.2, butshould work with any
tc-testing: introduce scapyPlugin for basic trafficThe scapyPlugin allows for simple traffic generation in tdc totest various tc features. It was tested with scapy v2.4.2, butshould work with any successive version.In order to use the plugin's functionality, scapy must beinstalled. This can be done with: pip3 install scapyor to install 2.4.2: pip3 install scapy==2.4.2If the plugin is unable to import the scapy module, it willterminate the tdc run.The plugin makes use of a new key in the test case data, 'scapy'.This block contains three other elements: 'iface', 'count', and'packet': "scapy": { "iface": "$DEV0", "count": 1, "packet": "Ether(type=0x800)/IP(src='16.61.16.61')/ICMP()" },* iface is the name of the device on the host machine from which the packet(s) will be sent. Values contained within tdc_config.py's NAMES dict can be used here - this is useful if paired with nsPlugin* count is the number of copies of this packet to be sent* packet is a string detailing the different layers of the packet to be sent. If a property isn't explicitly set, scapy will set default values for you.Layers in the packet info are separated by slashes. For info aboutcommon TCP and IP properties, see:https://blogs.sans.org/pen-testing/files/2016/04/ScapyCheatSheet_v0.2.pdfCaution is advised when running tests using the scapy functionality,since the plugin blindly sends the packet as defined in the test casedata.See creating-testcases/scapy-example.json for sample test cases;the first test is intended to pass while the second is intended tofail.Signed-off-by: Lucas Bates <lucasb@mojatatu.com>Signed-off-by: David S. Miller <davem@davemloft.net>
tc-testing: Allow test cases to be skippedBy adding a check for an optional key/value pair to the test casedata, individual test cases may be skipped to prevent tdc fromaborting a test run due to
tc-testing: Allow test cases to be skippedBy adding a check for an optional key/value pair to the test casedata, individual test cases may be skipped to prevent tdc fromaborting a test run due to setup or teardown failure.If a test case is skipped, it will still appear in the resultsoutput to allow for a consistent number of executed tests in eachrun. However, the test will be marked as skipped.This support for skipping extends to any plugins that may generateadditional results for each executed test.Signed-off-by: Lucas Bates <lucasb@mojatatu.com>Signed-off-by: David S. Miller <davem@davemloft.net>
tools: tc-testing: Command line parmsSeparate the functionality of the command line parameters into "selection"parameters, "action" parameters and other parameters."Selection" parameters are for
tools: tc-testing: Command line parmsSeparate the functionality of the command line parameters into "selection"parameters, "action" parameters and other parameters."Selection" parameters are for choosing which tests on which to act."Action" parameters are for choosing what to do with the selected tests."Other" parameters are for global effect (like "help" or "verbose").With this commit, we add the ability to name a directory as anotherselection mechanism. We can accumulate a number of tests by directory,file, category, or even by test id, instead of being constrained torun all tests in one collection or just one test.Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>Acked-by: Lucas Bates <lucasb@mojatatu.com>Signed-off-by: David S. Miller <davem@davemloft.net>
tc-testing: very simple example test casesAs part of documentation, supply some very simple test casesto illustrate how test cases work. One test case showscommands in the setup, command, verify
tc-testing: very simple example test casesAs part of documentation, supply some very simple test casesto illustrate how test cases work. One test case showscommands in the setup, command, verify and teardown stages.Other test cases show how to have a working test case thatdoes not have commands in the setup, verify and/or teardownstages.Specifically, the command lists for setup and teardown canbe empty. And the verify command must have a command, butit can be /bin/true. The regex must have a string, werecommend a single space, and the count of matches must bezero if you do not want to use the match feature of verify.Verify will always look for a return code of success (0)so we give /bin/true when we do not want to make a checkthere.Also, update the documentation for testcases to be morespecific in the cases of: - accepting non-success return codes in setup and teardown stages - how to write the test when no setup, teardown and/or verify are desired.To run the example test cases: $ sudo -E ./tdc.py -f creating-testcases/example.json -l 1f: (example) simple test to test framework 2f: (example) simple test, no need for verify 3f: (example) simple test, no need for setup or teardown (or verify) $ sudo -E ./tdc.py -f creating-testcases/example.json Test 1f: simple test to test framework Test 2f: simple test, no need for verify Test 3f: simple test, no need for setup or teardown (or verify) All test results: 1..3 ok 1 1f simple test to test framework ok 2 2f simple test, no need for verify ok 3 3f simple test, no need for setup or teardown (or verify) $Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>Acked-by: Lucas Bates <lucasb@mojatatu.com>Signed-off-by: David S. Miller <davem@davemloft.net>
selftests: Introduce tc testsuiteAdd the beginnings of a testsuite for tc functionality in the kernel.These are a series of unit tests that use the tc executable and verifythe success of those co
selftests: Introduce tc testsuiteAdd the beginnings of a testsuite for tc functionality in the kernel.These are a series of unit tests that use the tc executable and verifythe success of those commands by checking both the exit codes and theoutput from tc's 'show' operation.To run the tests: # cd tools/testing/selftests/tc-testing # sudo ./tdc.pyYou can specify the tc executable to use with the -p argument on the commandline or editing the 'TC' variable in tdc_config.py. Refer to the README forfull details on how to run.The initial complement of test cases are limited mostly to tc actions. Testcases are most welcome; see the creating-testcases subdirectory for helpin creating them.Signed-off-by: Lucas Bates <lucasb@mojatatu.com>Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>Signed-off-by: David S. Miller <davem@davemloft.net>