Skip to content

Commit

Permalink
selftests/ftrace: fix event-no-pid on 1-core machine
Browse files Browse the repository at this point in the history
[ Upstream commit 07b6071 ]

When running event-no-pid test on small machines (e.g. cloud 1-core
instance), other events might not happen:

    + cat trace
    + cnt=0
    + [ 0 -eq 0 ]
    + fail No other events were recorded
    [15] event tracing - restricts events based on pid notrace filtering [FAIL]

Schedule a simple sleep task to be sure that some other process events
get recorded.

Fixes: ebed962 ("selftests/ftrace: Add test to test new set_event_notrace_pid file")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
krzk authored and gregkh committed Jul 14, 2021
1 parent 57e49a0 commit 7864617
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tools/testing/selftests/ftrace/test.d/event/event-no-pid.tc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ enable_events() {
echo 1 > tracing_on
}

other_task() {
sleep .001 || usleep 1 || sleep 1
}

echo 0 > options/event-fork

do_reset
Expand Down Expand Up @@ -94,6 +98,9 @@ child=$!
echo "child = $child"
wait $child

# Be sure some other events will happen for small systems (e.g. 1 core)
other_task

echo 0 > tracing_on

cnt=`count_pid $mypid`
Expand Down

0 comments on commit 7864617

Please sign in to comment.