aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/tc-testing/creating-testcases/template.json
diff options
context:
space:
mode:
authorBrenda J. Butler <bjb@mojatatu.com>2017-10-31 14:25:46 -0400
committerDavid S. Miller <davem@davemloft.net>2017-11-01 11:04:46 +0900
commit7dfbe5b64fe8f619bc056a7f81421e8beab373f1 (patch)
treee1f3067ea6456543334fc410f2ef7c1cd2f761b8 /tools/testing/selftests/tc-testing/creating-testcases/template.json
parentMerge branch 'l2tp-remove-unused-code' (diff)
downloadlinux-dev-7dfbe5b64fe8f619bc056a7f81421e8beab373f1.tar.xz
linux-dev-7dfbe5b64fe8f619bc056a7f81421e8beab373f1.zip
tc-testing: very simple example test cases
As part of documentation, supply some very simple test cases to illustrate how test cases work. One test case shows commands in the setup, command, verify and teardown stages. Other test cases show how to have a working test case that does not have commands in the setup, verify and/or teardown stages. Specifically, the command lists for setup and teardown can be empty. And the verify command must have a command, but it can be /bin/true. The regex must have a string, we recommend a single space, and the count of matches must be zero 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 check there. Also, update the documentation for testcases to be more specific 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>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/tc-testing/creating-testcases/template.json15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/testing/selftests/tc-testing/creating-testcases/template.json b/tools/testing/selftests/tc-testing/creating-testcases/template.json
index 87971744bdd4..8b99b86d65bd 100644
--- a/tools/testing/selftests/tc-testing/creating-testcases/template.json
+++ b/tools/testing/selftests/tc-testing/creating-testcases/template.json
@@ -26,7 +26,13 @@
""
],
"setup": [
- ""
+ "",
+ [
+ "",
+ 0,
+ 1,
+ 255
+ ]
],
"cmdUnderTest": "",
"expExitCode": "",
@@ -34,7 +40,12 @@
"matchPattern": "",
"matchCount": "",
"teardown": [
- ""
+ "",
+ [
+ "",
+ 0,
+ 255
+ ]
]
}
]