aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/ftrace/ftracetest (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-07-18Merge tag 'trace-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-traceLinus Torvalds1-6/+32
Pull tracing updates from Steven Rostedt: "The main changes in this release include: - Add user space specific memory reading for kprobes - Allow kprobes to be executed earlier in boot The rest are mostly just various clean ups and small fixes" * tag 'trace-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (33 commits) tracing: Make trace_get_fields() global tracing: Let filter_assign_type() detect FILTER_PTR_STRING tracing: Pass type into tracing_generic_entry_update() ftrace/selftest: Test if set_event/ftrace_pid exists before writing ftrace/selftests: Return the skip code when tracing directory not configured in kernel tracing/kprobe: Check registered state using kprobe tracing/probe: Add trace_event_call accesses APIs tracing/probe: Add probe event name and group name accesses APIs tracing/probe: Add trace flag access APIs for trace_probe tracing/probe: Add trace_event_file access APIs for trace_probe tracing/probe: Add trace_event_call register API for trace_probe tracing/probe: Add trace_probe init and free functions tracing/uprobe: Set print format when parsing command tracing/kprobe: Set print format right after parsed command kprobes: Fix to init kprobes in subsys_initcall tracepoint: Use struct_size() in kmalloc() ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS ftrace: Enable trampoline when rec count returns back to one tracing/kprobe: Do not run kprobe boot tests if kprobe_event is on cmdline tracing: Make a separate config for trace event self tests ...
2019-07-16ftrace/selftests: Return the skip code when tracing directory not configured in kernelSteven Rostedt (VMware)1-6/+32
If the kernel is not configured with ftrace enabled, the ftracetest selftests should return the error code of "4" as that is the kselftests "skip" code, and not "1" which means an error. To determine if ftrace is enabled, first the newer "tracefs" is searched for in /proc/mounts. If it is not found, then "debugfs" is searched for (as old kernels do not have tracefs). If that is not found, an attempt to mount the tracefs or debugfs is performed. This is done by seeing first if the /sys/kernel/tracing directory exists. If it does than tracefs is configured in the kernel and an attempt to mount it is performed. If /sys/kernel/tracing does not exist, then /sys/kernel/debug is tested to see if that directory exists. If it does, then an attempt to mount debugfs on that directory is performed. If it does not exist, then debugfs is not configured in the running kernel and the test exits with the skip code. If either mount fails, then a normal error is returned as they do exist in the kernel but something went wrong to mount them. This changes the test to always try the tracefs file system first as it has been in the kernel for some time now and it is better to test it if it is available instead of always testing debugfs. Link: http://lkml.kernel.org/r/20190702062358.7330-1-po-hsu.lin@canonical.com Reported-by: Po-Hsu Lin <po-hsu.lin@canonical.com> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 472Thomas Gleixner1-1/+1
Based on 1 normalized pattern(s): released under the terms of the gpl v2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 5 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Enrico Weigelt <info@metux.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081203.398003637@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-24selftests/ftrace: Add checkbashisms meta-testcaseMasami Hiramatsu1-0/+1
Add a meta-testcase which tests ftracetest itself with checkbasisms. This helps us to keep our test script bashisms clean. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2019-02-25selftests/ftrace: Handle the absence of tputJuerg Haefliger1-2/+2
In environments where tput is not available, we get the following error $ ./ftracetest: 163: [: Illegal number: because ncolors is an empty string. Fix that by setting it to 0 if the tput command fails. Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Juerg Haefliger <juergh@canonical.com> Signed-off-by: Shuah Khan <shuah@kernel.org>
2019-02-22selftests/ftrace: Replace \e with \033Juerg Haefliger1-4/+4
The \e sequence character is not POSIX. Fix that by using \033 instead. Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Juerg Haefliger <juergh@canonical.com> Signed-off-by: Shuah Khan <shuah@kernel.org>
2019-02-22selftests/ftrace: Replace echo -e with printfJuerg Haefliger1-2/+7
echo -e is not POSIX. Depending on what /bin/sh is, we can get incorrect output like: $ -e -n [1] Basic trace file check $ -e [PASS] Fix that by using printf instead. Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Juerg Haefliger <juergh@canonical.com> Signed-off-by: Shuah Khan <shuah@kernel.org>
2018-10-24selftests/ftrace: Strip escape sequences for log fileMasami Hiramatsu1-2/+9
Strip escape sequences from the stream to the ftracetest summary log file. Note that all test-case results are dumped raw in each file. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-10-24selftests/ftrace: Use colored output when availableDaniel Díaz1-7/+22
If test is being directly executed (with stdout opened on the terminal) and the terminal capabilities indicate enough colors, then use the existing scheme of green, red, and blue to show when tests pass, fail or end in a different way. When running the tests redirecting the stdout, for instance, to a file, then colors are not shown, thus producing a more readable output. Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-10-24selftests/ftrace: Add color to the PASS / FAIL resultsSteven Rostedt (VMware)1-8/+8
Now that ftracetest has over 80 tests, it is difficult to simply scroll up the console window to find the failed tests when it reports just two tests have failed. In order to make this stand out better, have the color of the word "PASS" be green, "FAIL" and "XFAIL" be red, and all other results be blue. This helps tremendously in quickly spotting the failed tests by just scrolling up the console window. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-10-24selftests/ftrace: Cleanup ftrace after running testMasami Hiramatsu1-0/+1
Cleanup ftrace by initialize_ftrace() after running all test cases. This means we also don't need cleanup ftrace on each test case, except for some special options. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-10-24selftests/ftrace: Add case number prefix to logfileMasami Hiramatsu1-2/+2
Add a case number prefix to each logfile. This makes it easier to find which logfile is corresponding to which failure. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-10-24selftests/ftrace: Add --console hidden optionMasami Hiramatsu1-1/+13
Add --console hidden option for debug test cases. This option allows to put "sh" or something else when the test case hits a bug. For example, if you find a testcase which doesn't pass, you can insert sh for interactive debug as below ----- #!/bin/sh # description: sample test case good-command suspicious-wrong-command sh # <- add this for interactive debug ----- Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-10-24selftests/ftrace: Add --stop-fail hidden option for debugMasami Hiramatsu1-0/+13
Add --stop-fail option for debugging the ftracetest. With this option, ftracetest stops right after a testcase fails instead of finish running all testcases. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2017-11-15selftests/ftrace: Introduce exit_pass and exit_failMasami Hiramatsu1-0/+7
As same as other results, introduce exit_pass and exit_fail functions so that we can easily understand what will happen. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: ftrace: Check given string is not zero-lengthMasami Hiramatsu1-3/+3
Use [ ! -z "$VAR" ] instead of [ "$VAR" ] to check whether the given string variable is not zero-length since it obviously shows what it means. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: ftrace: Output only to console with "--logdir -"Masami Hiramatsu1-8/+21
Output logs only to console if "-" is given to --logdir option. In this case, ftracetest doesn't record any log on the disk, and all logs immediately shown (including all command logs.) Since there is no "tee" in the middle of command and console, it outputs the log really soon. This option is useful only when the console is logged. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: ftrace: Add more verbosity for immediate logMasami Hiramatsu1-3/+7
Add 3-level verbosity for showing traced command log on console immediately. Since some test cases can cause kernel pacic if there is a probrem (like regression etc.), we can not know which command caused the problem without traced command log. This verbosity (-vvv) solves that because it shows the log on console immediately. User can get continuous command/error log. Note that this is a kind of kernel debug mode, if you don't see any kernel related issue, you don't need this verbosity. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: ftrace: Add --fail-unsupported optionMasami Hiramatsu1-1/+7
Add --fail-unsupported option to fail the test result if ftracetest gets UNSUPPORTED result. UNSUPPORTED usually happens when the kernel is old (e.g. stable tree) or some kernel feature is disabled. However, if newer kernel has any bug or regression, it can make test results in UNSUPPORTED too. This option can detect such kernel regression. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-07-26selftests: ftrace: Do not failure if there is unsupported testsMasami Hiramatsu1-1/+1
Do not return failure exit code (1) for unsupported testcases, since it is expected for stable kernels. Previously, ftracetest is expected to run only on current release for avoiding regressions. However, nowadays we run it on stable kernels. This means some test cases must return unsupported result. In such case, we should NOT exit ftracetest with error status for unsupported results so that kselftest (upper tests wrapper) shows it passed correctly. Note that we continue to treat unresolved results as failure, if test writers would like to notice user that the test result should be reviewed, they can use exit_unresolved. Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Steven Rostedt (VMware) <srostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-07selftests/ftrace: Add instance indication in test logMasami Hiramatsu1-1/+1
Add instance test indication in test log too. Current ftracetest shows instance test indication on the list of test, but not in the log for each test. This adds instance test indication on the top of each log, like below; execute (instance) : /ftrace/test.d/ftrace/func_set_ftrace_file.tc Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-05-17selftests/ftrace: Fix bashismsNaveen N. Rao1-1/+1
Fix a few bashisms in ftrace selftests. Link: http://lkml.kernel.org/r/5fbf4613eef0766918fa04e3ff537cae271223ee.1494956770.git.naveen.n.rao@linux.vnet.ibm.com Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-26selftests: ftrace: Allow some tests to be run in a tracing instanceSteven Rostedt (VMware)1-1/+17
An tracing instance has several of the same capabilities as the top level instance, but may be implemented slightly different. Instead of just writing tests that duplicat the same test cases of the top level instance, allow a test to be written for both the top level as well as for an instance. If a test case can be run in both the top level as well as in an tracing instance directory, then it should add a tag "# flags: instance" in the header of the test file. Then after all tests have run, any test that has an instance flag set, will run again within a tracing instance. Link: http://lkml.kernel.org/r/20170421233850.1d0e9e05@gandalf.local.home Cc: Shuah Khan <shuah@kernel.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2017-04-17selftests: ftrace: Add -l/--logdir optionNamhyung Kim1-0/+5
In my virtual machine setup, running ftracetest failed on creating LOG_DIR on a read-only filesystem. It'd be convenient to provide an option to specify a different directory as log directory. Link: http://lkml.kernel.org/r/20170417024430.21194-4-namhyung@kernel.org Cc: Ingo Molnar <mingo@kernel.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Cc: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2016-12-13selftests: ftrace: Shift down default message verbosityMasami Hiramatsu1-11/+7
Shift down default message verbosity, where it does not show error results in stdout by default. Since that behavior is the same as giving the --quiet option, this patch removes --quiet and makes --verbose increasing verbosity. In other words, this changes verbosity options as below. ftracetest -q -> ftracetest ftracetest -> ftracetest -v ftracetest -v -> ftracetest -v -v (or -vv) Link: http://lkml.kernel.org/r/148007872763.5917.15256235993753860592.stgit@devbox Acked-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-22selftests: ftrace: Introduce TMPDIR for temporary filesMasami Hiramatsu1-0/+2
Introduce TMPDIR variable which is removed after each test is done, so that the test script can put their temporary files in that. Link: http://lkml.kernel.org/r/147928406116.22982.8761924340108532378.stgit@devbox Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-22selftests: ftrace: Add --quiet option not to show error logs on screenMasami Hiramatsu1-1/+7
Since the verbose error logs scrolls out previous test results --quiet option suppress to show such message. e.g. # ./ftracetest -q === Ftrace unit tests === [1] Basic trace file check [PASS] [2] Basic test for tracers [PASS] [3] Basic trace clock test [PASS] [4] Basic event tracing check [PASS] [5] event tracing - enable/disable with event level files [PASS] [6] event tracing - restricts events based on pid [PASS] [7] event tracing - enable/disable with subsystem level files [PASS] [8] event tracing - enable/disable with top level files [PASS] [9] ftrace - function graph filters with stack tracer [UNSUPPORTED] [10] ftrace - function graph filters [UNSUPPORTED] [11] ftrace - function profiler with function tracing [UNSUPPORTED] [12] Test creation and deletion of trace instances while setting an event [PASS] [13] Test creation and deletion of trace instances [PASS] [14] Kprobe dynamic event - adding and removing [UNSUPPORTED] [15] Kprobe dynamic event - busy event check [UNSUPPORTED] [16] Kprobe dynamic event with arguments [UNSUPPORTED] [17] Kprobe dynamic event with function tracer [UNSUPPORTED] [18] Kretprobe dynamic event with arguments [UNSUPPORTED] [19] event trigger - test event enable/disable trigger [PASS] [20] event trigger - test trigger filter [PASS] [21] event trigger - test histogram modifiers [UNSUPPORTED] [22] event trigger - test histogram trigger [UNSUPPORTED] [23] event trigger - test multiple histogram triggers [UNSUPPORTED] [24] event trigger - test snapshot-trigger [FAIL] [25] event trigger - test stacktrace-trigger [PASS] [26] event trigger - test traceon/off trigger [PASS] # of passed: 14 # of failed: 1 # of unresolved: 0 # of untested: 0 # of unsupported: 11 # of xfailed: 0 # of undefined(test bug): 0 Link: http://lkml.kernel.org/r/147928399712.22982.8284640390982775052.stgit@devbox Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-22selftests: ftrace: Initialize ftrace before each testMasami Hiramatsu1-1/+1
Reset ftrace to initial state before running each test. This fixes some test cases to enable tracing before starting trace test. This can avoid false-positive failure when previous testcase fails while disabling tracing. Link: http://lkml.kernel.org/r/147928398192.22982.7767460638302113002.stgit@devbox Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-05-16kselftests/ftrace: Detect tracefs mount pointNamhyung Kim1-2/+7
Currently ftracetest assumes tracing directory is located under $DEBUGFS/tracing. But it's possible to mount tracefs directly without debugfs. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2014-12-04ftracetest: Add --verbose option for showing echo outputMasami Hiramatsu1-10/+23
Add --verbose/-v option for showing echo output in testcases. This is good for checking the progress of testcases which take a longer time to run. To implement this feature, all the testcase failures are captured in ftracetest and send signal to set SIG_RESULT=FAIL. Link: http://lkml.kernel.org/r/20141204194123.7376.22964.stgit@localhost.localdomain Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-12-04ftracetest: Fix to show descriptions on dashMasami Hiramatsu1-1/+2
The ftracetest doesn't show testcase's descriptions when it is executed on dash. This fixes that to show the descriptions on dash correctly by passing it via a variable instead of directly passing the grep command output. Link: http://lkml.kernel.org/r/20141204194116.7376.78940.stgit@localhost.localdomain Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-11-06ftracetest: Use logfile name supported by busybox's mktempNamhyung Kim1-1/+1
When I run the ftracetest in a busybox docker container, I saw following error. Make the logfile template to comply with busybox's mktemp. It also keep the logfiles under the logs directory. # /linux/tools/testing/selftests/ftrace/ftracetest === Ftrace unit tests === mktemp: unrecognized option `--tmpdir=/linux/tools/testing/selftests/ftrace/logs/20141106-003624/' BusyBox v1.22.1 (2014-05-22 23:22:11 UTC) multi-call binary. Usage: mktemp [-dt] [-p DIR] [TEMPLATE] Create a temporary file with name based on TEMPLATE and print its name. TEMPLATE must end with XXXXXX (e.g. [/dir/]nameXXXXXX). Without TEMPLATE, -t tmp.XXXXXX is assumed. -d Make directory, not file -q Fail silently on errors -t Prepend base directory name to TEMPLATE -p DIR Use DIR as a base directory (implies -t) -u Do not create anything; print a name Base directory is: -p DIR, else $TMPDIR, else /tmp [1] Basic trace file check/linux/tools/testing/selftests/ftrace/ftracetest: line 244: can't create : nonexistent directory /linux/tools/testing/selftests/ftrace/ftracetest: line 244: can't create : nonexistent directory [FAIL] Link: http://lkml.kernel.org/r/1415239470-28705-1-git-send-email-namhyung@kernel.org Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-11-06ftracetest: Add functions file that holds helper functionsSteven Rostedt (Red Hat)1-0/+3
Created the file tools/testing/ftrace/test.d/functions that will hold helper functions. Current helper functions include: Add clear_trace() helper to reset the trace file Used as a descriptive name to show that "echo > trace" is clearing the trace file. Add disable/enable_tracing() helper calls Add calls that disable and enable tracing respectively by echoing 0 or 1 into tracing_on. Add helper reset_tracer() function Add a helper function reset_tracer() that will clear the current_tracer (echo nop > current_tracer). Link: http://lkml.kernel.org/r/20141103212737.696365174@goodmis.org Link: http://lkml.kernel.org/r/20141104153028.465517119@goodmis.org Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-11-03ftracetest: Sort testcasesHeiko Carstens1-1/+1
Make sure the order of the executed testcases is always the same. Link: http://lkml.kernel.org/p/1413802323-5297-3-git-send-email-heiko.carstens@de.ibm.com Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-11-03ftracetest: Take the first debugfs mount foundSteven Rostedt (Red Hat)1-1/+1
Running ftracetests on a box that mounted debugfs in two locations made the ftracetests fail. This is because the tests uses a grep of debugfs from the /proc/mounts file to find the debugfs mount point, and then appends "/tracing" to that string to get the tracing directory. If the debugfs directory is mounted twice, then that grep will return two answers and appending "/tracing" to a string with two lines will not work. Use "head -1" to only take the first mount point found. Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-10-03ftracetest: Add POSIX.3 standard and XFAIL result codesMasami Hiramatsu1-15/+109
Add XFAIL and POSIX 1003.3 standard codes (UNRESOLVED/ UNTESTED/UNSUPPORTED) as result codes. These are used for the results that test case is expected to fail or unsupported feature (by config). To return these result code, this introduces exit_unresolved, exit_untested, exit_unsupported and exit_xfail functions, which use real-time signals to notify the result code to ftracetest. This also set "errexit" option for the testcases, so that the tests don't need to exit explicitly. Note that if the test returns UNRESOLVED/UNSUPPORTED/FAIL, its test log including executed commands is shown on console and main logfile as below. ------ # ./ftracetest samples/ === Ftrace unit tests === [1] failure-case example [FAIL] execute: /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/fail.tc + . /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/fail.tc ++ cat non-exist-file cat: non-exist-file: No such file or directory [2] pass-case example [PASS] [3] unresolved-case example [UNRESOLVED] execute: /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/unresolved.tc + . /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/unresolved.tc ++ trap exit_unresolved INT ++ kill -INT 29324 +++ exit_unresolved +++ kill -s 38 29265 +++ exit 0 [4] unsupported-case example [UNSUPPORTED] execute: /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/unsupported.tc + . /home/fedora/ksrc/linux-3/tools/testing/selftests/ftrace/samples/unsupported.tc ++ exit_unsupported ++ kill -s 40 29265 ++ exit 0 [5] untested-case example [UNTESTED] [6] xfail-case example [XFAIL] # of passed: 1 # of failed: 1 # of unresolved: 1 # of untested: 1 # of unsupported: 1 # of xfailed: 1 # of undefined(test bug): 0 ------ Link: http://lkml.kernel.org/p/20140929120211.30203.99510.stgit@kbuild-f20.novalocal Acked-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2014-09-23ftracetest: Initial commit for ftracetestMasami Hiramatsu1-0/+159
ftracetest is a collection of testcase shell-scripts for ftrace. To avoid regressions of ftrace, these testcases check correct ftrace behaviors. If someone would like to add any features on ftrace, the patch series should have at least one testcase for checking the new behavior. Link: http://lkml.kernel.org/p/20140922234250.23415.68758.stgit@kbuild-f20.novalocal Acked-by: Shuah Khan <shuahkh@osg.samsung.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>