aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/ftrace (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-11-24ftracetest: Add instance create and delete testSteven Rostedt (Red Hat)1-0/+90
Create a test to test instance creation and deletion. Several tasks are created that create 3 directories and delete them. The tasks all create the same directories. This places a stress on the code that creates and deletes instances. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2015-11-03selftests: kprobe: Choose an always-defined function to probeBen Hutchings5-11/+11
do_fork() is no longer defined on x86, so probe _do_fork() instead. Fixes: 3033f14ab78c ("clone: support passing tls argument via C ...") Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-09-14selftests: change install command to rsyncBamvor Jian Zhang1-1/+1
The command of install could not handle the special files in exec testcases, change the default rule to rsync to fix this. The installation is unchanged after this commit. Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-05-26selftests/ftrace: install test.dTyler Baker1-0/+1
The ftrace test requires the directory test.d and all of it's contents to be present during execution. Use TEST_DIRS to ensure this is copied to the INSTALL_PATH. Acked-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Tyler Baker <tyler.baker@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-04-03ftracetest: Do not use usleep directlyNamhyung Kim3-6/+33
The usleep is only provided on distros from Redhat so running ftracetest on other distro resulted in failures due to the missing usleep. The reason of using [u]sleep in the test was to generate (scheduler) events. It can be done various ways like this: yield() { ping localhost -c 1 || sleep .001 || usleep 1 || sleep 1; } For more information to the history of this patch, please refer to: Link: http://lkml.kernel.org/r/1427329943-16896-1-git-send-email-namhyung@kernel.org Reported-by: Michael Ellerman <mpe@ellerman.id.au> Reported-by: Dave Jones <davej@codemonkey.org.uk> Reported-by: Luis Henriques <luis.henriques@canonical.com> Suggested-by: Pádraig Brady <P@draigBrady.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-03-31ftracetest: Convert exit -1 to exit $FAILMichael Ellerman7-7/+7
POSIX says that exit takes an unsigned integer between 0 and 255, so using -1 doesn't work on POSIX shells. There is already a well-defined failure code, $FAIL (1), so use that. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Acked-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-03-31ftracetest: Cope properly with stack tracer not being enabledMichael Ellerman1-1/+3
If the stack tracer (CONFIG_STACK_TRACER) is disabled, the fgraph-filter-stack test blows chunks: [8] ftrace - function graph filters with stack tracer [FAIL] + reset_tracer + echo nop ./ftracetest: 19: /home/michael/selftests/ftrace/test.d/ftrace/fgraph-filter-stack.tc: cannot create /proc/sys/kernel/stack_tracer_enabled: Directory nonexistent Fix it by checking if the proc file exists before echoing to it. With the patch applied it fails correctly with: [8] ftrace - function graph filters with stack tracer [UNSUPPORTED] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Acked-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-03-13selftests: Introduce minimal shared logic for running testsMichael Ellerman1-2/+3
This adds a Make include file which most selftests can then include to get the run_tests logic. On its own this has the advantage of some reduction in repetition, and also means the pass/fail message is defined in fewer places. However the key advantage is it will allow us to implement install very simply in a subsequent patch. The default implementation just executes each program in $(TEST_PROGS). We use a variable to hold the default implementation of $(RUN_TESTS) because that gives us a clean way to override it if necessary, ie. using override. The mount, memory-hotplug and mqueue tests use that to provide a different implementation. Tests are not run via /bin/bash, so if they are scripts they must be executable, we add a+x to several. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> 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: Add basic event tracing test casesNamhyung Kim4-0/+158
This patch adds basic event tracing tests like enable/disable with top-level, subsystem-level and individual event files. # ./ftracetest === Ftrace unit tests === [1] Basic trace file check [PASS] [2] Basic trace clock test [PASS] [3] Basic event tracing check [PASS] [4] Basic test for tracers [PASS] [5] event tracing - enable/disable with top level files [PASS] [6] event tracing - enable/disable with subsystem level files [PASS] [7] event tracing - enable/disable with event level files [PASS] [8] ftrace - function graph filters [PASS] [9] ftrace - function profiler with function tracing [PASS] [10] ftrace - function graph filters with stack tracer [PASS] [11] Kretprobe dynamic event with arguments [PASS] [12] Kprobe dynamic event - busy event check [PASS] [13] Kprobe dynamic event with arguments [PASS] [14] Kprobe dynamic event - adding and removing [PASS] # of passed: 14 # of failed: 0 # of unresolved: 0 # of untested: 0 # of unsupported: 0 # of xfailed: 0 # of undefined(test bug): 0 Link: http://lkml.kernel.org/r/1415239470-28705-3-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: Clear trace buffer after running kprobe testcasesNamhyung Kim4-0/+4
The kprobe testcases create, use and delete dynamic events during the test but didn't clear the trace buffer so it'll leave the result after it finishes. # ./ftracetest ... # cat trace # tracer: nop # # entries-in-buffer/entries-written: 2/2 #P:12 # # _-----=> irqs-off # / _----=> need-resched # | / _---=> hardirq/softirq # || / _--=> preempt-depth # ||| / delay # TASK-PID CPU# |||| TIMESTAMP FUNCTION # | | | |||| | | ftracetest-26474 [009] d..1 79417.143782: Unknown type 1099 ftracetest-26498 [009] d..1 79417.208034: Unknown type 1101 Link: http://lkml.kernel.org/r/1415239470-28705-2-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: 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 a couple of ftrace test casesSteven Rostedt (Red Hat)3-0/+221
Added three test cases to get the feel of adding tests to ftracetest. The three cases are: function profiling test, to make sure function profiling still works with function tracing (was a regression) function graph filter test to make sure that function graph filtering works. function graph filter with stack tracing test to make sure that the function graph filter does filter and also continues to filter when another function tracer is running (like the stack tracer) Link: http://lkml.kernel.org/r/20141103212737.696365174@goodmis.org Link: http://lkml.kernel.org/r/20141104153028.602754370@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-06ftracetest: Add functions file that holds helper functionsSteven Rostedt (Red Hat)2-0/+19
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: Add kprobes on ftrace testcaseHeiko Carstens1-0/+55
Add a kprobes on ftrace testcase. The testcase verifies that - enabling and disabling function tracing works on a function which already contains a dynamic kprobe - adding and removing a dynamic kprobe works on a function which is already enabled for function tracing Link: http://lkml.kernel.org/p/1413802323-5297-2-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-08tracing/kprobes: Add selftest scripts testing kprobe-tracer as startup testMasami Hiramatsu2-0/+31
Add two selftest scripts which tests kprobe-tracer as the startup selftest does. These test cases are testing that the kprobe_event can accept a kprobe event with $stack related arguments and a kretprobe event with $retval argument. Link: http://lkml.kernel.org/p/20141008040307.13415.45145.stgit@kbuild-f20.novalocal Signed-off-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 Hiramatsu13-33/+189
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: Add kprobe basic testcasesMasami Hiramatsu2-0/+25
Add basic testcases for kprobe dynamic events. This also shows that the ftracetest accepts sub-directory for new testcases. Link: http://lkml.kernel.org/p/20140922234254.23415.46964.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: Add ftrace basic testcasesMasami Hiramatsu3-0/+17
Add ftrace basic testcases. This just checks ftrace debugfs interface works as it is designed. Link: http://lkml.kernel.org/p/20140922234252.23415.62897.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 Hiramatsu4-0/+215
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>