Back to home page

OSCL-LXR

 
 

    


0001 Linux Ftrace Testcases
0002 
0003 This is a collection of testcases for ftrace tracing feature in the Linux
0004 kernel. Since ftrace exports interfaces via the debugfs, we just need
0005 shell scripts for testing. Feel free to add new test cases.
0006 
0007 Running the ftrace testcases
0008 ============================
0009 
0010 At first, you need to be the root user to run this script.
0011 To run all testcases:
0012 
0013   $ sudo ./ftracetest
0014 
0015 To run specific testcases:
0016 
0017   # ./ftracetest test.d/basic3.tc
0018 
0019 Or you can also run testcases under given directory:
0020 
0021   # ./ftracetest test.d/kprobe/
0022 
0023 Contributing new testcases
0024 ==========================
0025 
0026 Copy test.d/template to your testcase (whose filename must have *.tc
0027 extension) and rewrite the test description line.
0028 
0029  * The working directory of the script is <debugfs>/tracing/.
0030 
0031  * Take care with side effects as the tests are run with root privilege.
0032 
0033  * The tests should not run for a long period of time (more than 1 min.)
0034    These are to be unit tests.
0035 
0036  * You can add a directory for your testcases under test.d/ if needed.
0037 
0038  * The test cases should run on dash (busybox shell) for testing on
0039    minimal cross-build environments.
0040 
0041  * Note that the tests are run with "set -e" (errexit) option. If any
0042    command fails, the test will be terminated immediately.
0043 
0044  * The tests can return some result codes instead of pass or fail by
0045    using exit_unresolved, exit_untested, exit_unsupported and exit_xfail.
0046 
0047 Result code
0048 ===========
0049 
0050 Ftracetest supports following result codes.
0051 
0052  * PASS: The test succeeded as expected. The test which exits with 0 is
0053          counted as passed test.
0054 
0055  * FAIL: The test failed, but was expected to succeed. The test which exits
0056          with !0 is counted as failed test.
0057 
0058  * UNRESOLVED: The test produced unclear or intermidiate results.
0059              for example, the test was interrupted
0060                        or the test depends on a previous test, which failed.
0061                        or the test was set up incorrectly
0062              The test which is in above situation, must call exit_unresolved.
0063 
0064  * UNTESTED: The test was not run, currently just a placeholder.
0065              In this case, the test must call exit_untested.
0066 
0067  * UNSUPPORTED: The test failed because of lack of feature.
0068                In this case, the test must call exit_unsupported.
0069 
0070  * XFAIL: The test failed, and was expected to fail.
0071           To return XFAIL, call exit_xfail from the test.
0072 
0073 There are some sample test scripts for result code under samples/.
0074 You can also run samples as below:
0075 
0076   # ./ftracetest samples/
0077 
0078 TODO
0079 ====
0080 
0081  * Fancy colored output :)
0082