[DTrace-devel] [PATCH] test: rework main lockstat test

Kris Van Hees kris.van.hees at oracle.com
Wed May 31 05:52:32 UTC 2023


The main lockstat test (tst.lockstat.sh) didn't need to be implemented
using a shell script.  It has been reworked to be a regular .d script
with a .t trigger executable script.  Because of varying kernel options
between aarch64 and x86_64, each arch gets its own expected output.

Test failures may be reported if kernel configurations differ from those
used for UEK6 and UEK7.  More specific tests (configured based on the
kernel configuration of the runtime kernel) will need to be developed to
make this type of testing more effective.

The test has been renamed as tst.lockstat-summary.d to reflect that it is
a test the summarizes the overall implementation of lockstat probes.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 .../lockstat/tst.lockstat-summary.aarch64.r   | 13 +++++++++
 ...tst.lockstat.sh => tst.lockstat-summary.d} | 27 +++++--------------
 test/unittest/lockstat/tst.lockstat-summary.t |  3 +++
 .../lockstat/tst.lockstat-summary.x86_64.r    | 13 +++++++++
 4 files changed, 36 insertions(+), 20 deletions(-)
 create mode 100644 test/unittest/lockstat/tst.lockstat-summary.aarch64.r
 rename test/unittest/lockstat/{tst.lockstat.sh => tst.lockstat-summary.d} (72%)
 create mode 100755 test/unittest/lockstat/tst.lockstat-summary.t
 create mode 100644 test/unittest/lockstat/tst.lockstat-summary.x86_64.r

diff --git a/test/unittest/lockstat/tst.lockstat-summary.aarch64.r b/test/unittest/lockstat/tst.lockstat-summary.aarch64.r
new file mode 100644
index 00000000..830d5258
--- /dev/null
+++ b/test/unittest/lockstat/tst.lockstat-summary.aarch64.r
@@ -0,0 +1,13 @@
+Minimum lockstat events seen
+
+lockstat:::adaptive-spin - yes
+lockstat:::adaptive-block - yes
+lockstat:::adaptive-acquire - yes
+lockstat:::adaptive-release - yes
+lockstat:::rw-spin - yes
+lockstat:::rw-acquire - no
+lockstat:::rw-release - no
+lockstat:::spin-spin - yes
+lockstat:::spin-acquire - no
+lockstat:::spin-release - no
+
diff --git a/test/unittest/lockstat/tst.lockstat.sh b/test/unittest/lockstat/tst.lockstat-summary.d
similarity index 72%
rename from test/unittest/lockstat/tst.lockstat.sh
rename to test/unittest/lockstat/tst.lockstat-summary.d
index dfa118e8..70b51ea4 100755
--- a/test/unittest/lockstat/tst.lockstat.sh
+++ b/test/unittest/lockstat/tst.lockstat-summary.d
@@ -1,24 +1,12 @@
-#!/bin/bash
-#
-# Oracle Linux DTrace.
-# Copyright (c) 2017, 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.
-#
+/*
+ * Oracle Linux DTrace.
+ * Copyright (c) 2006, 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.
+ */
 
-#
-# Test lockstat:::*acquire*, *release probes.
-#
-#
+#pragma D option quiet
 
-if (( $# != 1 )); then
-	print -u2 "expected one argument: <dtrace-path>"
-	exit 2
-fi
-
-dtrace=$1
-
-$dtrace $dt_flags -c "sleep 10" -qs /dev/stdin <<EODTRACE
 lockstat:::
 {
 	events[probename]++;
@@ -52,4 +40,3 @@ END
 	printf("lockstat:::spin-release - %s\n",
 	    events["spin-release"] > 0 ? "yes" : "no");
 }
-EODTRACE
diff --git a/test/unittest/lockstat/tst.lockstat-summary.t b/test/unittest/lockstat/tst.lockstat-summary.t
new file mode 100755
index 00000000..fec0d271
--- /dev/null
+++ b/test/unittest/lockstat/tst.lockstat-summary.t
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+sleep 10s
diff --git a/test/unittest/lockstat/tst.lockstat-summary.x86_64.r b/test/unittest/lockstat/tst.lockstat-summary.x86_64.r
new file mode 100644
index 00000000..5bdc40c6
--- /dev/null
+++ b/test/unittest/lockstat/tst.lockstat-summary.x86_64.r
@@ -0,0 +1,13 @@
+Minimum lockstat events seen
+
+lockstat:::adaptive-spin - yes
+lockstat:::adaptive-block - yes
+lockstat:::adaptive-acquire - yes
+lockstat:::adaptive-release - yes
+lockstat:::rw-spin - yes
+lockstat:::rw-acquire - yes
+lockstat:::rw-release - yes
+lockstat:::spin-spin - yes
+lockstat:::spin-acquire - yes
+lockstat:::spin-release - yes
+
-- 
2.40.1




More information about the DTrace-devel mailing list