• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Linux Ftrace Testcases
2
3This is a collection of testcases for ftrace tracing feature in the Linux
4kernel. Since ftrace exports interfaces via the debugfs, we just need
5shell scripts for testing. Feel free to add new test cases.
6
7Running the ftrace testcases
8============================
9
10At first, you need to be the root user to run this script.
11To run all testcases:
12
13  $ sudo ./ftracetest
14
15To run specific testcases:
16
17  # ./ftracetest test.d/basic3.tc
18
19Or you can also run testcases under given directory:
20
21  # ./ftracetest test.d/kprobe/
22
23Contributing new testcases
24==========================
25
26Copy test.d/template to your testcase (whose filename must have *.tc
27extension) and rewrite the test description line.
28
29 * The working directory of the script is <debugfs>/tracing/.
30
31 * Take care with side effects as the tests are run with root privilege.
32
33 * The tests should not run for a long period of time (more than 1 min.)
34   These are to be unit tests.
35
36 * You can add a directory for your testcases under test.d/ if needed.
37
38 * The test cases should run on dash (busybox shell) for testing on
39   minimal cross-build environments.
40
41 * Note that the tests are run with "set -e" (errexit) option. If any
42   command fails, the test will be terminated immediately.
43
44 * The tests can return some result codes instead of pass or fail by
45   using exit_unresolved, exit_untested, exit_unsupported and exit_xfail.
46
47Result code
48===========
49
50Ftracetest supports following result codes.
51
52 * PASS: The test succeeded as expected. The test which exits with 0 is
53         counted as passed test.
54
55 * FAIL: The test failed, but was expected to succeed. The test which exits
56         with !0 is counted as failed test.
57
58 * UNRESOLVED: The test produced unclear or intermidiate results.
59             for example, the test was interrupted
60                       or the test depends on a previous test, which failed.
61                       or the test was set up incorrectly
62             The test which is in above situation, must call exit_unresolved.
63
64 * UNTESTED: The test was not run, currently just a placeholder.
65             In this case, the test must call exit_untested.
66
67 * UNSUPPORTED: The test failed because of lack of feature.
68               In this case, the test must call exit_unsupported.
69
70 * XFAIL: The test failed, and was expected to fail.
71          To return XFAIL, call exit_xfail from the test.
72
73There are some sample test scripts for result code under samples/.
74You can also run samples as below:
75
76  # ./ftracetest samples/
77
78TODO
79====
80
81 * Fancy colored output :)
82
83