Skip to content

Commit

Permalink
test: Add string store_var()/load_var() tests for more than gvars
Browse files Browse the repository at this point in the history
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh authored and kvanhees committed May 25, 2023
1 parent 832b3d4 commit f8a8c17
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 7 deletions.
24 changes: 17 additions & 7 deletions test/unittest/codegen/tst.str_store_var.d
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand All @@ -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);
}

Expand Down
66 changes: 66 additions & 0 deletions test/unittest/codegen/tst.str_store_var.r
Original file line number Diff line number Diff line change
Expand Up @@ -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......

0 comments on commit f8a8c17

Please sign in to comment.