alistair23-linux/tools/testing/selftests/ftrace
Linus Torvalds 2a56bb596b New features:
- Tom Zanussi's extended histogram work
    This adds the synthetic events to have histograms from multiple event data
    Adds triggers "onmatch" and "onmax" to call the synthetic events
    Several updates to the histogram code from this
 
  - Allow way to nest ring buffer calls in the same context
 
  - Allow absolute time stamps in ring buffer
 
  - Rewrite of filter code parsing based on Al Viro's suggestions
 
  - Setting of trace_clock to global if TSC is unstable (on boot)
 
  - Better OOM handling when allocating large ring buffers
 
  - Added initcall tracepoints (consolidated initcall_debug code with them)
 
 And other various fixes and clean ups
 -----BEGIN PGP SIGNATURE-----
 
 iQHIBAABCgAyFiEEPm6V/WuN2kyArTUe1a05Y9njSUkFAlrLoCAUHHJvc3RlZHRA
 Z29vZG1pcy5vcmcACgkQ1a05Y9njSUks/QwAn/ky8WgfjcRdjKmBYuEwDedvm9iI
 V9G5kpv5JMw5dLz4l1pS3tA3M9Lyuc5z3Shw92FTy36vdU1wxEjQgHa7viB1xk9x
 KsiTyNjTsgrRd7GVHMy/8Be2RRiTRLaXKAsLCoj/c7QWzagV1P8XWlWK5mojYkh/
 DrSXyg9Avkp30+sU1bvcLWnmmZUFqMxs+bWipD9uFc98USMMyeP25nrnhrj0gDTg
 Q93cjXUuyVRC4lJ2YTW0GCSKhMKEw5f/ltEOT1hwScqYkCJj1EubKqS53R/9h21z
 IPUrYcqLnMRu0j2ejR+UAy5Vsy3gJUrPMQb0F6hlu1DwbMd0d/9SGh1c+Sm+zorh
 yftWTdCZsYrXkaOuB6V5M30X+KBwbWO0Xc9VCvgJ/IU5vMlgLSt5itTWbT/Fmfhb
 ll5/RXP7zhSXRv5sdl/BP3/4dd6F8jpyKyaR2Rk2+XjBOGIq5mvqNGr4Vj9AzxW8
 E0nvq7l7e0dbxZNM42gEm3cht1VUg7Zz0Y0+
 =91oN
 -----END PGP SIGNATURE-----

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

Pull tracing updates from Steven Rostedt:
 "New features:

   - Tom Zanussi's extended histogram work.

     This adds the synthetic events to have histograms from multiple
     event data Adds triggers "onmatch" and "onmax" to call the
     synthetic events Several updates to the histogram code from this

   - Allow way to nest ring buffer calls in the same context

   - Allow absolute time stamps in ring buffer

   - Rewrite of filter code parsing based on Al Viro's suggestions

   - Setting of trace_clock to global if TSC is unstable (on boot)

   - Better OOM handling when allocating large ring buffers

   - Added initcall tracepoints (consolidated initcall_debug code with
     them)

  And other various fixes and clean ups"

* tag 'trace-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (68 commits)
  init: Have initcall_debug still work without CONFIG_TRACEPOINTS
  init, tracing: Have printk come through the trace events for initcall_debug
  init, tracing: instrument security and console initcall trace events
  init, tracing: Add initcall trace events
  tracing: Add rcu dereference annotation for test func that touches filter->prog
  tracing: Add rcu dereference annotation for filter->prog
  tracing: Fixup logic inversion on setting trace_global_clock defaults
  tracing: Hide global trace clock from lockdep
  ring-buffer: Add set/clear_current_oom_origin() during allocations
  ring-buffer: Check if memory is available before allocation
  lockdep: Add print_irqtrace_events() to __warn
  vsprintf: Do not preprocess non-dereferenced pointers for bprintf (%px and %pK)
  tracing: Uninitialized variable in create_tracing_map_fields()
  tracing: Make sure variable string fields are NULL-terminated
  tracing: Add action comparisons when testing matching hist triggers
  tracing: Don't add flag strings when displaying variable references
  tracing: Fix display of hist trigger expressions containing timestamps
  ftrace: Drop a VLA in module_exists()
  tracing: Mention trace_clock=global when warning about unstable clocks
  tracing: Default to using trace_global_clock if sched_clock is unstable
  ...
2018-04-10 11:27:30 -07:00
..
samples ftracetest: Add POSIX.3 standard and XFAIL result codes 2014-10-03 16:44:02 -04:00
test.d New features: 2018-04-10 11:27:30 -07:00
.gitignore selftests: ftrace: Hide ftracetest logs from git 2016-11-22 15:53:42 -05:00
config selftests: ftrace: add more config fragments 2017-11-15 08:07:53 -07:00
ftracetest selftests/ftrace: Introduce exit_pass and exit_fail 2017-11-15 08:07:53 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01: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 :)