-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dangling char in parse-tree dump
The dangling ']' had no matching '['. While we are at it, introduce a line break in the output to neaten things up and add some tests for -xtree output. Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
4 changed files
with
299 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#!/bin/bash | ||
# | ||
# Oracle Linux DTrace. | ||
# Copyright (c) 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. | ||
# | ||
# @@nosort | ||
|
||
# Use a shell file rather than .d .r and .r.p files since we do not | ||
# want to send a large volume of output to the log file in the normal | ||
# case that the test passes. | ||
|
||
dtrace=$1 | ||
tmpfile=$tmpdir/tst.parser1.$$ | ||
chkfile=$tmpfile.check | ||
|
||
# Run DTrace. | ||
|
||
$dtrace -xtree=1 -e -n ' | ||
BEGIN | ||
{ | ||
x = 1234; | ||
printf("%d\n", x); | ||
z = 32 * (x + 18); | ||
@agg[x, z, "hello"] = llquantize(x, 2, 3, 5, 2); | ||
exit(0); | ||
} | ||
' > $tmpfile 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo ERROR running DTrace | ||
cat $tmpfile | ||
exit 1 | ||
fi | ||
|
||
# Generate check file. | ||
|
||
cat > $chkfile << EOF | ||
PDESC :::BEGIN [0] | ||
CTXATTR [i/i/u] | ||
ACTION | ||
D EXPRESSION attr=[s/s/c] | ||
OP2 = (type=<-1> attr=[s/s/c] flags=0) | ||
IDENT x (type=<-1> attr=[s/s/c] flags=0) | ||
INT 0x4d2 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
D PRODUCER attr=[s/s/c] | ||
FUNC printf (type=<-1> attr=[s/s/c] flags=0) | ||
STRING "%d\n" (type=<string> attr=[s/s/c] flags=COOK,REF,DPTR) | ||
, | ||
IDENT x (type=<-1> attr=[s/s/c] flags=0) | ||
D EXPRESSION attr=[s/s/c] | ||
OP2 = (type=<-1> attr=[s/s/c] flags=0) | ||
IDENT z (type=<-1> attr=[s/s/c] flags=0) | ||
OP2 * (type=<-1> attr=[s/s/c] flags=0) | ||
INT 0x20 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
OP2 + (type=<-1> attr=[s/s/c] flags=0) | ||
IDENT x (type=<-1> attr=[s/s/c] flags=0) | ||
INT 0x12 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
D EXPRESSION attr=[s/s/c] | ||
OP2 = (type=<-1> attr=[s/s/c] flags=0) | ||
OP2 [ (type=<-1> attr=[s/s/c] flags=0) | ||
IDENT @agg (type=<-1> attr=[s/s/c] flags=0) | ||
IDENT x (type=<-1> attr=[s/s/c] flags=0) | ||
FUNC llquantize (type=<-1> attr=[s/s/c] flags=0) | ||
IDENT x (type=<-1> attr=[s/s/c] flags=0) | ||
, | ||
INT 0x2 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
, | ||
INT 0x3 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
, | ||
INT 0x5 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
, | ||
INT 0x2 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
D PRODUCER attr=[s/s/c] | ||
FUNC exit (type=<-1> attr=[s/s/c] flags=0) | ||
INT 0x0 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
EOF | ||
|
||
# Check results. | ||
|
||
awk ' | ||
# Look for the BEGIN clause. | ||
/PDESC :::BEGIN / { | ||
# Print until we get the next clause. | ||
while (index($0, "Parse tree") == 0) { | ||
print; | ||
getline; | ||
} | ||
}' $tmpfile | diff -q - $chkfile > /dev/null | ||
if [ $? -ne 0 ]; then | ||
echo ERROR in output | ||
cat $tmpfile | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/bin/bash | ||
# | ||
# Oracle Linux DTrace. | ||
# Copyright (c) 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. | ||
# | ||
# @@nosort | ||
|
||
# Use a shell file rather than .d .r and .r.p files since we do not | ||
# want to send a large volume of output to the log file in the normal | ||
# case that the test passes. | ||
|
||
dtrace=$1 | ||
tmpfile=$tmpdir/tst.parser2.$$ | ||
chkfile=$tmpfile.check | ||
|
||
# Run DTrace. | ||
|
||
$dtrace -xtree=2 -e -n ' | ||
BEGIN | ||
{ | ||
x = 1234; | ||
printf("%d\n", x); | ||
z = 32 * (x + 18); | ||
@agg[x, z, "hello"] = llquantize(x, 2, 3, 5, 2); | ||
exit(0); | ||
} | ||
' > $tmpfile 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo ERROR running DTrace | ||
cat $tmpfile | ||
exit 1 | ||
fi | ||
|
||
# Generate check file. | ||
|
||
cat > $chkfile << EOF | ||
PDESC :::BEGIN [0] | ||
CTXATTR [u/u/c] | ||
ACTION | ||
D EXPRESSION attr=[s/s/c] | ||
OP2 = (type=<int> attr=[s/s/c] flags=SIGN,COOK,WRITE) | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
INT 0x4d2 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
D PRODUCER attr=[s/s/c] | ||
FUNC printf (type=<void> attr=[s/s/c] flags=SIGN,COOK) | ||
STRING "%d\n" (type=<string> attr=[s/s/c] flags=COOK,REF,DPTR) | ||
, | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
D EXPRESSION attr=[s/s/c] | ||
OP2 = (type=<int> attr=[s/s/c] flags=SIGN,COOK,WRITE) | ||
VARIABLE (normally-assigned) z (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
OP2 * (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
INT 0x20 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
OP2 + (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
INT 0x12 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
D EXPRESSION attr=[s/s/c] | ||
AGGREGATE @agg attr=[s/s/c] [ | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
, | ||
VARIABLE (normally-assigned) z (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
, | ||
STRING "hello" (type=<string> attr=[s/s/c] flags=COOK,REF,DPTR) | ||
] | ||
= | ||
FUNC llquantize (type=<<DYN>> attr=[s/s/c] flags=SIGN,COOK,REF) | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
, | ||
INT 0x2 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
, | ||
INT 0x3 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
, | ||
INT 0x5 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
, | ||
INT 0x2 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
D PRODUCER attr=[s/s/c] | ||
FUNC exit (type=<void> attr=[s/s/c] flags=SIGN,COOK) | ||
INT 0x0 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
EOF | ||
|
||
# Check results. | ||
|
||
awk ' | ||
# Look for the BEGIN clause. | ||
/PDESC :::BEGIN / { | ||
# Print until we get the next clause. | ||
while (index($0, "Parse tree") == 0) { | ||
print; | ||
getline; | ||
} | ||
}' $tmpfile | diff -q - $chkfile > /dev/null | ||
if [ $? -ne 0 ]; then | ||
echo ERROR in output | ||
cat $tmpfile | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/bin/bash | ||
# | ||
# Oracle Linux DTrace. | ||
# Copyright (c) 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. | ||
# | ||
# @@nosort | ||
|
||
# Use a shell file rather than .d .r and .r.p files since we do not | ||
# want to send a large volume of output to the log file in the normal | ||
# case that the test passes. | ||
|
||
dtrace=$1 | ||
tmpfile=$tmpdir/tst.parser4.$$ | ||
chkfile=$tmpfile.check | ||
|
||
# Run DTrace. | ||
|
||
$dtrace -xtree=4 -e -n ' | ||
BEGIN | ||
{ | ||
x = 1234; | ||
printf("%d\n", x); | ||
z = 32 * (x + 18); | ||
@agg[x, z, "hello"] = llquantize(x, 2, 3, 5, 2); | ||
exit(0); | ||
} | ||
' > $tmpfile 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo ERROR running DTrace | ||
cat $tmpfile | ||
exit 1 | ||
fi | ||
|
||
# Generate check file. | ||
|
||
cat > $chkfile << EOF | ||
PDESC :::BEGIN [0] | ||
CTXATTR [u/u/c] | ||
ACTION | ||
D EXPRESSION attr=[s/s/c] | ||
OP2 = (type=<int> attr=[s/s/c] flags=SIGN,COOK,WRITE) | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
INT 0x4d2 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
D PRODUCER attr=[s/s/c] | ||
FUNC printf (type=<void> attr=[s/s/c] flags=SIGN,COOK) | ||
STRING "%d\n" (type=<string> attr=[s/s/c] flags=COOK,REF,DPTR) | ||
, | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
D EXPRESSION attr=[s/s/c] | ||
OP2 = (type=<int> attr=[s/s/c] flags=SIGN,COOK,WRITE) | ||
VARIABLE (normally-assigned) z (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
OP2 * (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
INT 0x20 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
OP2 + (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
INT 0x12 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
D EXPRESSION attr=[s/s/c] | ||
AGGREGATE @agg attr=[s/s/c] [ | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
, | ||
VARIABLE (normally-assigned) z (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
, | ||
STRING "hello" (type=<string> attr=[s/s/c] flags=COOK,REF,DPTR) | ||
] | ||
= | ||
FUNC llquantize (type=<<DYN>> attr=[s/s/c] flags=SIGN,COOK,REF) | ||
VARIABLE (normally-assigned) x (type=<int> attr=[s/s/c] flags=SIGN,COOK,LVAL,WRITE) | ||
, | ||
INT 0x2 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
, | ||
INT 0x3 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
, | ||
INT 0x5 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
, | ||
INT 0x2 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
D PRODUCER attr=[s/s/c] | ||
FUNC exit (type=<void> attr=[s/s/c] flags=SIGN,COOK) | ||
INT 0x0 (type=<int> attr=[s/s/c] flags=SIGN,COOK) | ||
EOF | ||
|
||
# Check results. | ||
|
||
awk ' | ||
# Look for the BEGIN clause. | ||
/PDESC :::BEGIN / { | ||
# Print until we get the next clause. | ||
while (index($0, "Parse tree") == 0) { | ||
print; | ||
getline; | ||
} | ||
}' $tmpfile | diff -q - $chkfile > /dev/null | ||
if [ $? -ne 0 ]; then | ||
echo ERROR in output | ||
cat $tmpfile | ||
exit 1 | ||
fi | ||
|
||
exit 0 |