Skip to content

Commit

Permalink
test: Convert tick-* probes to BEGIN probes for default-action test
Browse files Browse the repository at this point in the history
The tick-* mechanism can be fickle on some platforms.  Do not use
it for this test, which is intended simply to check default actions.

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 May 24, 2023
1 parent f7b94c2 commit fe7148f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 18 deletions.
30 changes: 17 additions & 13 deletions test/unittest/actions/default/tst.default.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace.
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
Expand All @@ -15,30 +15,34 @@
* SECTION: Actions and Subroutines/default
*/

/* should not trace, but should update n */
/* should not trace, but should set n=1 */
BEGIN
{ n = 1; }

/* should trace, "hello world" should appear */
tick-14
{ printf("hello world"); }
/* should trace, "hello world 1" should appear */
BEGIN
{ printf("hello world %d", n); }

/* should not trace, but should update n */
tick-13
/* should not trace, but should update n+=2 */
BEGIN
{ n += 2; }

/* should trace */
tick-12
/* should trace, and n should be 1+2=3 */
BEGIN
{ printf("%d", n); }

/* should trace, but not report anything */
BEGIN
{ }

/* should not trace, but should update n */
tick-11
/* should not trace, but should update n+=4 */
BEGIN
{ n += 4; }

/* should trace, and n should be 1+2+4=7 */
tick-10
BEGIN
{ trace(n); }

/* should trace */
tick-10
BEGIN
{ exit(0) }
11 changes: 6 additions & 5 deletions test/unittest/actions/default/tst.default.r
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FUNCTION:NAME
:tick-14 hello world
:tick-12
:tick-10 7
:tick-10
:BEGIN hello world 1
:BEGIN 3
:BEGIN
:BEGIN 7
:BEGIN

-- @@stderr --
dtrace: script 'test/unittest/actions/default/tst.default.d' matched 7 probes
dtrace: script 'test/unittest/actions/default/tst.default.d' matched 8 probes

0 comments on commit fe7148f

Please sign in to comment.