From: Francis Deslauriers Date: Tue, 7 Sep 2021 21:10:31 +0000 (-0400) Subject: Fix: Tests: race condition in test_event_tracker X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=c489057c2edf1e371cce5649fe17d681bbd5b5eb;hp=c489057c2edf1e371cce5649fe17d681bbd5b5eb;ds=sidebyside Fix: Tests: race condition in test_event_tracker Background ========== The `test_event_tracker` file contains test cases when the event generating app in executed in two distinct steps. Those two steps are preparation and execution. 1. the preparation is the launching the app in the background, and 2. the execution is actually generating the event that should or should not be traced depending on the test case. This is useful to test the tracker feature since we want to ensure that already running apps are notified properly when changing their tracking status. Issue ===== The `test_event_vpid_track_untrack` test case suffers from a race condition that is easy to reproduce on Yocto. The issue is that sometimes events are end up the trace when none is expected. This is due to the absence of synchronization point at the launch of the app which leads to the app being scheduled in-between the track-untrack calls leading to events being recorded to the trace. It's easy to reproduce this issue on my machine by adding a `sleep 5` between the track and untrack calls and setting the `NR_USEC_WAIT` variable to 1. Fix === Using the testapp `--sync-before-last-event-touch` flag to make the app create a file when all but the last event are executed. We then have the app wait until we create a file (`--sync-before-last-event`) to generate that last event. This way, we are sure no event will be generated when running the track and untrack commands. Notes ===== - This issue affects other test cases in this file. - This commit fixes a typo in the test header. - This commit adds `diag` calls to help tracking to what test the output relates to when reading the log. Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: Ia2b68128dc9a805526f9748f31ec2c2d95566f31 ---