]> git.proxmox.com Git - mirror_ubuntu-impish-kernel.git/commitdiff
selftests/ftrace: fix event-no-pid on 1-core machine
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Mon, 5 Jul 2021 15:47:33 +0000 (17:47 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 6 Jul 2021 11:20:06 +0000 (13:20 +0200)
BugLink: https://bugs.launchpad.net/bugs/1935807
BugLink: https://bugs.launchpad.net/bugs/1927749
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: ebed9628f5c2 ("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>
(cherry picked from commit 07b60713b57a8f952d029a2b6849d003d9c16108)
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
tools/testing/selftests/ftrace/test.d/event/event-no-pid.tc

index e6eb78f0b95459956c97117b12974d6cab0663b8..9933ed24f9012441b7bd28ed35ffca4e40514fc8 100644 (file)
@@ -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
@@ -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`