mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
tracing: Skip selftests if tracing is disabled
If tracing is disabled for some reason (traceoff_on_warning, command line, etc), the ftrace selftests are guaranteed to fail, as their results are defined by trace data in the ring buffers. If the ring buffers are turned off, the tests will fail, due to lack of data. Because tracing being disabled is for a specific reason (warning, user decided to, etc), it does not make sense to enable tracing to run the self tests, as the test output may corrupt the reason for the tracing to be disabled. Instead, simply skip the self tests and report that they are being skipped due to tracing being disabled. Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
f40fc799af
commit
ee666a1855
@ -1929,6 +1929,12 @@ static int run_tracer_selftest(struct tracer *type)
|
||||
if (!selftests_can_run)
|
||||
return save_selftest(type);
|
||||
|
||||
if (!tracing_is_on()) {
|
||||
pr_warn("Selftest for tracer %s skipped due to tracing disabled\n",
|
||||
type->name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Run a selftest on this tracer.
|
||||
* Here we reset the trace buffer, and set the current
|
||||
|
Loading…
Reference in New Issue
Block a user