changeset 13944:bbcbb468dc37

3519 DTrace fails to resolve const types from fbt 3520 dtrace internal error -- token type 316 is not a valid D compilation token 3521 clean up dtrace unit tests Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Eric Schrock <eric.schrock@delphix.com> Reviewed by: Dan Kimmel <dan.kimmel@delphix.com> Reviewed by: Christopher Siden <christopher.siden@delphix.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Robert Mustacchi <rm@joyent.com>
author Adam Leventhal <ahl@delphix.com>
date Tue, 05 Feb 2013 10:10:25 -0800
parents e1ea18b9c0de
children 7a9c1d41dfbe
files usr/src/cmd/dtrace/test/tst/common/funcs/tst.copyin.d usr/src/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d usr/src/cmd/dtrace/test/tst/common/misc/tst.dynopt.d usr/src/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d usr/src/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d usr/src/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d usr/src/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d usr/src/cmd/dtrace/test/tst/common/print/err.D_PRINT_AGG.bad.d usr/src/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d usr/src/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d usr/src/cmd/dtrace/test/tst/common/safety/tst.copyin.d usr/src/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh usr/src/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d usr/src/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d usr/src/cmd/dtrace/test/tst/common/trace/err.D_TRACE_AGG.bad.d usr/src/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d usr/src/cmd/dtrace/test/tst/common/types/tst.const.d usr/src/lib/libdtrace/common/dt_cc.c usr/src/lib/libdtrace/common/dt_decl.c usr/src/lib/libdtrace/common/dt_errtags.h usr/src/pkg/manifests/system-dtrace-tests.mf
diffstat 21 files changed, 190 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/dtrace/test/tst/common/funcs/tst.copyin.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/funcs/tst.copyin.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION:
@@ -52,3 +54,8 @@
 	printf("envp[0] = \"%s\"", copyinstr(envp));
 	exit(0);
 }
+
+BEGIN
+{
+	exit(1)
+}
--- a/usr/src/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/funcs/tst.strjoin.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 #pragma D option quiet
 
@@ -36,3 +38,8 @@
 	printf("%s\n", strjoin("", ""));
 	exit(0);
 }
+
+BEGIN
+{
+	exit(1);
+}
--- a/usr/src/cmd/dtrace/test/tst/common/misc/tst.dynopt.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/misc/tst.dynopt.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,38 +24,45 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 #pragma D option quiet
 
 #pragma D option switchrate=1ms
 #pragma D option aggrate=1ms
 
-tick-100ms
+tick-50ms
 {
 	i++;
 }
 
-tick-100ms
-/i > 1/
+tick-50ms
+/!(i & 1) && i > 1/
 {
 	setopt("quiet", "no");
 	setopt("quiet");
 	setopt("quiet");
 	setopt("quiet", "yes");
 	@["abc"] = count();
+}
+
+tick-50ms
+/(i & 1) && i > 1/
+{
 	printa("%@d\n", @);
 }
 
-tick-100ms
-/i == 5/
+tick-50ms
+/i == 10/
 {
 	setopt("switchrate", "5sec");
 	setopt("aggrate", "5sec");
 }
 
-tick-100ms
-/i == 31/
+tick-50ms
+/i == 61/
 {
 	exit(0);
 }
--- a/usr/src/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/pointers/err.BadAlign.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION: This test reproduces the alignment error.
@@ -39,9 +41,10 @@
 
 BEGIN
 {
-	x = (int *) 64;
+	x = (int *)64;
 	y = *x;
 	trace(y);
+	exit(0);
 }
 
 ERROR
--- a/usr/src/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress2.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION: D pointers do not allow invalid pointer accesses.
@@ -44,6 +46,7 @@
 	y = (int *) (x - 3300778156056);
 	*y = 3;
 	trace(*y);
+	exit(0);
 }
 
 ERROR
--- a/usr/src/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress3.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION: D pointers do not allow invalid pointer accesses.
@@ -39,9 +41,10 @@
 
 BEGIN
 {
-	y = (int *) (-33007);
+	y = (int *)-33007;
 	*y = 3;
 	trace(*y);
+	exit(0);
 }
 
 ERROR
