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/ustack/Makefile.kup | 0 .../dtrace/test/tst/common/ustack/tst.bigstack.c | 61 +++++++++ .../dtrace/test/tst/common/ustack/tst.bigstack.d | 45 +++++++ .../dtrace/test/tst/common/ustack/tst.depth.ksh | 110 ++++++++++++++++ .../cmd/dtrace/test/tst/common/ustack/tst.spin.c | 61 +++++++++ .../cmd/dtrace/test/tst/common/ustack/tst.spin.ksh | 139 +++++++++++++++++++++ 6 files changed, 416 insertions(+) create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/Makefile.kup create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.c create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.d create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.depth.ksh create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.c create mode 100644 src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.ksh (limited to 'src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack') diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/Makefile.kup new file mode 100644 index 00000000..e69de29b diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.c new file mode 100644 index 00000000..edd3dd15 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.c @@ -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 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include +#include +#include + +void grow1(int); + +void +grow(int frame) +{ + /* + * Create a ridiculously large stack - enough to push us over + * the default setting of 'dtrace_ustackdepth_max' (2048). + */ + if (frame >= 2048) + for (;;) + getpid(); + + grow1(++frame); +} + +void +grow1(int frame) +{ + grow(++frame); +} + +int +main(int argc, char *argv[]) +{ + grow(1); + + return (0); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.d new file mode 100644 index 00000000..66fda5ba --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.bigstack.d @@ -0,0 +1,45 @@ +/* + * 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" + +syscall::getpid:entry +/pid == $1/ +{ + @[ustackdepth] = count(); +} + +ERROR +/arg4 == DTRACEFLT_BADSTACK/ +{ + exit(0); +} + +profile:::tick-1s +/++n == 10/ +{ + exit(1) +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.depth.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.depth.ksh new file mode 100644 index 00000000..26cff421 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.depth.ksh @@ -0,0 +1,110 @@ +# +# 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 + +file=out.$$ +dtrace=$1 + +rm -f $file + +$dtrace -o $file -c date -s /dev/stdin <) { + chomp; + + last if /^\$/; + + die "expected START at \$.\n" unless /^START/; + + \$_ = <>; + chomp; + die "expected depth (\$_) at \$.\n" unless /^(\d+)\$/; + \$depth = \$1; + + for (\$i = 0; \$i < \$depth; \$i++) { + \$_ = <>; + chomp; + die "unexpected END at \$.\n" if /^END/; + } + + \$_ = <>; + chomp; + die "expected END at \$.\n" unless /^END\$/; + } +EOF + +status=$? + +count=`wc -l $file | cut -f1 -do` +if [ "$count" -lt 1000 ]; then + echo $tst: output was too short + status=1 +fi + + +if [ "$status" -eq 0 ]; then + rm -f $file +fi + +exit $status diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.c new file mode 100644 index 00000000..bdeb16d9 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.c @@ -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. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include + +volatile long long count = 0; + +int +baz(int a) +{ + (void) getpid(); + while (count != -1) { + count++; + a++; + } + + return (a + 1); +} + +int +bar(int a) +{ + return (baz(a + 1) - 1); +} + +int +foo(int a, int b) +{ + return (bar(a) - b); +} + +int +main(int argc, char **argv) +{ + return (foo(argc, (int)argv) == 0); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.ksh b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.ksh new file mode 100644 index 00000000..1a7e0e12 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/ustack/tst.spin.ksh @@ -0,0 +1,139 @@ +# +# 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 + +file=out.$$ +dtrace=$1 + +rm -f $file + +dir=`dirname $tst` + +$dtrace -o $file -c $dir/tst.spin.exe -s /dev/stdin < 100/ + { + @total = count(); + @stacks[ustack(4)] = count(); + } + + tick-1s + { + secs++; + } + + tick-1s + /secs > 5/ + { + done = 1; + } + + tick-1s + /secs > 10/ + { + trace("test timed out"); + exit(1); + } + + profile-1999 + /pid == \$target && done/ + { + raise(SIGINT); + exit(0); + } + + END + { + printa("TOTAL %@u\n", @total); + printa("START%kEND\n", @stacks); + } +EOF + +status=$? +if [ "$status" -ne 0 ]; then + echo $tst: dtrace failed + exit $status +fi + +perl /dev/stdin $file <; + chomp; + die "output problem\n" unless /^TOTAL (\d+)/; + \$count = \$1; + die "too few samples (\$count)\n" unless \$count >= 1000; + + while (<>) { + chomp; + + last if /^$/; + + die "expected START at \$.\n" unless /^START/; + + + \$_ = <>; + chomp; + die "expected END at \$.\n" unless /\`baz\+/; + + \$_ = <>; + chomp; + die "expected END at \$.\n" unless /\`bar\+/; + + \$_ = <>; + chomp; + die "expected END at \$.\n" unless /\`foo\+/; + + \$_ = <>; + chomp; + die "expected END at \$.\n" unless /\`main\+/; + + \$_ = <>; + chomp; + die "expected END at \$.\n" unless /^END\$/; + } + +EOF + +status=$? +if [ "$status" -eq 0 ]; then + rm -f $file +fi + +exit $status -- cgit v1.2.3