aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf
diff options
context:
space:
mode:
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf')
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_AGG_CONV.aggfmt.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.toomany.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.widths.d47
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_FMT.badfmt.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_PROTO.novalue.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.aggarg.d42
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.recursive.d46
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.noprec.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.nowidth.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badprec.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badwidth.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PROTO_LEN.toofew.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv1.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv2.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv3.d40
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d73
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d.out26
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.flags.d49
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.flags.d.out7
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.hello.d44
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.hello.d.out1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d87
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out45
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.precs.d58
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.precs.d.out14
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.print-f.d51
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.print-f.d.out4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh56
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh.out3
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh56
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh.out3
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printcont.d60
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printcont.d.out16
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printeE.d54
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printeE.d.out6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printgG.d54
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printgG.d.out6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d43
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d.out1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d38
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d.out3
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d41
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d43
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.uints.d47
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.uints.d.out6
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths.d59
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths.d.out14
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths1.d52
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.wp.d66
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.wp.d.out22
52 files changed, 1825 insertions, 0 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_AGG_CONV.aggfmt.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_AGG_CONV.aggfmt.d
new file mode 100644
index 000000000000..9cac625d3ec1
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_AGG_CONV.aggfmt.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with a bad aggregation format.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("hello %@d", 123);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.toomany.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.toomany.d
new file mode 100644
index 000000000000..de87e8d71839
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.toomany.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with too many arguments.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("x = %d y = %d\n", 123, 456, 789);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.widths.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.widths.d
new file mode 100644
index 000000000000..938128007b6e
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_EXTRA.widths.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Negative test to test variety of fixed width formats.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("\n");
+ x = 0;
+
+ printf("%?d\n", x++, 1);
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_FMT.badfmt.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_FMT.badfmt.d
new file mode 100644
index 000000000000..bf4dc72c1ab3
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_FMT.badfmt.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with a bad format string arg.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf(123);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_PROTO.novalue.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_PROTO.novalue.d
new file mode 100644
index 000000000000..68f8cf029fe3
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_PROTO.novalue.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with a missing value argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("%s");
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.aggarg.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.aggarg.d
new file mode 100644
index 000000000000..99bb0395028c
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.aggarg.d
@@ -0,0 +1,42 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+
+/*
+ * ASSERTION:
+ * Test printf() with a bad aggregation arg.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ @a = count();
+ printf("hello %d %d", 123, @a);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.recursive.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.recursive.d
new file mode 100644
index 000000000000..3b94ba731721
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_ARG_TYPE.recursive.d
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Invalid recursive printf test.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ i = 0;
+ printf("%s\n", printf("test"));
+
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.noprec.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.noprec.d
new file mode 100644
index 000000000000..ba8a1a46d19a
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.noprec.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with a missing dynamic precision argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("%s %.*d\n", "foo");
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.nowidth.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.nowidth.d
new file mode 100644
index 000000000000..4d72c819d435
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_PROTO.nowidth.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with a missing dynamic width argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("%s %*d\n", "foo");
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badprec.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badprec.d
new file mode 100644
index 000000000000..64cf912534c1
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badprec.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test a dynamic precision argument of non-integer type.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("%.*d\n", "foo", 1);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badwidth.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badwidth.d
new file mode 100644
index 000000000000..badc95eeb952
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PRINTF_DYN_TYPE.badwidth.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Tet dynamic width argument of non-integer type.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("%*d\n", "foo", 1);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PROTO_LEN.toofew.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PROTO_LEN.toofew.d
new file mode 100644
index 000000000000..32c877ba8ed9
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_PROTO_LEN.toofew.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with too few arguments.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf();
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv1.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv1.d
new file mode 100644
index 000000000000..7add33192a7d
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv1.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the unsupported %n$ conversion syntax.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("%3$d", 123);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv2.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv2.d
new file mode 100644
index 000000000000..5cc32e27e636
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv2.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test an incomplete conversion.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("%3", 123);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv3.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv3.d
new file mode 100644
index 000000000000..0dedea3d4096
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/err.D_SYNTAX.badconv3.d
@@ -0,0 +1,40 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test an undefined conversion.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+BEGIN
+{
+ printf("%Z", 123);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d
new file mode 100644
index 000000000000..10dc61dab83f
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test the basics of all the format conversions in the printf dictionary.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ * NOTES:
+ * floats and wchar_t strings missing
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ i = (int)'a';
+
+ printf("\n");
+
+ printf("%%a = %a\n", &`malloc);
+ printf("%%c = %c\n", i);
+ printf("%%d = %d\n", i);
+ printf("%%hd = %hd\n", (short)i);
+ printf("%%hi = %hi\n", (short)i);
+ printf("%%ho = %ho\n", (ushort_t)i);
+ printf("%%hu = %hu\n", (ushort_t)i);
+ printf("%%hx = %hx\n", (ushort_t)i);
+ printf("%%hX = %hX\n", (ushort_t)i);
+ printf("%%i = %i\n", i);
+ printf("%%lc = %lc\n", i);
+ printf("%%ld = %ld\n", (long)i);
+ printf("%%li = %li\n", (long)i);
+ printf("%%lo = %lo\n", (ulong_t)i);
+ printf("%%lu = %lu\n", (ulong_t)i);
+ printf("%%lx = %lx\n", (ulong_t)i);
+ printf("%%lX = %lX\n", (ulong_t)i);
+ printf("%%o = %o\n", (uint_t)i);
+ printf("%%p = %p\n", (void *)i);
+ printf("%%s = %s\n", "hello");
+ printf("%%u = %u\n", (uint_t)i);
+ printf("%%wc = %wc\n", i);
+ printf("%%x = %x\n", (uint_t)i);
+ printf("%%X = %X\n", (uint_t)i);
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d.out
new file mode 100644
index 000000000000..1d2740578796
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d.out
@@ -0,0 +1,26 @@
+
+%a = kernel`malloc
+%c = a
+%d = 97
+%hd = 97
+%hi = 97
+%ho = 141
+%hu = 97
+%hx = 61
+%hX = 61
+%i = 97
+%lc = a
+%ld = 97
+%li = 97
+%lo = 141
+%lu = 97
+%lx = 61
+%lX = 61
+%o = 141
+%p = 61
+%s = hello
+%u = 97
+%wc = a
+%x = 61
+%X = 61
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.flags.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.flags.d
new file mode 100644
index 000000000000..0b65315138e6
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.flags.d
@@ -0,0 +1,49 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test all of the various formatting flags (except %' because that
+ * requires locale support).
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("\n");
+ printf("# %#8x\n", 0x123);
+ printf("0 %08x\n", 0x123);
+ printf("- %-8x\n", 0x123);
+ printf("+ %+8d\n", 123);
+ printf(" % 8d\n", 123);
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.flags.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.flags.d.out
new file mode 100644
index 000000000000..4e5344ee6575
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.flags.d.out
@@ -0,0 +1,7 @@
+
+# 0x123
+0 00000123
+- 123
++ +123
+ 123
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.hello.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.hello.d
new file mode 100644
index 000000000000..d58f6cd7277a
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.hello.d
@@ -0,0 +1,44 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Simple printf() test.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("hello");
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.hello.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.hello.d.out
new file mode 100644
index 000000000000..ce013625030b
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.hello.d.out
@@ -0,0 +1 @@
+hello
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d
new file mode 100644
index 000000000000..d15236bab0b3
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d
@@ -0,0 +1,87 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with simple integer arguments, using a variety of
+ * sizes and thereby exercise the automatic size extension feature.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("\n%d\n", (char)0x1234567890abcdef);
+ printf("%d\n", (short)0x1234567890abcdef);
+ printf("%d\n", (int)0x1234567890abcdef);
+ printf("%d\n", (long long)0x1234567890abcdef);
+
+ printf("\n%d\n", (unsigned char)0x1234567890abcdef);
+ printf("%d\n", (unsigned short)0x1234567890abcdef);
+ printf("%d\n", (unsigned int)0x1234567890abcdef);
+ printf("%d\n", (unsigned long long)0x1234567890abcdef);
+
+ printf("\n%u\n", (char)0x1234567890abcdef);
+ printf("%u\n", (short)0x1234567890abcdef);
+ printf("%u\n", (int)0x1234567890abcdef);
+ printf("%u\n", (long long)0x1234567890abcdef);
+
+ printf("\n%u\n", (unsigned char)0x1234567890abcdef);
+ printf("%u\n", (unsigned short)0x1234567890abcdef);
+ printf("%u\n", (unsigned int)0x1234567890abcdef);
+ printf("%u\n", (unsigned long long)0x1234567890abcdef);
+
+ printf("\n%x\n", (unsigned char)0x1234567890abcdef);
+ printf("%x\n", (unsigned short)0x1234567890abcdef);
+ printf("%x\n", (unsigned int)0x1234567890abcdef);
+ printf("%x\n", (unsigned long long)0x1234567890abcdef);
+
+ printf("\n%x\n", (char)0x1234567890abcdef);
+ printf("%x\n", (short)0x1234567890abcdef);
+ printf("%x\n", (int)0x1234567890abcdef);
+ printf("%x\n", (long long)0x1234567890abcdef);
+
+ printf("\n%o\n", (unsigned char)0x1234567890abcdef);
+ printf("%o\n", (unsigned short)0x1234567890abcdef);
+ printf("%o\n", (unsigned int)0x1234567890abcdef);
+ printf("%o\n", (unsigned long long)0x1234567890abcdef);
+
+ printf("\n%o\n", (char)0x1234567890abcdef);
+ printf("%o\n", (short)0x1234567890abcdef);
+ printf("%o\n", (int)0x1234567890abcdef);
+ printf("%o\n", (long long)0x1234567890abcdef);
+
+ printf("\n%p\n", (void *)0x12345678);
+ printf("%p\n", (int *)0x90abcdef);
+ printf("%p\n", (uintptr_t)0x67890abc);
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out
new file mode 100644
index 000000000000..bc7eaed0ec9a
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.ints.d.out
@@ -0,0 +1,45 @@
+
+-17
+-12817
+-1867788817
+1311768467294899695
+
+239
+52719
+2427178479
+1311768467294899695
+
+239
+52719
+2427178479
+1311768467294899695
+
+239
+52719
+2427178479
+1311768467294899695
+
+ef
+cdef
+90abcdef
+1234567890abcdef
+
+ef
+cdef
+90abcdef
+1234567890abcdef
+
+357
+146757
+22052746757
+110642547422052746757
+
+357
+146757
+22052746757
+110642547422052746757
+
+12345678
+90abcdef
+67890abc
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.precs.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.precs.d
new file mode 100644
index 000000000000..2bfff9ff7040
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.precs.d
@@ -0,0 +1,58 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test a variety of fixed and dynamic format precisions.
+ *
+ * SECTION: Output Formatting/printf()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("\n");
+ x = 0;
+
+ printf("%.0s\n", "hello");
+ printf("%.1s\n", "hello");
+ printf("%.2s\n", "hello");
+ printf("%.3s\n", "hello");
+ printf("%.4s\n", "hello");
+ printf("%.5s\n", "hello");
+
+ printf("%.*s\n", x++, "hello");
+ printf("%.*s\n", x++, "hello");
+ printf("%.*s\n", x++, "hello");
+ printf("%.*s\n", x++, "hello");
+ printf("%.*s\n", x++, "hello");
+ printf("%.*s\n", x++, "hello");
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.precs.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.precs.d.out
new file mode 100644
index 000000000000..11a969de02ae
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.precs.d.out
@@ -0,0 +1,14 @@
+
+hello
+h
+he
+hel
+hell
+hello
+hello
+h
+he
+hel
+hell
+hello
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.print-f.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.print-f.d
new file mode 100644
index 000000000000..3fe0bac485de
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.print-f.d
@@ -0,0 +1,51 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test %f format printing.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+float f;
+double d;
+
+BEGIN
+{
+ printf("\n");
+
+ printf("%%f = %f\n", f);
+ printf("%%f = %f\n", d);
+
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.print-f.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.print-f.d.out
new file mode 100644
index 000000000000..4d4b8641afc3
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.print-f.d.out
@@ -0,0 +1,4 @@
+
+%f = 0.000000
+%f = 0.000000
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh
new file mode 100644
index 000000000000..6d3695711c95
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh
@@ -0,0 +1,56 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+
+# The output files assumes the timezone is US/Pacific
+export TZ=America/Los_Angeles
+
+$dtrace -s /dev/stdin <<EOF
+#pragma D option quiet
+
+inline uint64_t NANOSEC = 1000000000;
+
+BEGIN
+{
+ printf("%T\n%T\n%T", (uint64_t)0, (uint64_t)1062609821 * NANOSEC,
+ (uint64_t)0x7fffffff * NANOSEC);
+ exit(0);
+}
+EOF
+
+if [ $? -ne 0 ]; then
+ print -u2 "dtrace failed"
+ exit 1
+fi
+
+exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh.out
new file mode 100644
index 000000000000..51c84373aacd
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printT.ksh.out
@@ -0,0 +1,3 @@
+Wed, 31 Dec 1970 16:00:00 PST
+Wed, 03 Sep 2003 10:23:41 PDT
+Mon, 18 Jan 2038 19:14:07 PST
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh
new file mode 100644
index 000000000000..b8ea2fff2aff
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh
@@ -0,0 +1,56 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+# ident "%Z%%M% %I% %E% SMI"
+
+if [ $# != 1 ]; then
+ echo expected one argument: '<'dtrace-path'>'
+ exit 2
+fi
+
+dtrace=$1
+
+# The output files assumes the timezone is US/Pacific
+export TZ=America/Los_Angeles
+
+$dtrace -s /dev/stdin <<EOF
+#pragma D option quiet
+
+inline uint64_t NANOSEC = 1000000000;
+
+BEGIN
+{
+ printf("%Y\n%Y\n%Y", (uint64_t)0, (uint64_t)1062609821 * NANOSEC,
+ (uint64_t)0x7fffffff * NANOSEC);
+ exit(0);
+}
+EOF
+
+if [ $? -ne 0 ]; then
+ print -u2 "dtrace failed"
+ exit 1
+fi
+
+exit 0
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh.out
new file mode 100644
index 000000000000..ae8d82f936a7
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printY.ksh.out
@@ -0,0 +1,3 @@
+1969 Dec 31 16:00:00
+2003 Sep 3 10:23:41
+2038 Jan 18 19:14:07
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printcont.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printcont.d
new file mode 100644
index 000000000000..ca7e1a931303
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printcont.d
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test 'uint' continously; like kinda stress.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+uint64_t ts;
+
+BEGIN
+{
+ ts = 53114233149441;
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ printf("%u\n", ts);
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printcont.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printcont.d.out
new file mode 100644
index 000000000000..ce33b729a33c
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printcont.d.out
@@ -0,0 +1,16 @@
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+53114233149441
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printeE.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printeE.d
new file mode 100644
index 000000000000..7aaee2a4bceb
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printeE.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test %e, %E format printing.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+float f;
+double d;
+
+BEGIN
+{
+ printf("\n");
+
+ printf("%%e = %e\n", f);
+ printf("%%E = %E\n", f);
+
+ printf("%%e = %e\n", d);
+ printf("%%E = %E\n", d);
+
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printeE.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printeE.d.out
new file mode 100644
index 000000000000..3fa96bc2df79
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printeE.d.out
@@ -0,0 +1,6 @@
+
+%e = 0.000000e+00
+%E = 0.000000E+00
+%e = 0.000000e+00
+%E = 0.000000E+00
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printgG.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printgG.d
new file mode 100644
index 000000000000..9e7e019b9984
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printgG.d
@@ -0,0 +1,54 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test %g, %G format printing.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+float f;
+double d;
+
+BEGIN
+{
+ printf("\n");
+
+ printf("%%g = %g\n", f);
+ printf("%%g = %g\n", d);
+
+ printf("%%G = %G\n", f);
+ printf("%%G = %G\n", d);
+
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printgG.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printgG.d.out
new file mode 100644
index 000000000000..e4175e642d7b
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.printgG.d.out
@@ -0,0 +1,6 @@
+
+%g = 0
+%g = 0
+%G = 0
+%G = 0
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d
new file mode 100644
index 000000000000..deb4f8172625
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with a fixed string and no actual tracing arguments.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("hello world from BEGIN");
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d.out
new file mode 100644
index 000000000000..cb7c7e94870f
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.rawfmt.d.out
@@ -0,0 +1 @@
+hello world from BEGIN
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d
new file mode 100644
index 000000000000..64e565e267b0
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/*
+ * Check %d v. %i v. %u.
+ */
+
+#pragma D option quiet
+
+uint16_t x;
+int16_t y;
+
+BEGIN
+{
+ x = 0xffffffff;
+ y = 0xffffffff;
+
+ printf("%d %i %u\n", x, x, x);
+ printf("%d %i %u\n", y, y, y);
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d.out
new file mode 100644
index 000000000000..169ac59b9554
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.signs.d.out
@@ -0,0 +1,3 @@
+65535 -1 65535
+-1 -1 65535
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d
new file mode 100644
index 000000000000..67d774910313
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d
@@ -0,0 +1,41 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * ASSERTION:
+ * Test printf() with a simple string argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("sysname = %s", `ostype);
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out
new file mode 100644
index 000000000000..82d597b1429a
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out
@@ -0,0 +1 @@
+sysname = FreeBSD
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d
new file mode 100644
index 000000000000..c2cf77d63925
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d
@@ -0,0 +1,43 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with a simple string argument.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("symbol = %a", &`malloc);
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out
new file mode 100644
index 000000000000..7f645e170116
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out
@@ -0,0 +1 @@
+symbol = kernel`malloc
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.uints.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.uints.d
new file mode 100644
index 000000000000..caa326e875fc
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.uints.d
@@ -0,0 +1,47 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test printf() with simple unsigned integer arguments.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("\n");
+ printf("%u\n", (uchar_t)123);
+ printf("%u\n", (ushort_t)123);
+ printf("%u\n", (ulong_t)123);
+ printf("%u\n", (u_longlong_t)123);
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.uints.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.uints.d.out
new file mode 100644
index 000000000000..d800e9167535
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.uints.d.out
@@ -0,0 +1,6 @@
+
+123
+123
+123
+123
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths.d
new file mode 100644
index 000000000000..21595c02974f
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths.d
@@ -0,0 +1,59 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test a variety of fixed and dynamic format widths.
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("\n");
+ x = 0;
+
+ printf("%0d\n", 1);
+ printf("%1d\n", 1);
+ printf("%2d\n", 1);
+ printf("%3d\n", 1);
+ printf("%4d\n", 1);
+ printf("%5d\n", 1);
+
+ printf("%*d\n", x++, 1);
+ printf("%*d\n", x++, 1);
+ printf("%*d\n", x++, 1);
+ printf("%*d\n", x++, 1);
+ printf("%*d\n", x++, 1);
+ printf("%*d\n", x++, 1);
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths.d.out
new file mode 100644
index 000000000000..39fc7a8a98f3
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths.d.out
@@ -0,0 +1,14 @@
+
+1
+1
+ 1
+ 1
+ 1
+ 1
+1
+1
+ 1
+ 1
+ 1
+ 1
+
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths1.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths1.d
new file mode 100644
index 000000000000..b5410ab8ac93
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.widths1.d
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Try to print charecter wide width using '?'
+ *
+ * SECTION: Output Formatting/printf()
+ *
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("\n");
+ x = 0;
+
+ printf("%?d\n", x++);
+ printf("%?d\n", x++);
+ printf("%?d\n", x++);
+ printf("%?d\n", x++);
+ printf("%?d\n", x++);
+ printf("%?d\n", x++);
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.wp.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.wp.d
new file mode 100644
index 000000000000..b6745e140557
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.wp.d
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+/*
+ * ASSERTION:
+ * Test a variety of fixed and dynamic format widths combined with precisions.
+ *
+ * SECTION: Output Formatting/printf()
+ */
+
+#pragma D option quiet
+
+BEGIN
+{
+ printf("\n");
+ x = 0;
+
+ printf("%0.0s\n", "hello");
+ printf("%1.1s\n", "hello");
+ printf("%2.2s\n", "hello");
+ printf("%3.3s\n", "hello");
+ printf("%4.4s\n", "hello");
+ printf("%5.5s\n", "hello");
+ printf("%6.6s\n", "hello");
+ printf("%7.7s\n", "hello");
+ printf("%8.8s\n", "hello");
+ printf("%9.9s\n", "hello");
+
+ printf("%*.*s\n", x, x++, "hello");
+ printf("%*.*s\n", x, x++, "hello");
+ printf("%*.*s\n", x, x++, "hello");
+ printf("%*.*s\n", x, x++, "hello");
+ printf("%*.*s\n", x, x++, "hello");
+ printf("%*.*s\n", x, x++, "hello");
+ printf("%*.*s\n", x, x++, "hello");
+ printf("%*.*s\n", x, x++, "hello");
+ printf("%*.*s\n", x, x++, "hello");
+ printf("%*.*s\n", x, x++, "hello");
+
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.wp.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.wp.d.out
new file mode 100644
index 000000000000..2f1fd9de1a85
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.wp.d.out
@@ -0,0 +1,22 @@
+
+hello
+h
+he
+hel
+hell
+hello
+ hello
+ hello
+ hello
+ hello
+hello
+h
+he
+hel
+hell
+hello
+ hello
+ hello
+ hello
+ hello
+