--- a/usr/src/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/pointers/err.InvalidAddress4.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION: Demonstrating valid memory access.
@@ -40,10 +42,11 @@
 BEGIN
 {
 	x = (int *)alloca(sizeof (int));
-	printf("Address x: %x\n", (int) x);
-	y = (int *) (x - 2);
+	printf("Address x: %x\n", (int)x);
+	y = (int *)(x - 2);
 	*y = 3;
-	printf("Address y: %x\tValue: %d\n", (int) y, *y);
+	printf("Address y: %x\tValue: %d\n", (int)y, *y);
+	exit(0);
 }
 
 ERROR
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/print/err.D_PRINT_AGG.bad.d	Tue Feb 05 10:10:25 2013 -0800
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+BEGIN
+{
+	@ = count();
+	print(@);
+}
+
+BEGIN
+{
+	exit(0);
+}
--- a/usr/src/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/print/err.D_PRINT_VOID.bad.d	Tue Feb 05 10:10:25 2013 -0800
@@ -20,10 +20,15 @@
  */
 
 /*
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
 BEGIN
 {
 	print((void)`p0);
 }
+
+BEGIN
+{
+	exit(0);
+}
--- a/usr/src/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/print/err.D_PROTO_LEN.bad.d	Tue Feb 05 10:10:25 2013 -0800
@@ -20,10 +20,15 @@
  */
 
 /*
- * Copyright (c) 2011 by Delphix. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
 BEGIN
 {
 	print();
 }
+
+BEGIN
+{
+	exit(0);
+}
--- a/usr/src/cmd/dtrace/test/tst/common/safety/tst.copyin.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/safety/tst.copyin.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION:
@@ -39,7 +41,7 @@
  */
 
 
-#pragma D option bufsize=16
+#pragma D option bufsize=32
 #pragma D option bufpolicy=ring
 #pragma D option statusrate=1nsec
 
--- a/usr/src/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh	Tue Feb 05 10:10:25 2013 -0800
@@ -25,7 +25,9 @@
 # Use is subject to license terms.
 #
 
-#ident	"%Z%%M%	%I%	%E% SMI"
+#
+# Copyright (c) 2012 by Delphix. All rights reserved.
+#
 
 ############################################################################
 # ASSERTION:
@@ -70,7 +72,7 @@
 #chmod 555 the .d file
 
 chmod 555 $dfilename >/dev/null 2>&1
-if [ &? -ne 0 ]; then
+if [ $? -ne 0 ]; then
 	print -u2 "chmod $dfilename failed"
 	exit 1
 fi
--- a/usr/src/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations2.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION:
--- a/usr/src/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/trace/err.D_PROTO_LEN.bad.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,8 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION:
@@ -39,3 +40,8 @@
 
 	trace();
 }
+
+BEGIN
+{
+	exit(0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/trace/err.D_TRACE_AGG.bad.d	Tue Feb 05 10:10:25 2013 -0800
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+BEGIN
+{
+	@ = count();
+	trace(@);
+}
+
+BEGIN
+{
+	exit(0);
+}
--- a/usr/src/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/trace/err.D_TRACE_VOID.bad.d	Tue Feb 05 10:10:25 2013 -0800
@@ -24,7 +24,9 @@
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
 
 /*
  * ASSERTION:
@@ -37,3 +39,8 @@
 {
 	trace((void)`kmem_flags);
 }
+
+BEGIN
+{
+	exit(0);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/types/tst.const.d	Tue Feb 05 10:10:25 2013 -0800
@@ -0,0 +1,29 @@
+/*
+ * CDDL HEADER START
+ *
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright (c) 2012 by Delphix. All rights reserved.
+ */
+
+/*
+ * Make sure we can scope types with modifiers.
+ */
+
+BEGIN
+{
+	trace((D`int *)0);
+	trace((const D`int *)0);
+	exit(0);
+}
--- a/usr/src/lib/libdtrace/common/dt_cc.c	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/lib/libdtrace/common/dt_cc.c	Tue Feb 05 10:10:25 2013 -0800
@@ -676,6 +676,12 @@
 		    "%s( ) may not be applied to a translated pointer\n", act);
 	}
 
