[DTrace-devel] [PATCH] Ensure the tst.varint test can run outside the build tree

Kris Van Hees kris.van.hees at oracle.com
Wed Jun 23 06:17:25 PDT 2021


The tst.varint.c test was depending on two source tree files.  Those
files are no longer available when you install DTrace packages.  The
test has been turned into a script that executes a test/utils program
that is compiled at build time.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 test/internals/tst.varint.sh           | 14 ++++++++++++++
 test/utils/Build                       |  4 ++--
 test/{internals => utils}/tst.varint.c |  6 ++----
 3 files changed, 18 insertions(+), 6 deletions(-)
 create mode 100755 test/internals/tst.varint.sh
 rename test/{internals => utils}/tst.varint.c (95%)

diff --git a/test/internals/tst.varint.sh b/test/internals/tst.varint.sh
new file mode 100755
index 00000000..e6a46b0e
--- /dev/null
+++ b/test/internals/tst.varint.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2021, 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.
+#
+
+#
+# This script verifies that the DTrace BPF program stack layout constants have
+# the proper values.
+#
+
+exec test/utils/tst.varint
diff --git a/test/utils/Build b/test/utils/Build
index 2c366a54..8cfec179 100644
--- a/test/utils/Build
+++ b/test/utils/Build
@@ -1,9 +1,9 @@
 # Oracle Linux DTrace.
-# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2021, 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_UTILS = baddof badioctl showUSDT print-stack-layout
+TEST_UTILS = baddof badioctl showUSDT print-stack-layout tst.varint
 
 define test-util-template
 CMDS += $(1)
diff --git a/test/internals/tst.varint.c b/test/utils/tst.varint.c
similarity index 95%
rename from test/internals/tst.varint.c
rename to test/utils/tst.varint.c
index 37f1c95e..4f80d3c2 100644
--- a/test/internals/tst.varint.c
+++ b/test/utils/tst.varint.c
@@ -1,5 +1,3 @@
-/* @@link: -Ilibdtrace */
-
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -9,7 +7,7 @@ void
 check(uint64_t val, int exp)
 {
 	char		s[VARINT_MAX_BYTES];
-	char		*p;
+	const char	*p;
 	int		rc, len;
 	uint64_t	dval;
 
@@ -28,7 +26,7 @@ check(uint64_t val, int exp)
 		printf("Skip wrong for %lu: %d vs %d\n", val, 0, exp);
 		exit(1);
 	} else if ((p - s) != exp) {
-		printf("Skip wrong for %lu: %d vs %d\n", val, p - s, exp);
+		printf("Skip wrong for %lu: %ld vs %d\n", val, p - s, exp);
 		exit(1);
 	}
 	dval = dt_vint2int(s);
-- 
2.31.1




More information about the DTrace-devel mailing list