From f215e02bf85f68d3a6106c2a1f4f7f063f819064 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 11 Apr 2024 10:17:27 +0200 Subject: Adding upstream version 7.0.14-dfsg. Signed-off-by: Daniel Baumann --- .../cmd/dtrace/test/tst/common/usdt/Makefile.kup | 0 .../onnv/cmd/dtrace/test/tst/common/usdt/argmap.d | 31 ++++ .../onnv/cmd/dtrace/test/tst/common/usdt/args.d | 31 ++++ .../onnv/cmd/dtrace/test/tst/common/usdt/forker.d | 31 ++++ .../cmd/dtrace/test/tst/common/usdt/tst.andpid.ksh | 46 ++++++ .../cmd/dtrace/test/tst/common/usdt/tst.argmap.c | 39 +++++ .../cmd/dtrace/test/tst/common/usdt/tst.argmap.d | 65 ++++++++ .../cmd/dtrace/test/tst/common/usdt/tst.args.c | 39 +++++ .../cmd/dtrace/test/tst/common/usdt/tst.args.d | 60 ++++++++ .../dtrace/test/tst/common/usdt/tst.badguess.ksh | 84 ++++++++++ .../dtrace/test/tst/common/usdt/tst.corruptenv.ksh | 107 +++++++++++++ .../dtrace/test/tst/common/usdt/tst.dlclose1.ksh | 159 +++++++++++++++++++ .../test/tst/common/usdt/tst.dlclose1.ksh.out | 3 + .../dtrace/test/tst/common/usdt/tst.dlclose2.ksh | 160 +++++++++++++++++++ .../test/tst/common/usdt/tst.dlclose2.ksh.out | 2 + .../dtrace/test/tst/common/usdt/tst.dlclose3.ksh | 170 +++++++++++++++++++++ .../dtrace/test/tst/common/usdt/tst.eliminate.ksh | 106 +++++++++++++ .../dtrace/test/tst/common/usdt/tst.enabled.ksh | 96 ++++++++++++ .../test/tst/common/usdt/tst.enabled.ksh.out | 2 + .../dtrace/test/tst/common/usdt/tst.enabled2.ksh | 113 ++++++++++++++ .../test/tst/common/usdt/tst.enabled2.ksh.out | 3 + .../test/tst/common/usdt/tst.entryreturn.ksh | 118 ++++++++++++++ .../test/tst/common/usdt/tst.entryreturn.ksh.out | 10 ++ .../cmd/dtrace/test/tst/common/usdt/tst.fork.ksh | 105 +++++++++++++ .../dtrace/test/tst/common/usdt/tst.fork.ksh.out | 4 + .../cmd/dtrace/test/tst/common/usdt/tst.forker.c | 47 ++++++ .../cmd/dtrace/test/tst/common/usdt/tst.forker.ksh | 55 +++++++ .../dtrace/test/tst/common/usdt/tst.guess32.ksh | 96 ++++++++++++ .../dtrace/test/tst/common/usdt/tst.guess64.ksh | 100 ++++++++++++ .../cmd/dtrace/test/tst/common/usdt/tst.header.ksh | 85 +++++++++++ .../dtrace/test/tst/common/usdt/tst.include.ksh | 61 ++++++++ .../dtrace/test/tst/common/usdt/tst.linkpriv.ksh | 82 ++++++++++ .../dtrace/test/tst/common/usdt/tst.linkunpriv.ksh | 84 ++++++++++ .../dtrace/test/tst/common/usdt/tst.multiple.ksh | 99 ++++++++++++ .../test/tst/common/usdt/tst.multiple.ksh.out | 5 + .../dtrace/test/tst/common/usdt/tst.nodtrace.ksh | 90 +++++++++++ .../test/tst/common/usdt/tst.onlyenabled.ksh | 82 ++++++++++ .../cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh | 98 ++++++++++++ .../cmd/dtrace/test/tst/common/usdt/tst.static.ksh | 98 ++++++++++++ .../dtrace/test/tst/common/usdt/tst.static.ksh.out | 5 + .../dtrace/test/tst/common/usdt/tst.static2.ksh | 108 +++++++++++++ .../test/tst/common/usdt/tst.static2.ksh.out | 5 + .../cmd/dtrace/test/tst/common/usdt/tst.user.ksh | 96 ++++++++++++ .../dtrace/test/tst/common/usdt/tst.user.ksh.out | 2 + 44 files changed, 2882 insertions(+) create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/Makefile.kup create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/argmap.d create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/args.d create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/forker.d create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.andpid.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.c create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.d create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.c create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.d create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh create mode 100755 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh.out create mode 100755 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh.out create mode 100755 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose3.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.eliminate.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh.out create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled2.ksh.out create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.entryreturn.ksh.out create mode 100755 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh.out create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.c create mode 100755 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess64.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.header.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.include.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkunpriv.ksh create mode 100755 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.multiple.ksh.out create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.nodtrace.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.onlyenabled.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static.ksh.out create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.static2.ksh.out create mode 100755 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.user.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.user.ksh.out (limited to 'src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt') diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/Makefile.kup new file mode 100644 index 00000000..e69de29b diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/argmap.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/argmap.d new file mode 100644 index 00000000..0a1c3609 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/argmap.d @@ -0,0 +1,31 @@ +/* + * 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" + +provider test_prov { + probe place(int i, int j) : (int j, int i, int i, int j); +}; diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/args.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/args.d new file mode 100644 index 00000000..a11984c1 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/args.d @@ -0,0 +1,31 @@ +/* + * 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" + +provider test_prov { + probe place(int i, int j); +}; diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/forker.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/forker.d new file mode 100644 index 00000000..f63b965d --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/forker.d @@ -0,0 +1,31 @@ +/* + * 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. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +provider forker { + probe fire(); +}; diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.andpid.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.andpid.ksh new file mode 100644 index 00000000..2096422b --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.andpid.ksh @@ -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. +# +#ident "%Z%%M% %I% %E% SMI" + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +$dtrace -c date -s /dev/stdin < + +int +main(int argc, char **argv) +{ + for (;;) { + DTRACE_PROBE2(test_prov, place, 10, 4); + } + + return (0); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.d new file mode 100644 index 00000000..fd9f9f47 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.argmap.d @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * ASSERTION: Verify that argN and args[N] variables are properly remapped. + */ + +BEGIN +{ + /* Timeout after 5 seconds */ + timeout = timestamp + 5000000000; +} + +test_prov$1:::place +/arg0 != 4 || arg1 != 10 || arg2 != 10 || arg3 != 4/ +{ + printf("args are %d, %d, %d, %d; should be 4, 10, 10, 4", + arg0, arg1, arg2, arg3); + exit(1); +} + +test_prov$1:::place +/args[0] != 4 || args[1] != 10 || args[2] != 10 || args[3] != 4/ +{ + printf("args are %d, %d, %d, %d; should be 4, 10, 10, 4", + args[0], args[1], args[2], args[3]); + exit(1); +} + +test_prov$1:::place +{ + exit(0); +} + +profile:::tick-1 +/timestamp > timeout/ +{ + trace("test timed out"); + exit(1); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.c new file mode 100644 index 00000000..5697ef51 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.c @@ -0,0 +1,39 @@ +/* + * 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" + +#include + +int +main(int argc, char **argv) +{ + for (;;) { + DTRACE_PROBE2(test_prov, place, 10, 4); + } + + return (0); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.d new file mode 100644 index 00000000..bb74e80f --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.args.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: + * + * SECTION: + * + * NOTES: + * + */ +BEGIN +{ + /* Timeout after 5 seconds */ + timeout = timestamp + 5000000000; +} + +test_prov$1:::place +/arg0 == 10 && arg1 == 4/ +{ + exit(0); +} + +test_prov$1:::place +{ + printf("args are %d, %d; should be 10, 4", arg0, arg1); + exit(1); +} + +profile:::tick-1 +/timestamp > timeout/ +{ + trace("test timed out"); + exit(1); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh new file mode 100644 index 00000000..291fe83f --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.badguess.ksh @@ -0,0 +1,84 @@ +# +# 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. +# +# ident "%Z%%M% %I% %E% SMI" + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +int +main(int argc, char **argv) +{ + if (TEST_PROV_GO_ENABLED()) { + TEST_PROV_GO(); + } +} +EOF + +cc -xarch=generic64 -c -o test64.o test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c 64-bit" + exit 1 +fi +cc -xarch=generic -c -o test32.o test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c 32-bit" + exit 1 +fi + +$dtrace -G -s prov.d test32.o test64.o +if [ $? -eq 0 ]; then + print -u2 "DOF generation failed to generate a warning" + exit 1 +fi + +cd / +/usr/bin/rm -rf $DIR + +exit 0 diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh new file mode 100644 index 00000000..68dbb034 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh @@ -0,0 +1,107 @@ +#!/usr/bin/ksh +# +# 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. +# + +# +# This test verifies that a program that corrupts its own environment +# without inducing a crash does not crash solely due to drti.o's use of +# getenv(3C). +# + +PATH=/usr/bin:/usr/sbin:$PATH + +if (( $# != 1 )); then + print -u2 'expected one argument: ' + exit 2 +fi + +# +# jdtrace does not implement the -h option that is required to generate +# C header files. +# +if [[ "$1" == */jdtrace ]]; then + exit 0 +fi + +dtrace="$1" +startdir="$PWD" +dir=$(mktemp -td drtiXXXXXX) +if (( $? != 0 )); then + print -u2 'Could not create safe temporary directory' + exit 2 +fi + +cd "$dir" + +cat > Makefile < prov.d < main.c < +#include +#include "prov.h" + +int +main(int argc, char **argv, char **envp) +{ + envp[0] = (char*)0xff; + TESTER_ENTRY(); + return 0; +} +EOF + +make > /dev/null +status=$? +if (( $status != 0 )) ; then + print -u2 "failed to build" +else + ./main + status=$? +fi + +cd "$startdir" +rm -rf "$dir" + +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh new file mode 100755 index 00000000..0a666662 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh @@ -0,0 +1,159 @@ +#!/bin/ksh -p +# +# 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" + +# +# This test verifies that USDT providers are removed when its associated +# load object is closed via dlclose(3dl). +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > Makefile < prov.d < livelib.c < deadlib.c < main.c < +#include +#include + +int +main(int argc, char **argv) +{ + void *live; + + if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) { + printf("dlopen of livelib.so failed: %s\n", dlerror()); + return (1); + } + + (void) dlclose(live); + + pause(); + + return (0); +} +EOF + +/usr/ccs/bin/make > /dev/null +if [ $? -ne 0 ]; then + print -u2 "failed to build" + exit 1 +fi + +script() { + $dtrace -w -x bufsize=1k -c ./main -qs /dev/stdin <&1 +status=$? + +cd / +/usr/bin/rm -rf $DIR + +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh.out b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh.out new file mode 100644 index 00000000..2f5bb15f --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose1.ksh.out @@ -0,0 +1,3 @@ +dtrace: failed to match test_prov*:::: No probe matches description + ID PROVIDER MODULE FUNCTION NAME + diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh new file mode 100755 index 00000000..c83d8bfa --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.dlclose2.ksh @@ -0,0 +1,160 @@ +#!/bin/ksh -p +# +# 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. +# +#ident "%Z%%M% %I% %E% SMI" + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > Makefile < prov.d < livelib.c < deadlib.c < main.c < +#include +#include + +int +main(int argc, char **argv) +{ + void *live, *dead; + void *go; + + if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) { + printf("dlopen of livelib.so failed: %s\n", dlerror()); + return (1); + } + + (void) dlclose(live); + + if ((dead = dlopen("./deadlib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) { + printf("dlopen of deadlib.so failed: %s\n", dlerror()); + return (1); + } + + if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) { + printf("dlopen of livelib.so failed: %s\n", dlerror()); + return (1); + } + + if ((go = dlsym(live, "go")) == NULL) { + printf("failed to lookup 'go' in livelib.so\n"); + return (1); + } + + ((void (*)(void))go)(); + + return (0); +} +EOF + +/usr/ccs/bin/make > /dev/null +if [ $? -ne 0 ]; then + print -u2 "failed to build" + exit 1 +fi + +script() { + $dtrace -w -c ./main -Zqs /dev/stdin <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > Makefile < prov.d < livelib.c < deadlib.c < main.c < +#include +#include + +static void +foo(void) +{ + (void) close(-1); +} + +int +main(int argc, char **argv) +{ + void *live; + + if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) { + printf("dlopen of livelib.so failed: %s\n", dlerror()); + return (1); + } + + (void) dlclose(live); + + foo(); + + return (0); +} +EOF + +/usr/ccs/bin/make > /dev/null +if [ $? -ne 0 ]; then + print -u2 "failed to build" + exit 1 +fi + +script() { + $dtrace -c ./main -s /dev/stdin <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +static void +foo(void) +{ + TEST_PROV_GO(); +} + +int +main(int argc, char **argv) +{ + foo(); + + return (0); +} +EOF + +cc -c test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -32 -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +nm test.o | grep \$dtrace > /dev/null +if [ $? -ne 0 ]; then + print -u2 "no temporary symbols in the object file" + exit 1 +fi + +nm test | grep \$dtrace > /dev/null +if [ $? -eq 0 ]; then + print -u2 "failed to eliminate temporary symbols" + exit 1 +fi + +cd / +/usr/bin/rm -rf $DIR + +exit 0 diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh new file mode 100644 index 00000000..ba62be75 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.enabled.ksh @@ -0,0 +1,96 @@ +# +# 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. +# +#ident "%Z%%M% %I% %E% SMI" + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +int +main(int argc, char **argv) +{ + if (TEST_PROV_GO_ENABLED()) { + TEST_PROV_GO(); + } +} +EOF + +cc -c test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -32 -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +script() +{ + $dtrace -c ./test -qs /dev/stdin <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +int +foo(void) +{ + return (24); +} + +int +main(int argc, char **argv) +{ + int a = foo(); + if (TEST_PROV_GO_ENABLED()) { + TEST_PROV_GO(); + } + (void) printf("%d %d %d\n", a, a, a); + + return (0); +} +EOF + +cc -c -xO2 test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -32 -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +script() +{ + ./test + + $dtrace -c ./test -qs /dev/stdin <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > test.c < + +int +main(int argc, char **argv) +{ + DTRACE_PROBE(test_prov, entry); + DTRACE_PROBE(test_prov, __entry); + DTRACE_PROBE(test_prov, foo__entry); + DTRACE_PROBE(test_prov, carpentry); + DTRACE_PROBE(test_prov, miniatureturn); + DTRACE_PROBE(test_prov, foo__return); + DTRACE_PROBE(test_prov, __return); + /* + * Unfortunately, a "return" probe is not currently possible due to + * the conflict with a reserved word. + */ + DTRACE_PROBE(test_prov, done); +} +EOF + +cat > prov.d < main + -> main + -> main + | main:carpentry + | main:miniatureturn + <- main + <- main + | main:done diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh new file mode 100755 index 00000000..9c12e6de --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.fork.ksh @@ -0,0 +1,105 @@ +#!/bin/ksh -p +# +# 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. +# +#ident "%Z%%M% %I% %E% SMI" + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include +#include +#include "prov.h" + +int +main(int argc, char **argv) +{ + TEST_PROV_GO(); + if (fork() == 0) { + TEST_PROV_GO(); + return (0); + } + + (void) wait(NULL); + TEST_PROV_GO(); + + return (0); +} +EOF + +cc -c test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -32 -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +script() { + $dtrace -c ./test -Zqs /dev/stdin < + +#include "forker.h" + +int +main(int argc, char **argv) +{ + int i; + + for (i = 0; i < 10000; i++) { + FORKER_FIRE(); + if (fork() == 0) + exit(0); + + (void) wait(NULL); + } + + return (0); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.ksh new file mode 100755 index 00000000..d35fc4db --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.forker.ksh @@ -0,0 +1,55 @@ +#!/usr/bin/ksh +# +# 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 + +# +# Test that we don't deadlock between forking and enabling/disabling USDT +# probes. This test has succeeded if it completes at all. +# + +./tst.forker.exe & +id=$! + +while kill -0 $id >/dev/null 2>&1; do + $dtrace -p $id -s /dev/stdin <<-EOF + forker*:::fire + /i++ == 4/ + { + exit(0); + } + EOF +done + +exit 0 diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh new file mode 100644 index 00000000..68a8d016 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.guess32.ksh @@ -0,0 +1,96 @@ +# +# 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. +# +# ident "%Z%%M% %I% %E% SMI" + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +int +main(int argc, char **argv) +{ + if (TEST_PROV_GO_ENABLED()) { + TEST_PROV_GO(); + } +} +EOF + +cc -xarch=generic -c test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -xarch=generic -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +script() +{ + $dtrace -c ./test -qs /dev/stdin <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +int +main(int argc, char **argv) +{ + if (TEST_PROV_GO_ENABLED()) { + TEST_PROV_GO(); + } +} +EOF + +cc -xarch=generic64 -c test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -xarch=generic64 -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +script() +{ + $dtrace -c ./test -qs /dev/stdin <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +int +main(int argc, char **argv) +{ + TEST_PROV_ZERO(); + TEST_PROV_ONE(1); + TEST_PROV_U_NDER("hi there"); + TEST_PROV_D_ASH(argv); +} +EOF + +cc -c test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -32 -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +cd / +/usr/bin/rm -rf $DIR diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.include.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.include.ksh new file mode 100644 index 00000000..5683f47d --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.include.ksh @@ -0,0 +1,61 @@ +# +# 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. +# +# ident "%Z%%M% %I% %E% SMI" + +# Make sure defines _DTRACE_VERSION + +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > test.c < + +int +main(int argc, char **argv) +{ +#ifdef _DTRACE_VERSION + return (0); +#else + return (1); +#endif +} +EOF + +cc -xarch=generic -o test test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi + +./test +status=$? + +cd / +/usr/bin/rm -rf $DIR + +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh new file mode 100644 index 00000000..ec07e057 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.linkpriv.ksh @@ -0,0 +1,82 @@ +# +# 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. +# +#ident "%Z%%M% %I% %E% SMI" + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > test.c < + +int +main(int argc, char **argv) +{ + DTRACE_PROBE(test_prov, zero); + DTRACE_PROBE1(test_prov, one, 1); + DTRACE_PROBE2(test_prov, two, 2, 3); + DTRACE_PROBE3(test_prov, three, 4, 5, 7); + DTRACE_PROBE4(test_prov, four, 7, 8, 9, 10); + DTRACE_PROBE5(test_prov, five, 11, 12, 13, 14, 15); +} +EOF + +cat > prov.d <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +ppriv -s A=basic $$ + +cat > test.c < + +int +main(int argc, char **argv) +{ + DTRACE_PROBE(test_prov, zero); + DTRACE_PROBE1(test_prov, one, 1); + DTRACE_PROBE2(test_prov, two, 2, 3); + DTRACE_PROBE3(test_prov, three, 4, 5, 7); + DTRACE_PROBE4(test_prov, four, 7, 8, 9, 10); + DTRACE_PROBE5(test_prov, five, 11, 12, 13, 14, 15); +} +EOF + +cat > prov.d <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +int +main(int argc, char **argv) +{ + TEST_PROV_GO(); + TEST_PROV_GO(); + TEST_PROV_GO(); + TEST_PROV_GO(); + + return (0); +} +EOF + +cc -c test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -32 -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +script() { + $dtrace -c ./test -qs /dev/stdin <. This tests that dtrace -h will produce a header file which can +# be used on a system where DTrace is not present. + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +touch unistd.h + +cat > prov.d < test.c <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +int +main(int argc, char **argv) +{ + if (TEST_PROV_GO_ENABLED()) + return (2); + + return (0); +} +EOF + +cc -c test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -32 -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +cd / +/usr/bin/rm -rf $DIR diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh new file mode 100644 index 00000000..7fad4015 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/usdt/tst.reeval.ksh @@ -0,0 +1,98 @@ +# +# 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 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > test.c < + +int +main(int argc, char **argv) +{ + DTRACE_PROBE(test_prov, zero); +} +EOF + +cat > prov.d <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > test.c < +#include + +static void +foo(void) +{ + DTRACE_PROBE(test_prov, probe1); + DTRACE_PROBE(test_prov, probe2); +} + +int +main(int argc, char **argv) +{ + DTRACE_PROBE(test_prov, probe1); + DTRACE_PROBE(test_prov, probe2); + foo(); +} +EOF + +cat > prov.d <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > test.c < +#include + +static void +foo(void) +{ + DTRACE_PROBE(test_prov, probe1); + DTRACE_PROBE(test_prov, probe2); +} + +int +main(int argc, char **argv) +{ + DTRACE_PROBE(test_prov, probe1); + DTRACE_PROBE(test_prov, probe2); + foo(); +} +EOF + +cat > prov.d <' + exit 2 +fi + +dtrace=$1 +DIR=/var/tmp/dtest.$$ + +mkdir $DIR +cd $DIR + +cat > prov.d < test.c < +#include "prov.h" + +int +main(int argc, char **argv) +{ + TEST_PROV_GO(); + + return (0); +} +EOF + +cc -c test.c +if [ $? -ne 0 ]; then + print -u2 "failed to compile test.c" + exit 1 +fi +$dtrace -G -32 -s prov.d test.o +if [ $? -ne 0 ]; then + print -u2 "failed to create DOF" + exit 1 +fi +cc -o test test.o prov.o +if [ $? -ne 0 ]; then + print -u2 "failed to link final executable" + exit 1 +fi + +script() { + $dtrace -c 'ppriv -e -s A=basic ./test' -Zqs /dev/stdin <