+	if (dnp->dn_args->dn_kind == DT_NODE_AGG) {
+		dnerror(dnp->dn_args, istrace ? D_TRACE_AGG : D_PRINT_AGG,
+		    "%s( ) may not be applied to an aggregation%s\n", act,
+		    istrace ? "" : " -- did you mean printa()?");
+	}
+
 	dt_cg(yypcb, dnp->dn_args);
 
 	/*
--- a/usr/src/lib/libdtrace/common/dt_decl.c	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/lib/libdtrace/common/dt_decl.c	Tue Feb 05 10:10:25 2013 -0800
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 by Delphix. All rights reserved.
  */
 
 #include <strings.h>
@@ -251,11 +252,6 @@
 	ddp->dd_kind = kind;
 	ddp->dd_name = name;
 
-	if (name != NULL && strchr(name, '`') != NULL) {
-		xyerror(D_DECL_SCOPE, "D scoping operator may not be used "
-		    "in a type name\n");
-	}
-
 	return (dt_decl_check(ddp));
 }
 
--- a/usr/src/lib/libdtrace/common/dt_errtags.h	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/lib/libdtrace/common/dt_errtags.h	Tue Feb 05 10:10:25 2013 -0800
@@ -190,8 +190,10 @@
 	D_PRINTA_AGGPROTO,		/* printa() aggregation mismatch */
 	D_TRACE_VOID,			/* trace() argument has void type */
 	D_TRACE_DYN,			/* trace() argument has dynamic type */
+	D_TRACE_AGG,			/* trace() argument is an aggregation */
 	D_PRINT_VOID,			/* print() argument has void type */
 	D_PRINT_DYN,			/* print() argument has dynamic type */
+	D_PRINT_AGG,			/* print() argument is an aggregation */
 	D_TRACEMEM_ADDR,		/* tracemem() address bad type */
 	D_TRACEMEM_SIZE,		/* tracemem() size bad type */
 	D_TRACEMEM_ARGS,		/* tracemem() illegal number of args */
--- a/usr/src/pkg/manifests/system-dtrace-tests.mf	Fri Feb 01 19:44:54 2013 +0000
+++ b/usr/src/pkg/manifests/system-dtrace-tests.mf	Tue Feb 05 10:10:25 2013 -0800
@@ -1253,6 +1253,7 @@
 file path=opt/SUNWdtrt/tst/common/preprocessor/tst.preexpifelse.d.out \
     mode=0444
 file path=opt/SUNWdtrt/tst/common/preprocessor/tst.withinprobe.d mode=0444
+file path=opt/SUNWdtrt/tst/common/print/err.D_PRINT_AGG.bad.d mode=0444
 file path=opt/SUNWdtrt/tst/common/print/err.D_PRINT_VOID.bad.d mode=0444
 file path=opt/SUNWdtrt/tst/common/print/err.D_PROTO_LEN.bad.d mode=0444
 file path=opt/SUNWdtrt/tst/common/print/tst.array.d mode=0444
@@ -1801,6 +1802,7 @@
 file path=opt/SUNWdtrt/tst/common/tick-n/tst.tickusec.d mode=0444
 file path=opt/SUNWdtrt/tst/common/tick-n/tst.tickusec.d.out mode=0444
 file path=opt/SUNWdtrt/tst/common/trace/err.D_PROTO_LEN.bad.d mode=0444
+file path=opt/SUNWdtrt/tst/common/trace/err.D_TRACE_AGG.bad.d mode=0444
 file path=opt/SUNWdtrt/tst/common/trace/err.D_TRACE_VOID.bad.d mode=0444
 file path=opt/SUNWdtrt/tst/common/trace/tst.dyn.d mode=0444
 file path=opt/SUNWdtrt/tst/common/trace/tst.misc.d mode=0444
@@ -1936,6 +1938,7 @@
 file path=opt/SUNWdtrt/tst/common/types/tst.charconstants.d mode=0444
 file path=opt/SUNWdtrt/tst/common/types/tst.complex.d mode=0444
 file path=opt/SUNWdtrt/tst/common/types/tst.condexpr.d mode=0444
+file path=opt/SUNWdtrt/tst/common/types/tst.const.d mode=0444
 file path=opt/SUNWdtrt/tst/common/types/tst.constants.d mode=0444
 file path=opt/SUNWdtrt/tst/common/types/tst.conv.d mode=0444
 file path=opt/SUNWdtrt/tst/common/types/tst.enum.d mode=0444