[DTrace-devel] [PATCH] tests: repair accidentally deleted tst.pidprobes.sh
Nick Alcock
nick.alcock at oracle.com
Fri Nov 8 21:12:00 UTC 2024
My intent when writing the earlier tests was to have
test/unittest/usdt/pidprobes.sh as a sort of shell script library
called by tst.pidprobes.sh, tst.pidargs.sh and tst.pidargmap.sh.
Alas, *.sh is executed as a test by runtest.sh, so
pidprobes.sh was treated as a test, not a library. So rename it
back to what it was called before and make sure it works when
invoked directly by runtest.sh, but also let it be called by
the other two tests to test other corners of this.
(Also: apply some small review comments that never made it
before the previous patch hit dev.)
Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
test/unittest/usdt/tst.pidargmap.sh | 2 +-
test/unittest/usdt/tst.pidargs.sh | 2 +-
.../usdt/{pidprobes.sh => tst.pidprobes.sh} | 17 +++++++++++------
3 files changed, 13 insertions(+), 8 deletions(-)
rename test/unittest/usdt/{pidprobes.sh => tst.pidprobes.sh} (95%)
diff --git a/test/unittest/usdt/tst.pidargmap.sh b/test/unittest/usdt/tst.pidargmap.sh
index 0c83f8703539..3594e782b0c1 100755
--- a/test/unittest/usdt/tst.pidargmap.sh
+++ b/test/unittest/usdt/tst.pidargmap.sh
@@ -8,4 +8,4 @@
# This test verifies that USDT and pid probes that share underlying probes
# do not apply arg mappings (incorrectly) to the pid probes.
-exec $(dirname $_test)/pidprobes.sh $1 t t
+exec $(dirname $_test)/tst.pidprobes.sh $1 t t
diff --git a/test/unittest/usdt/tst.pidargs.sh b/test/unittest/usdt/tst.pidargs.sh
index 53cba7c39624..0156d23f2f28 100755
--- a/test/unittest/usdt/tst.pidargs.sh
+++ b/test/unittest/usdt/tst.pidargs.sh
@@ -8,4 +8,4 @@
# This test verifies that USDT and pid probes that share underlying probes
# get the arguments correct for the USDT probes.
-exec $(dirname $_test)/pidprobes.sh $1 t ""
+exec $(dirname $_test)/tst.pidprobes.sh $1 t ""
diff --git a/test/unittest/usdt/pidprobes.sh b/test/unittest/usdt/tst.pidprobes.sh
similarity index 95%
rename from test/unittest/usdt/pidprobes.sh
rename to test/unittest/usdt/tst.pidprobes.sh
index aedc6256f195..6fe6d752a6d1 100755
--- a/test/unittest/usdt/pidprobes.sh
+++ b/test/unittest/usdt/tst.pidprobes.sh
@@ -6,11 +6,16 @@
# http://oss.oracle.com/licenses/upl.
#
# This test verifies various properties of USDT and pid probes sharing
-# underlying probes.
+# underlying probes. With only one argument (as called by runtest.sh),
+# it verifies that USDT and pid probes can share underlying probes.
+#
+# Other tests call back to this one to test arg-mapping behaviour,
+# verify that usdt probes actually fire when overlapped by pid probes,
+# etc.
dtrace=$1
-usdt=$2
-mapping=$3
+usdt=${2:-}
+mapping=${3:-}
# Set up test directory.
@@ -86,7 +91,7 @@ fi
# Check that the program output is 0 when the USDT probe is not enabled.
# That is, the PYRAMID_ENTRY_ENABLED() is-enabled checks should not pass.
-./main standalone > main.out
+./main > main.out
echo "my result: 0" > main.out.expected
if ! diff -q main.out main.out.expected > /dev/null; then
echo '"my result"' looks wrong when not using DTrace
@@ -131,7 +136,7 @@ fi
echo "my result: 10" > main.out2.expected
if ! diff -q main.out2 main.out2.expected > /dev/null; then
- echo '"my result"' looks wrong
+ echo '"my result"' looks wrong when using DTrace
echo === got ===
cat main.out2
echo === expected ===
@@ -297,7 +302,7 @@ if [[ -n $usdt ]]; then
fi
fi
-# Sort and check (dropping any wake-up firings from deferred probing).
+# Sort and check.
sort dtrace.out > dtrace.out.sorted
sort dtrace.out.expected > dtrace.out.expected.sorted
base-commit: 1a87c88ebb6e8b13dc5ce348d825a8dc3512ace0
--
2.46.0.278.g36e3a12567
More information about the DTrace-devel
mailing list