Skip to contentSkip to conversation

test: Check dtrace return status in USDT tst.forker.sh

PATCH In review [email protected] 3 participants 3 messages Jun 27, 2024 – Aug 20, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 6/8 test: Check dtrace return status in USDT tst.forker.sh

From: Eugene Loh <[email protected]>

This test was spuriously passing. DTrace failed to run -- many error messages in the log file indicated as much -- and yet the test passed.

Check the dtrace return status.

The test will pass once USDT supports wildcard provider names.

---
 test/unittest/usdt/tst.forker.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
test/unittest/usdt/tst.forker.sh +6 -1
index 018a6572..7cfa9eb5 100755
@@ -1,12 +1,13 @@
 #!/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.
 #
 #
 # @@timeout: 120
+# @@xfail: dtv2 USDT wildcard
 
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
@@ -32,6 +33,10 @@ while kill -0 $id >/dev/null 2>&1; do
 			exit(0);
 		}
 	EOF
+	if [ $? -ne 0 ]; then
+		echo ERROR: DTrace failed to run
+		exit 1
+	fi
 done
 
 exit 0
Signature · 1 line
2.18.4
Reviewed-by on v2 6/8
#1 lore raw
Quoted 10 lines · On Thu, Jun 27, 2024 at 01:25:16AM -0400, [email protected] wrote:

From: Eugene Loh <[email protected]>

This test was spuriously passing. DTrace failed to run -- many error messages in the log file indicated as much -- and yet the test passed.

Check the dtrace return status.

The test will pass once USDT supports wildcard provider names.

Quoted 37 lines
---
 test/unittest/usdt/tst.forker.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
test/unittest/usdt/tst.forker.sh +6 -1
index 018a6572..7cfa9eb5 100755
@@ -1,12 +1,13 @@
 #!/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.
 #
 #
 # @@timeout: 120
+# @@xfail: dtv2 USDT wildcard
 
 if [ $# != 1 ]; then
 	echo expected one argument: '<'dtrace-path'>'
@@ -32,6 +33,10 @@ while kill -0 $id >/dev/null 2>&1; do
 			exit(0);
 		}
 	EOF
+	if [ $? -ne 0 ]; then
+		echo ERROR: DTrace failed to run
+		exit 1
+	fi
 done
 
 exit 0
Signature · 1 line
2.18.4
#2 lore raw
Quoted 6 lines · Kris Van Hees via DTrace-devel
Quoted 5 lines · On Thu, Jun 27, 2024 at 01:25:16AM -0400, [email protected] wrote:

From: Eugene Loh <[email protected]>

This test was spuriously passing. DTrace failed to run -- many error messages in the log file indicated as much -- and yet the test passed.

Quoted 7 lines
Quoted 5 lines

Check the dtrace return status.

The test will pass once USDT supports wildcard provider names.

This made me go looking for other issues and I sent a small series for the obvious ones.

There are other issues around:
* dtrace .. | awk, exit $? wrt no lastpipe, and
* multiple checks but we only exit $? only at the end (this is debatable)
* exiting 0 at the end when checking for intended failure (perhaps should do exit 1 if any of them *don't* fai;, see previous point) in a handful of tests
* tests like test/unittest/udp/tst.ipv6localudp.sh where, while we normally rely on the implicit exit code being the last command run, because we do e.g. kill after, we end up not checking it.

Some of this doesn't matter *that* much because of the actual test output being checked in .r files, but failing faster is nicer for debugging as well, and in some cases, there is no .r (like this one).

Quoted 1 line

[...]

thanks,
sam