[DTrace-devel] [PATCH 13/14] test: Add string store_var()/load_var() tests for more than gvars

eugene.loh at oracle.com eugene.loh at oracle.com
Tue May 2 03:47:21 UTC 2023


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

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
---
 test/unittest/codegen/tst.str_store_var.d | 24 ++++++---
 test/unittest/codegen/tst.str_store_var.r | 66 +++++++++++++++++++++++
 2 files changed, 83 insertions(+), 7 deletions(-)

diff --git a/test/unittest/codegen/tst.str_store_var.d b/test/unittest/codegen/tst.str_store_var.d
index 2c64728c..06056931 100644
--- a/test/unittest/codegen/tst.str_store_var.d
+++ b/test/unittest/codegen/tst.str_store_var.d
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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.
  */
@@ -9,14 +9,24 @@
 #pragma D option strsize=6
 #pragma D option quiet
 
-string	x;
-
 BEGIN
 {
-	x = "abcdefgh";
-	trace(x);
-	x = "12";
-	trace(x);
+	/* global */
+	g = "abcdefgh"; trace(g); trace(g + 1); trace(1 + g);
+	g = "12"      ; trace(g); trace(g + 1); trace(1 + g);
+
+	/* (clause) local */
+	this->l = "abcdefgh"; trace(this->l); trace(this->l + 1); trace(1 + this->l);
+	this->l = "12"      ; trace(this->l); trace(this->l + 1); trace(1 + this->l);
+
+	/* thread local */
+	self->t = "abcdefgh"; trace(self->t); trace(self->t + 1); trace(1 + self->t);
+	self->t = "12"      ; trace(self->t); trace(self->t + 1); trace(1 + self->t);
+
+	/* associative */
+	a[1234] = "abcdefgh"; trace(a[1234]); trace(a[1234] + 1); trace(1 + a[1234]);
+	a[1234] = "12"      ; trace(a[1234]); trace(a[1234] + 1); trace(1 + a[1234]);
+
 	exit(0);
 }
 
diff --git a/test/unittest/codegen/tst.str_store_var.r b/test/unittest/codegen/tst.str_store_var.r
index ffc3ff5a..f37db08d 100644
--- a/test/unittest/codegen/tst.str_store_var.r
+++ b/test/unittest/codegen/tst.str_store_var.r
@@ -2,6 +2,72 @@
              0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
          0: 61 62 63 64 65 66 00                             abcdef.
 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 62 63 64 65 66 00 00                             bcdef..
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 62 63 64 65 66 00 00                             bcdef..
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 31 32 00 00 00 00 00                             12.....
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 32 00 00 00 00 00 00                             2......
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 32 00 00 00 00 00 00                             2......
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 61 62 63 64 65 66 00                             abcdef.
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 62 63 64 65 66 00 00                             bcdef..
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 62 63 64 65 66 00 00                             bcdef..
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 31 32 00 00 00 00 00                             12.....
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 32 00 00 00 00 00 00                             2......
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 32 00 00 00 00 00 00                             2......
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 61 62 63 64 65 66 00                             abcdef.
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 62 63 64 65 66 00 00                             bcdef..
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 62 63 64 65 66 00 00                             bcdef..
+
              0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
          0: 31 32 00 00 00 00 00                             12.....
 
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 32 00 00 00 00 00 00                             2......
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 32 00 00 00 00 00 00                             2......
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 61 62 63 64 65 66 00                             abcdef.
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 62 63 64 65 66 00 00                             bcdef..
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 62 63 64 65 66 00 00                             bcdef..
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 31 32 00 00 00 00 00                             12.....
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 32 00 00 00 00 00 00                             2......
+
+             0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  0123456789abcdef
+         0: 32 00 00 00 00 00 00                             2......
+
-- 
2.18.4




More information about the DTrace-devel mailing list