mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 13:43:00 +07:00
915de2adb5
Add XFAIL and POSIX 1003.3 standard codes (UNRESOLVED/ UNTESTED/UNSUPPORTED) as result codes. These are used for the results that test case is expected to fail or unsupported feature (by config). To return these result code, this introduces exit_unresolved, exit_untested, exit_unsupported and exit_xfail functions, which use real-time signals to notify the result code to ftracetest. This also set "errexit" option for the testcases, so that the tests don't need to exit explicitly. Note that if the test returns UNRESOLVED/UNSUPPORTED/FAIL, its test log including executed commands is shown on console and main logfile as below. ------ # ./ftracetest samples/ === Ftrace unit tests === [1] failure-case example [FAIL] execute: /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/fail.tc + . /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/fail.tc ++ cat non-exist-file cat: non-exist-file: No such file or directory [2] pass-case example [PASS] [3] unresolved-case example [UNRESOLVED] execute: /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/unresolved.tc + . /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/unresolved.tc ++ trap exit_unresolved INT ++ kill -INT 29324 +++ exit_unresolved +++ kill -s 38 29265 +++ exit 0 [4] unsupported-case example [UNSUPPORTED] execute: /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/unsupported.tc + . /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/unsupported.tc ++ exit_unsupported ++ kill -s 40 29265 ++ exit 0 [5] untested-case example [UNTESTED] [6] xfail-case example [XFAIL] # of passed: 1 # of failed: 1 # of unresolved: 1 # of untested: 1 # of unsupported: 1 # of xfailed: 1 # of undefined(test bug): 0 ------ Link: http://lkml.kernel.org/p/20140929120211.30203.99510.stgit@kbuild-f20.novalocal Acked-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
83 lines
2.5 KiB
Plaintext
83 lines
2.5 KiB
Plaintext
Linux Ftrace Testcases
|
|
|
|
This is a collection of testcases for ftrace tracing feature in the Linux
|
|
kernel. Since ftrace exports interfaces via the debugfs, we just need
|
|
shell scripts for testing. Feel free to add new test cases.
|
|
|
|
Running the ftrace testcases
|
|
============================
|
|
|
|
At first, you need to be the root user to run this script.
|
|
To run all testcases:
|
|
|
|
$ sudo ./ftracetest
|
|
|
|
To run specific testcases:
|
|
|
|
# ./ftracetest test.d/basic3.tc
|
|
|
|
Or you can also run testcases under given directory:
|
|
|
|
# ./ftracetest test.d/kprobe/
|
|
|
|
Contributing new testcases
|
|
==========================
|
|
|
|
Copy test.d/template to your testcase (whose filename must have *.tc
|
|
extension) and rewrite the test description line.
|
|
|
|
* The working directory of the script is <debugfs>/tracing/.
|
|
|
|
* Take care with side effects as the tests are run with root privilege.
|
|
|
|
* The tests should not run for a long period of time (more than 1 min.)
|
|
These are to be unit tests.
|
|
|
|
* You can add a directory for your testcases under test.d/ if needed.
|
|
|
|
* The test cases should run on dash (busybox shell) for testing on
|
|
minimal cross-build environments.
|
|
|
|
* Note that the tests are run with "set -e" (errexit) option. If any
|
|
command fails, the test will be terminated immediately.
|
|
|
|
* The tests can return some result codes instead of pass or fail by
|
|
using exit_unresolved, exit_untested, exit_unsupported and exit_xfail.
|
|
|
|
Result code
|
|
===========
|
|
|
|
Ftracetest supports following result codes.
|
|
|
|
* PASS: The test succeeded as expected. The test which exits with 0 is
|
|
counted as passed test.
|
|
|
|
* FAIL: The test failed, but was expected to succeed. The test which exits
|
|
with !0 is counted as failed test.
|
|
|
|
* UNRESOLVED: The test produced unclear or intermidiate results.
|
|
for example, the test was interrupted
|
|
or the test depends on a previous test, which failed.
|
|
or the test was set up incorrectly
|
|
The test which is in above situation, must call exit_unresolved.
|
|
|
|
* UNTESTED: The test was not run, currently just a placeholder.
|
|
In this case, the test must call exit_untested.
|
|
|
|
* UNSUPPORTED: The test failed because of lack of feature.
|
|
In this case, the test must call exit_unsupported.
|
|
|
|
* XFAIL: The test failed, and was expected to fail.
|
|
To return XFAIL, call exit_xfail from the test.
|
|
|
|
There are some sample test scripts for result code under samples/.
|
|
You can also run samples as below:
|
|
|
|
# ./ftracetest samples/
|
|
|
|
TODO
|
|
====
|
|
|
|
* Fancy colored output :)
|
|
|