aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/ftrace (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-01-05selftests: add EXTRA_CLEAN for clean targetbamvor.zhangjian@huawei.com1-3/+1
Some testcases need the clean extra data after running. This patch introduce the "EXTRA_CLEAN" variable to address this requirement. After KBUILD_OUTPUT is enabled in later patch, it will be easy to decide to if we need do the cleanup in the KBUILD_OUTPUT path(if the testcase ran immediately after compiled). Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-05selftests: remove useless TEST_DIRSbamvor.zhangjian@huawei.com1-1/+1
The TEST_DIRS was introduced in Commit e8c1d7cdf137 ("selftests: copy TEST_DIRS to INSTALL_PATH") for coping a whole directory in ftrace. After rsync(with -a) is introduced by Commit 900d65ee11aa ("selftests: change install command to rsync"). Rsync could handle the directory without the definition of TEST_DIRS. This patch simply replace TEST_DIRS with TEST_FILES in ftrace and remove the TEST_DIRS in tools/testing/selftest/lib.mk Acked-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>
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: Add a testcase for types of kprobe eventMasami Hiramatsu1-0/+37
Add a testcase for types of kprobe event. This checks kprobe event can accept and correctly expressed the arguments typed as s32, u32, x32 and bitfield. Here is the test result. ----- # ./ftracetest test.d/kprobe/kprobe_args_type.tc === Ftrace unit tests === [1] Kprobes event arguments with types [PASS] # of passed: 1 # 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/147928409063.22982.3499119203875115458.stgit@devbox Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-22selftests: ftrace: Add a testcase for function filter glob matchMasami Hiramatsu1-0/+49
Add function filter glob matching test case. This checks whether the kernel supports glob matching (front match, end match, middle match, side match, character class and '?'). Here is the test result. ----- ./ftracetest test.d/ftrace/func-filter-glob.tc === Ftrace unit tests === [1] ftrace - function glob filters [PASS] # of passed: 1 # 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/147928407589.22982.16364174511117104303.stgit@devbox 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: Hide ftracetest logs from gitMasami Hiramatsu1-0/+1
Hide ftracetest result log directory from git. Link: http://lkml.kernel.org/r/147928404640.22982.13173364949326289032.stgit@devbox Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-22selftests: ftrace: Fix trigger-mod to run without syscall traceMasami Hiramatsu1-1/+1
Since histogram trigger id.syscall depends on CONFIG_FTRACE_SYSCALLS, a testcase in trigger-modifier test fails if that config is disabled. Fix this bug by using flexible pattern to check the histogram output. Link: http://lkml.kernel.org/r/147928402670.22982.15589445159052676877.stgit@devbox Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-11-22selftests: ftrace: Check whether snapshot trigger is supported correctlyMasami Hiramatsu1-0/+5
If "snapshot" special file doesn't exist, that kernel does not support snapshot and snapshot trigger too. In that case snapshot trigger test results to unsupported instead of fail. Link: http://lkml.kernel.org/r/147928401215.22982.10411665829041109794.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 Hiramatsu2-1/+29
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-06-20ftracetest: Fix hist unsupported result in hist selftestsSteven Rostedt (Red Hat)3-15/+12
When histograms are not configured in the kernel, the ftracetest histogram selftests should return "unsupported" and not "Failed". To detect this, the test scripts have: FEATURE=`grep hist events/sched/sched_process_fork/trigger` if [ -z "$FEATURE" ]; then echo "hist trigger is not supported" exit_unsupported fi The problem is that '-e' is in effect and any error will cause the program to terminate. The grep for 'hist' fails, because it is not compiled it (thus unsupported), but because grep has an error code for failing to find the string, it causes the program to terminate, and is marked as a failed test. Namhyung Kim recommended to test for the "hist" file located in events/sched/sched_process_fork/hist instead, as it is more inline with the other checks. As the hist file is only created if the histogram feature is enabled, that is a valid check. Link: http://lkml.kernel.org/r/20160523151538.4ea9ce0c@gandalf.local.home Suggested-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Fixes: 76929ab51f0ee ("kselftests/ftrace: Add hist trigger testcases") Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-05-23Merge tag 'linux-kselftest-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftestLinus Torvalds2-2/+79
Pull kselftest updates from Shuah Khan: "This update for Kselftest adds: - a new ftrace testcase - fixes for ftrace and intel_pstate tests" * tag 'linux-kselftest-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: tools: testing: define the _GNU_SOURCE macro kselftests/ftrace: Add a test case for event pid filtering kselftests/ftrace: Detect tracefs mount point
2016-05-23ftracetest: Use proper logic to find process PIDSteven Rostedt (Red Hat)1-10/+5
Half of the test in instance-event.tc was updated to use $! to find the PID of the previous background process that was launched, but the second part of the test still used the parsing of "jobs", which does not work on all shells like $! does. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-05-16kselftests/ftrace: Add a test case for event pid filteringNamhyung Kim1-0/+72
Check event is filtered by set_event_pid and options/event-fork. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
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>
2016-05-09ftracetest: Add instance created, delete, read and enable event testSteven Rostedt (Red Hat)1-0/+143
Add a new ftrace test that creates three threads. One that creates and removes an ftrace instance, one that reads the instance, and one that enables and disables events in the instance. This is a stress test for accessing and removing instances at the same time. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-04-19kselftests/ftrace: Add a test for log2 modifier of hist triggerMasami Hiramatsu1-0/+10
Add a test for log2 modifier of hist trigger in hist_mod.tc. Here is the test result. ---- # ./ftracetest test.d/trigger/trigger-hist-mod.tc === Ftrace unit tests === [1] event trigger - test histogram modifiers [PASS] # of passed: 1 # 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/3f1ab735c06a50b1b40d3e96b8b6a3e5ea62fd86.1457029949.git.tom.zanussi@linux.intel.com Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Tom Zanussi <tom.zanussi@linux.intel.com> Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-04-19kselftests/ftrace: Add hist trigger testcasesMasami Hiramatsu3-0/+221
Add the hist trigger testcases for ftracetest. This checks the basic histogram trigger behaviors like as; - Histogram trigger itself - Histogram with string key - Histogram with compound keys - Histogram with sort key - Histogram trigger modifiers (execname, hex, syscall) - Multiple histograms on an event - Named histogram - Named histogram on multi events Here is the test result. ---- # ./ftracetest test.d/trigger/*hist*.tc === Ftrace unit tests === [1] event trigger - test histogram modifiers [PASS] [2] event trigger - test histogram trigger [PASS] [3] event trigger - test multiple histogram triggers [PASS] # of passed: 3 # 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/17cb3a3d9eeadc3282645147905455a298e7fbeb.1457029949.git.tom.zanussi@linux.intel.com Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> [Tom Zanussi: Change multihist test from truncate ('>') to append ('>>')] Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-04-19kselftests/ftrace : Add event trigger testcasesMasami Hiramatsu6-0/+299
This adds simple event trigger testcases for ftracetest, which covers following triggers. - traceon-traceoff trigger - enable/disable_event trigger - snapshot trigger - stacktrace trigger - trigger filters Here is the test result. ---- # ./ftracetest test.d/trigger/ === Ftrace unit tests === [1] event trigger - test event enable/disable trigger [PASS] [2] event trigger - test trigger filter [PASS] [3] event trigger - test snapshot-trigger [PASS] [4] event trigger - test stacktrace-trigger [PASS] [5] event trigger - test traceon/off trigger [PASS] # of passed: 5 # 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/12b9c2b289a0dc1e4386e7b77674611a83abca85.1457029949.git.tom.zanussi@linux.intel.com Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Tom Zanussi <tom.zanussi@linux.intel.com> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
2016-03-17Merge tag 'linux-kselftest-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftestLinus Torvalds1-0/+1
Pull Kselftest updates from Shuah Khan: "This update for Kselftest adds: - A new feature to create test-specific kconfig fragments. This feature helps configure Kselftests to test specific Kernel Configuration options as opposed to defconfig. - A new test for Media Controller API - A few fixes" * tag 'linux-kselftest-4.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests: media_dcevice_test fix usage information selftests: media_dcevice_test fix to handle ioctl failure case selftests: add missing .gitignore file or entry Makefile: add kselftest-merge selftests: create test-specific kconfig fragments selftests: breakpoint: add step_after_suspend_test selftests: add a new test for Media Controller API
2016-02-25selftests: create test-specific kconfig fragmentsBamvor Jian Zhang1-0/+1
Create the config file in each directory of testcase which need more kernel configuration than the default defconfig. User could use these configs with merge_config.sh script: Enable config for specific testcase: (export ARCH=xxx #for cross compiling) ./scripts/kconfig/merge_config.sh .config \ tools/testing/selftests/xxx/config Enable configs for all testcases: (export ARCH=xxx #for cross compiling) ./scripts/kconfig/merge_config.sh .config \ tools/testing/selftests/*/config Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2016-02-19ftracetest: Fix instance test to use proper shell command for pidsSteven Rostedt1-10/+5
The ftracetest instance test used parsing of the "jobs" output to find the pid of the subshell that is executed previously. But this is not portable to all major shells that may run these tests. The proper way to get the pid of the subshell is the shell command "$!". This will return the pid of the previously executed command. Use that instead, otherwise the test does not work in all environments. Link: http://lkml.kernel.org/r/20151211143617.65f4d7a1@gandalf.local.home Reported-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
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>