[DTrace-devel] [PATCH 6/7] test: Update tst.ufuncsort.sh

eugene.loh at oracle.com eugene.loh at oracle.com
Tue Mar 12 01:00:56 UTC 2024


From: Eugene Loh <eugene.loh at oracle.com>

This test has not been passing due in large part to neglect.

Add -O0 compilation and keep the trigger running longer so that the
consumer can translate ufunc() names.  Update the .r results file.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 test/triggers/Build                      |  3 ++-
 test/triggers/profile-tst-ufuncsort.c    |  9 ++++++++-
 test/unittest/profile-n/tst.ufuncsort.r  | 10 +++++-----
 test/unittest/profile-n/tst.ufuncsort.sh |  7 +++++--
 4 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/test/triggers/Build b/test/triggers/Build
index 7363e420..0e8660e5 100644
--- a/test/triggers/Build
+++ b/test/triggers/Build
@@ -1,5 +1,5 @@
 # Oracle Linux DTrace.
-# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2024, 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.
 
@@ -190,6 +190,7 @@ pid-tst-ret1_CFLAGS := -O0
 pid-tst-ret2_CFLAGS := -O0
 pid-tst-weak1_CFLAGS := -O0
 pid-tst-weak2_CFLAGS := -O0
+profile-tst-ufuncsort_CFLAGS := -O0
 
 # usdt-tst-argmap calls USDT probes (defined in argmap.d) using sys/sdt.h
 usdt-tst-argmap_CFLAGS := -Iuts/common
diff --git a/test/triggers/profile-tst-ufuncsort.c b/test/triggers/profile-tst-ufuncsort.c
index a54fd6ec..45e93ca3 100644
--- a/test/triggers/profile-tst-ufuncsort.c
+++ b/test/triggers/profile-tst-ufuncsort.c
@@ -1,9 +1,10 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2024, 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.
  */
+#include <unistd.h>
 
 typedef void f(int x);
 
@@ -53,5 +54,11 @@ main()
 	fN(f_c, 103);
 	fN(f_c, 1003);
 
+	/* Add a long sleep, so the DTrace program can still convert user
+	 * addresses to symbols.  An excessively long sleep is okay since DTrace
+	 * can kill the target when it's done.
+	 */
+	usleep(100 * 1000 * 1000);
+
 	return 0;
 }
diff --git a/test/unittest/profile-n/tst.ufuncsort.r b/test/unittest/profile-n/tst.ufuncsort.r
index a364322b..c994b7f6 100644
--- a/test/unittest/profile-n/tst.ufuncsort.r
+++ b/test/unittest/profile-n/tst.ufuncsort.r
@@ -1,6 +1,6 @@
 
-  tst.ufuncsort.exe`f_a                                             3
-  tst.ufuncsort.exe`f_b                                             1
-  tst.ufuncsort.exe`f_c                                             4
-  tst.ufuncsort.exe`f_d                                             2
-  tst.ufuncsort.exe`f_e                                             1
+  profile-tst-ufuncsort`f_a                                         3
+  profile-tst-ufuncsort`f_b                                         1
+  profile-tst-ufuncsort`f_c                                         4
+  profile-tst-ufuncsort`f_d                                         2
+  profile-tst-ufuncsort`f_e                                         1
diff --git a/test/unittest/profile-n/tst.ufuncsort.sh b/test/unittest/profile-n/tst.ufuncsort.sh
index a44e3448..58879173 100755
--- a/test/unittest/profile-n/tst.ufuncsort.sh
+++ b/test/unittest/profile-n/tst.ufuncsort.sh
@@ -1,10 +1,9 @@
 #!/bin/bash
 #
 # Oracle Linux DTrace.
-# Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2024, 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.
-# @@xfail: needs userspace probes
 #
 
 ############################################################################
@@ -35,6 +34,10 @@ $dtrace $dt_flags -c test/triggers/profile-tst-ufuncsort -s /dev/stdin <<EOF
 	{
 		@[ufunc(arg0)] = count();
 	}
+	tick-1s
+	{
+		exit(0);
+	}
 EOF
 
 status=$?
-- 
2.18.4




More information about the DTrace-devel mailing list