diff options
Diffstat (limited to '')
7 files changed, 352 insertions, 0 deletions
diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/Makefile.kup b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/Makefile.kup new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/Makefile.kup diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.c new file mode 100644 index 00000000..e3910836 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.c @@ -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" + +#include <unistd.h> +#include <signal.h> + +int +main(int argc, char **argv) +{ + sigset_t ss; + + (void) sigemptyset(&ss); + (void) sigaddset(&ss, SIGINT); + (void) sigprocmask(SIG_BLOCK, &ss, NULL); + + do { + (void) getpid(); + (void) sigpending(&ss); + } while (!sigismember(&ss, SIGINT)); + + return (0); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.d new file mode 100644 index 00000000..b3b70f24 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise1.d @@ -0,0 +1,67 @@ +/* + * 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: + * Positive test for raise + * + * SECTION: Actions and Subroutines/raise() + */ + +#pragma D option destructive + +BEGIN +{ + /* + * Wait no more than a second for the process to call getpid(). + */ + timeout = timestamp + 1000000000; +} + +syscall::getpid:entry +/pid == $1/ +{ + trace("raised"); + raise(SIGINT); + /* + * Wait no more than half a second for the process to die. + */ + timeout = timestamp + 500000000; +} + +syscall::rexit:entry +{ + exit(0); +} + +profile:::tick-4 +/timestamp > timeout/ +{ + trace("timed out"); + exit(1); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.c new file mode 100644 index 00000000..be0d9820 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.c @@ -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" + +#include <unistd.h> +#include <signal.h> + +static void +handle(int sig) +{ + exit(0); +} + +int +main(int argc, char **argv) +{ + struct sigaction sa; + + sa.sa_handler = handle; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + + (void) sigaction(SIGINT, &sa, NULL); + + for (;;) { + (void) getpid(); + } +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.d new file mode 100644 index 00000000..1f967a3d --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise2.d @@ -0,0 +1,67 @@ +/* + * 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: + * Positive test for raise + * + * SECTION: Actions and Subroutines/raise() + */ + +#pragma D option destructive + +BEGIN +{ + /* + * Wait no more than a second for the process to call getpid(). + */ + timeout = timestamp + 1000000000; +} + +syscall::getpid:return +/pid == $1/ +{ + trace("raised"); + raise(SIGINT); + /* + * Wait no more than half a second for the process to die. + */ + timeout = timestamp + 500000000; +} + +syscall::rexit:entry +{ + exit(0); +} + +profile:::tick-4 +/timestamp > timeout/ +{ + trace("timed out"); + exit(1); +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.c b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.c new file mode 100644 index 00000000..be0d9820 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.c @@ -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" + +#include <unistd.h> +#include <signal.h> + +static void +handle(int sig) +{ + exit(0); +} + +int +main(int argc, char **argv) +{ + struct sigaction sa; + + sa.sa_handler = handle; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + + (void) sigaction(SIGINT, &sa, NULL); + + for (;;) { + (void) getpid(); + } +} diff --git a/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.d b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.d new file mode 100644 index 00000000..b3b70f24 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/onnv/cmd/dtrace/test/tst/common/raise/tst.raise3.d @@ -0,0 +1,67 @@ +/* + * 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: + * Positive test for raise + * + * SECTION: Actions and Subroutines/raise() + */ + +#pragma D option destructive + +BEGIN +{ + /* + * Wait no more than a second for the process to call getpid(). + */ + timeout = timestamp + 1000000000; +} + +syscall::getpid:entry +/pid == $1/ +{ + trace("raised"); + raise(SIGINT); + /* + * Wait no more than half a second for the process to die. + */ + timeout = timestamp + 500000000; +} + +syscall::rexit:entry +{ + exit(0); +} + +profile:::tick-4 +/timestamp > timeout/ +{ + trace("timed out"); + exit(1); +} |