linux/tools/testing/selftests/ftrace
Linus Torvalds f4267b3604 Masami had a couple more fixes to the synthetic events. One was a proper
error return value, and the other is for the self tests.
 -----BEGIN PGP SIGNATURE-----
 
 iIoEABYIADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCW9hYsBQccm9zdGVkdEBn
 b29kbWlzLm9yZwAKCRAp5XQQmuv6qiWPAQCARhYpeiWNHYGAirpI1vxaNHzutZvP
 j6eaqRXu0JDfsQD7Bb19KxSHUEaPSpZIo68N5OJkoTv9UxD2KYuRysu4VQ8=
 =y1Gc
 -----END PGP SIGNATURE-----

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

Pull tracing fixes from Steven Rostedt:
 "Masami had a couple more fixes to the synthetic events. One was a
  proper error return value, and the other is for the self tests"

* tag 'trace-v4.19-rc8-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  selftests/ftrace: Fix synthetic event test to delete event correctly
  tracing: Return -ENOENT if there is no target synthetic event
2018-10-30 09:47:28 -07:00
..
samples ftracetest: Add POSIX.3 standard and XFAIL result codes 2014-10-03 16:44:02 -04:00
test.d Masami had a couple more fixes to the synthetic events. One was a proper 2018-10-30 09:47:28 -07:00
.gitignore selftests: ftrace: Hide ftracetest logs from git 2016-11-22 15:53:42 -05: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
config selftests/ftrace: Add wakeup tracer testcase 2018-10-24 14:49:36 -06:00
ftracetest selftests/ftrace: Strip escape sequences for log file 2018-10-24 14:49:37 -06:00

README

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