alistair23-linux/tools/testing/selftests/ftrace
Linus Torvalds bc0f51d359 A few more minor updates:
- Show the tgid mappings for user space trace tools to use
 
  - Fix and optimize the comm and tgid cache recording
 
  - Sanitize derived kprobe names
 
  - Ftrace selftest updates
 
  - trace file header fix
 
  - Update of Documentation/trace/ftrace.txt
 
  - Compiler warning fixes
 
  - Fix possible uninitialized variable
 -----BEGIN PGP SIGNATURE-----
 
 iQExBAABCAAbBQJZZ2rbFBxyb3N0ZWR0QGdvb2RtaXMub3JnAAoJEMm5BfJq2Y3L
 V3MIAI3NZ3dr0dKJ7DMF1jsQc24YF/bMG2noWm2b9+H/sO+gbnJKsizqzrB2Cm8S
 lFCYGSydLKGGZgKob3wkAX15iO2fxcUvJOKzkKxmyDbwAteABRf9LSr/llthRIsT
 8kSPI5bgJ5dah+lvhl9+1ekarsIZGr41svY97Knj9A2K18kQplnSNqgatkIuV2Kn
 hIoiPI0tG2y27In2JJoaTedAHj4NIwmI3nhTt6nks0GN7ICx3bMcvdE9l+zB+OLJ
 akAehsTk3kcNb66ttoj6ZTzGZ7kaes96Cl6/uamVpXzh3SXla36ux1r9Kp8bgONE
 EgrJwbRwU8BMDaattutDxT7/XmU=
 =TPGB
 -----END PGP SIGNATURE-----

Merge tag 'trace-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull more tracing updates from Steven Rostedt:
 "A few more minor updates:

   - Show the tgid mappings for user space trace tools to use

   - Fix and optimize the comm and tgid cache recording

   - Sanitize derived kprobe names

   - Ftrace selftest updates

   - trace file header fix

   - Update of Documentation/trace/ftrace.txt

   - Compiler warning fixes

   - Fix possible uninitialized variable"

* tag 'trace-v4.13-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  ftrace: Fix uninitialized variable in match_records()
  ftrace: Remove an unneeded NULL check
  ftrace: Hide cached module code for !CONFIG_MODULES
  tracing: Do note expose stack_trace_filter without DYNAMIC_FTRACE
  tracing: Update Documentation/trace/ftrace.txt
  tracing: Fixup trace file header alignment
  selftests/ftrace: Add a testcase for kprobe event naming
  selftests/ftrace: Add a test to probe module functions
  selftests/ftrace: Update multiple kprobes test for powerpc
  trace/kprobes: Sanitize derived event names
  tracing: Attempt to record other information even if some fail
  tracing: Treat recording tgid for idle task as a success
  tracing: Treat recording comm for idle task as a success
  tracing: Add saved_tgids file to show cached pid to tgid mappings
2017-07-13 13:17:19 -07:00
..
samples ftracetest: Add POSIX.3 standard and XFAIL result codes 2014-10-03 16:44:02 -04:00
test.d A few more minor updates: 2017-07-13 13:17:19 -07:00
.gitignore selftests: ftrace: Hide ftracetest logs from git 2016-11-22 15:53:42 -05:00
config selftests: ftrace: add CONFIG_KPROBES=y to the config fragment 2017-04-11 09:38:22 -06:00
ftracetest selftests/ftrace: Add instance indication in test log 2017-06-07 11:00:01 -06:00
Makefile selftests: enable O and KBUILD_OUTPUT 2017-01-05 13:42:22 -07:00
README ftracetest: Add POSIX.3 standard and XFAIL result codes 2014-10-03 16:44:02 -04:00

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 :)