Skip to content

Commit

Permalink
test: Handle concurrent firing probes with exit()
Browse files Browse the repository at this point in the history
A few tests have profile probes that emit an expected message and then
exit.  The problem with this is that it is possible for two such probes,
on different CPUs, to fire "concurrently."  DTrace says that when exit()
occurs, other actions already in progress on other CPUs complete.

Fix the tests to allow for more than one instance of the expected
message.  Note that this is a race condition.  The problem being fixed
was observed only intermittently.  In some test runs, the failure was
seen only 3% of the time with tst.ZeroProviderProbes.sh and only 0.06%
of the time with tst.ZeroFunctionProbes.sh.

Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh authored and kvanhees committed Apr 22, 2022
1 parent 192d12c commit bbf2ebd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/unittest/dtrace-util/tst.ZeroFunctionProbes.r
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
I am done

2 changes: 1 addition & 1 deletion test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fi
dtrace=$1

$dtrace $dt_flags -qZf wassup'{printf("Iamkool");}' \
-qf read'{printf("I am done"); exit(0);}'
-qf read'{printf("I am done\n"); exit(0);}' | uniq

status=$?

Expand Down
1 change: 1 addition & 0 deletions test/unittest/dtrace-util/tst.ZeroProviderProbes.r
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
I am done

2 changes: 1 addition & 1 deletion test/unittest/dtrace-util/tst.ZeroProviderProbes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fi
dtrace=$1

$dtrace $dt_flags -qZP wassup'{printf("Iamkool");}' \
-qP profile'{printf("I am done"); exit(0);}'
-qP profile'{printf("I am done\n"); exit(0);}' | uniq

status=$?

Expand Down

0 comments on commit bbf2ebd

Please sign in to comment.