diff options
Diffstat (limited to 'cddl/contrib/opensolaris/cmd')
38 files changed, 951 insertions, 382 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c index cc7959f..a745ceb 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c @@ -23,8 +23,9 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ #include <sys/types.h> #include <sys/stat.h> @@ -1409,6 +1410,7 @@ main(int argc, char *argv[]) (void) dtrace_setopt(g_dtp, "bufsize", "4m"); (void) dtrace_setopt(g_dtp, "aggsize", "4m"); #endif + (void) dtrace_setopt(g_dtp, "temporal", "yes"); /* * If -G is specified, enable -xlink=dynamic and -xunodefs to permit diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl b/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl index 7b47580..db15741 100755 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dtest.pl @@ -583,6 +583,8 @@ if ($opt_x) { die "$PNAME: failed to open $PNAME.$$.log: $!\n" unless (!$opt_l || open(LOG, ">$PNAME.$$.log")); +$ENV{'DTRACE_DEBUG_REGSET'} = 'true'; + if ($opt_g) { $ENV{'UMEM_DEBUG'} = 'default,verbose'; $ENV{'UMEM_LOGGING'} = 'fail,contents'; diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d new file mode 100644 index 0000000..bb3ed47 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#pragma D option quiet + +/* + * Make sure the sizes of compatible keys doesn't affect the sort order. + */ + +BEGIN +{ + @[(int)1, 0] = sum(10); + @[(uint64_t)2, 0] = sum(20); + @[(int)3, 0] = sum(30); + @[(uint64_t)4, 0] = sum(40); + printa(@); + + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out new file mode 100644 index 0000000..83252ad --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/aggs/tst.sizedkeys.d.out @@ -0,0 +1,6 @@ + + 1 0 10 + 2 0 20 + 3 0 30 + 4 0 40 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out new file mode 100644 index 0000000..d3b6af8 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.basics.d.out @@ -0,0 +1,8 @@ +The value of i is 6 +The value of i is 18 +The value of i is 72 +The value of i is 25920 +The value of i is 935761216 +The value of i is -91738734 +The value of i is -91738729 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d new file mode 100644 index 0000000..714fbe3 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d @@ -0,0 +1,50 @@ +/* + * 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. + */ + +/* + * Test compile-time casting between integer types of different size. + */ + +#pragma D option quiet + +int64_t x; + +BEGIN +{ + x = (int32_t)(int16_t)0xfff0; + printf("%16x %20d %20u\n", x, x, x); + x = (int32_t)(uint16_t)0xfff0; + printf("%16x %20d %20u\n", x, x, x); + x = (uint32_t)(int16_t)0xfff0; + printf("%16x %20d %20u\n", x, x, x); + x = (uint32_t)(uint16_t)0xfff0; + printf("%16x %20d %20u\n", x, x, x); + printf("\n"); + + x = (int16_t)(int32_t)0xfff0; + printf("%16x %20d %20u\n", x, x, x); + x = (int16_t)(uint32_t)0xfff0; + printf("%16x %20d %20u\n", x, x, x); + x = (uint16_t)(int32_t)0xfff0; + printf("%16x %20d %20u\n", x, x, x); + x = (uint16_t)(uint32_t)0xfff0; + printf("%16x %20d %20u\n", x, x, x); + + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out new file mode 100644 index 0000000..d43df27 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compcast.d.out @@ -0,0 +1,10 @@ +fffffffffffffff0 -16 18446744073709551600 + fff0 65520 65520 + fffffff0 4294967280 4294967280 + fff0 65520 65520 + +fffffffffffffff0 -16 18446744073709551600 +fffffffffffffff0 -16 18446744073709551600 + fff0 65520 65520 + fff0 65520 65520 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d deleted file mode 100644 index 2db1b63..0000000 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.complex.d +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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: - * Complex expressions. - * Call complex expressions and make sure test succeeds. - * Match expected output in tst.complex.d.out - * - * SECTION: Types, Operators, and Expressions/Arithmetic Operators - * - */ - -#pragma D option quiet - -BEGIN -{ - i = 0; - i = i++ + ++i; - printf("The value of i is %d\n", i); - i = i-- - --i; - printf("The value of i is %d\n", i); - i = i-- + ++i; - printf("The value of i is %d\n", i); - i += i++ + -- i + ++i - ++i * i ; - printf("The value of i is %d\n", i); - i -= i++ * 3; - printf("The value of i is %d\n", i); - i = i++/i--+i++-++i-++i; - printf("The value of i is %d\n", i); - exit (0); -} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d new file mode 100644 index 0000000..0589b72 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d @@ -0,0 +1,36 @@ +/* + * 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. + */ + +/* + * Test narrowing at assignment. + */ + +#pragma D option quiet + +uint16_t x; +uint32_t y; + +BEGIN +{ + x = 0xbeefcafe; + y = x; + printf("%x", y); /* where's the beef? */ + + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out new file mode 100644 index 0000000..ea17b16 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.compnarrowassign.d.out @@ -0,0 +1 @@ +cafe diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d new file mode 100644 index 0000000..a7017bf --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d @@ -0,0 +1,52 @@ +/* + * 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. + */ + +/* + * Test execution-time casting between integer types of different size. + */ + +#pragma D option quiet + +int64_t x; + +BEGIN +{ + z = 0xfff0; + + x = (int32_t)(int16_t)z; + printf("%16x %20d %20u\n", x, x, x); + x = (int32_t)(uint16_t)z; + printf("%16x %20d %20u\n", x, x, x); + x = (uint32_t)(int16_t)z; + printf("%16x %20d %20u\n", x, x, x); + x = (uint32_t)(uint16_t)z; + printf("%16x %20d %20u\n", x, x, x); + printf("\n"); + + x = (int16_t)(int32_t)z; + printf("%16x %20d %20u\n", x, x, x); + x = (int16_t)(uint32_t)z; + printf("%16x %20d %20u\n", x, x, x); + x = (uint16_t)(int32_t)z; + printf("%16x %20d %20u\n", x, x, x); + x = (uint16_t)(uint32_t)z; + printf("%16x %20d %20u\n", x, x, x); + + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out new file mode 100644 index 0000000..d43df27 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/arithmetic/tst.execcast.d.out @@ -0,0 +1,10 @@ +fffffffffffffff0 -16 18446744073709551600 + fff0 65520 65520 + fffffff0 4294967280 4294967280 + fff0 65520 65520 + +fffffffffffffff0 -16 18446744073709551600 +fffffffffffffff0 -16 18446744073709551600 + fff0 65520 65520 + fff0 65520 65520 + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d index 143ed64..fffc7e3 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.fill1.d @@ -23,26 +23,29 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ /* * ASSERTION: * Positive test for fill buffer policy. * * SECTION: Buffers and Buffering/fill Policy; - * Buffers and Buffering/Buffer Sizes; + * Buffers and Buffering/Buffer Sizes; * Options and Tunables/bufsize; * Options and Tunables/bufpolicy; * Options and Tunables/statusrate */ /* - * This is a brute-force way of testing fill buffers. We assume that each - * printf() stores 8 bytes. Because each fill buffer is per-CPU, we must - * fill up our buffer in one series of enablings on a single CPU. + * This is a brute-force way of testing fill buffers. We assume that + * each printf() stores 16 bytes (4x 32-bit words for EPID, timestamp + * lo, timestamp hi, and the variable i). Because each fill buffer is + * per-CPU, we must fill up our buffer in one series of enablings on a + * single CPU. */ #pragma D option bufpolicy=fill -#pragma D option bufsize=64 +#pragma D option bufsize=128 #pragma D option statusrate=10ms #pragma D option quiet diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.ring3.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.ring3.d index 68e3588..ea74694 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.ring3.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/buffering/tst.ring3.d @@ -23,8 +23,9 @@ * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ /* * ASSERTION: @@ -37,19 +38,20 @@ */ /* - * We make some regrettable assumptions about the implementation in this test. - * First, we assume that each entry for the printf() of an int takes _exactly_ - * eight bytes (four bytes for the EPID, four bytes for the payload). Second, - * we assume that by allocating storage for n + 1 records, we will get exactly - * n. Here is why: the final predicate that evaluates to false will reserve - * space that it won't use. This act of reservation will advance the wrapped - * offset. That record won't be subsequently used, but the wrapped offset has - * advanced. (And in this case, that old record is clobbered by the exit() - * anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally: we rely on being - * able to run on the CPU that we first ran on. + * We make some regrettable assumptions about the implementation in this + * test. First, we assume that each entry for the printf() of an int + * takes _exactly_ 16 bytes (4 bytes for the EPID, 8 bytes for the + * timestamp, 4 bytes for the payload). Second, we assume that by + * allocating storage for n + 1 records, we will get exactly n. Here is + * why: the final predicate that evaluates to false will reserve space + * that it won't use. This act of reservation will advance the wrapped + * offset. That record won't be subsequently used, but the wrapped + * offset has advanced. (And in this case, that old record is clobbered + * by the exit() anyway.) Thirdly: we rely on t_cpu/cpu_id. Finally: + * we rely on being able to run on the CPU that we first ran on. */ #pragma D option bufpolicy=ring -#pragma D option bufsize=40 +#pragma D option bufsize=80 #pragma D option quiet int n; diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cg/err.D_NOREG.noreg.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cg/err.D_NOREG.noreg.d new file mode 100644 index 0000000..636e568 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cg/err.D_NOREG.noreg.d @@ -0,0 +1,41 @@ +/* + * 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. + */ + +/* + * Compile some code that requires exactly 9 registers. This should run out + * of registers. + * + * Changes to the code generator might cause this test to succeeed in which + * case the code should be changed to another sequence that exhausts the + * available internal registers. + * + * Note that this and err.baddif.d should be kept in sync. + */ + +BEGIN +{ + a = 4; + trace((a + a) * ((a + a) * ((a + a) * ((a + a) * ((a + a) * + ((a + a) * (a + a))))))); +} + +BEGIN +{ + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cg/err.baddif.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cg/err.baddif.d new file mode 100644 index 0000000..d849348 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/cg/err.baddif.d @@ -0,0 +1,44 @@ +/* + * 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. + */ + +/* + * Compile some code that requires exactly 9 registers. This should generate + * invalid DIF because the kernel will flag the fact that we're using more + * registers than are available internally. + * + * Changes to the code generator might cause this test to succeeed in which + * case the code should be changed to another sequence that exhausts the + * available internal registers. + * + * Note that this and err.D_NOREG.noreg.d should be kept in sync. + */ + +#pragma D option iregs=9 + +BEGIN +{ + a = 4; + trace((a + a) * ((a + a) * ((a + a) * ((a + a) * ((a + a) * + ((a + a) * (a + a))))))); +} + +BEGIN +{ + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh index 35f0391..25ae061 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.newprobes.ksh @@ -24,7 +24,9 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" + +# +# Copyright (c) 2012 by Delphix. All rights reserved. # if [ $# != 1 ]; then @@ -49,13 +51,13 @@ tick-1s tick-1s /(i % 2) == 0/ { - system("dtrace -c date -ln 'pid\$target::main:entry' >/dev/null"); + system("dtrace -c date -n 'pid\$target::main:entry' >/dev/null"); } tick-1s /(i % 2) == 1/ { - system("dtrace -c date -ln 'pid\$target::main:return' >/dev/null"); + system("dtrace -c date -n 'pid\$target::main:return' >/dev/null"); } EOF diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast1.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast1.d new file mode 100644 index 0000000..0567123 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast1.d @@ -0,0 +1,28 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +BEGIN +{ + *((int *)alloca(4)) = 1; +} + +BEGIN +{ + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast2.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast2.d new file mode 100644 index 0000000..6282e7a --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pointers/tst.assigncast2.d @@ -0,0 +1,29 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +BEGIN +{ + this->a = alloca(4); + *((int *)this->a) = 1; +} + +BEGIN +{ + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh new file mode 100644 index 0000000..9a0aed0 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal.ksh @@ -0,0 +1,106 @@ +#!/bin/ksh -p +# +# 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. +# + +############################################################################ +# ASSERTION: +# temporal option causes output to be sorted +# +# SECTION: Pragma +# +# NOTES: The temporal option has no effect on a single-CPU system, so +# this needs to be run on a multi-CPU system to effectively test the +# temporal option. +# +############################################################################ + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +file=/tmp/out.$$ + +rm -f $file + +$dtrace -o $file -c 'sleep 3' -s /dev/stdin <<EOF + #pragma D option quiet + #pragma D option temporal + + BEGIN + { + @lines = count(); + printf("0 begin\n"); + } + + END + { + /* Bump @lines every time we print a line. */ + @lines = count(); + printf("%u end\n", timestamp); + @lines = count(); + printa("99999999999999999 lines %@u\n", @lines); + } + + profile-97hz + { + @lines = count(); + printf("%u\n", timestamp); + } +EOF + +status=$? +if [ "$status" -ne 0 ]; then + echo $tst: dtrace failed + exit $status +fi + +# dtrace outputs a blank line at the end, which will sort to the beginning, +# so use head to remove the blank line. +head -n -1 $file > $file.2 + +sort -n $file.2 | diff $file.2 - +status=$? +if [ "$status" -ne 0 ]; then + echo $tst: output is not sorted + exit $status +fi + +head -n 1 $file.2 | grep begin >/dev/null +status=$? +if [ "$status" -ne 0 ]; then + echo $tst: begin probe did not fire + exit $status +fi + +tail -n 2 $file.2 | grep end >/dev/null +status=$? +if [ "$status" -ne 0 ]; then + echo $tst: end probe did not fire + exit $status +fi + +if [ $(tail -n 1 $file.2 | cut -f3 -d ' ') -ne \ + $(wc -l $file.2) ]; then + echo $tst: incorrect number of lines output + exit 1 +fi + +exit $status diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh new file mode 100644 index 0000000..4e8d592 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal2.ksh @@ -0,0 +1,102 @@ +#!/bin/ksh -p +# +# 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. +# + +############################################################################ +# ASSERTION: +# temporal option causes output to be sorted, even when some +# buffers are empty +# +# SECTION: Pragma +# +# NOTES: The temporal option has no effect on a single-CPU system, so +# this needs to be run on a multi-CPU system to effectively test the +# temporal option. +# +############################################################################ + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 +file=/tmp/out.$$ + +rm -f $file + +$dtrace -o $file -s /dev/stdin <<EOF + #pragma D option quiet + #pragma D option destructive + #pragma D option temporal + #pragma D option switchrate=1000hz + + /* + * Use two enablings of the same probe, so that cpu 0 will always + * record its data just a little bit before the other cpus. + * We don't want to use the chill() action in the same enabling + * that we record the timestamp, because chill() causes the + * timestamp to be re-read, and thus not match the timestamp + * which libdtrace uses to sort the records. + */ + + profile-401 + /cpu == 0/ + { + printf("%d\n", timestamp); + } + + profile-401 + /cpu != 0/ + { + chill(1000); /* one microsecond */ + } + + profile-401 + /cpu != 0/ + { + printf("%d\n", timestamp); + } + + tick-1s + /k++ == 10/ + { + printf("%d\n", timestamp); + exit(0); + } +EOF + +status=$? +if [ "$status" -ne 0 ]; then + echo $tst: dtrace failed + exit $status +fi + +# dtrace outputs a blank line at the end, which will sort to the beginning, +# so use grep to remove the blank line. +head -n -1 $file > $file.2 + +sort -n $file.2 | diff $file.2 - +status=$? +if [ "$status" -ne 0 ]; then + echo $tst: output is not sorted + exit $status +fi + +exit $status diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d new file mode 100644 index 0000000..b4c0e55 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pragma/tst.temporal3.d @@ -0,0 +1,48 @@ +/* + * 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. + */ + +/* + * This test excercises the "remnant" handling of the temporal option. + * At the end of one pass of retrieving and printing data from all CPUs, + * some unprocessed data will remain, because its timestamp is after the + * time covered by all CPUs' buffers. This unprocessed data is + * rearranged in a more space-efficient manner. If this is done + * incorrectly, an alignment error may occur. To test this, we use a + * high-frequency probe so that data will be recorded in subsequent + * CPU's buffers after the first CPU's buffer is obtained. The + * combination of data traced here (a 8-byte value and a 4-byte value) + * is effective to cause alignment problems with an incorrect + * implementation. + * + * This test needs to be run on a multi-CPU system to be effective. + */ + +#pragma D option quiet +#pragma D option temporal + +profile-4997 +{ + printf("%u %u", 1ULL, 2); +} + +tick-1 +/i++ == 10/ +{ + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh deleted file mode 100644 index f06edcb..0000000 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/predicates/tst.predcache.ksh +++ /dev/null @@ -1,197 +0,0 @@ -# -# 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" - -unload() -{ - # - # Get the list of services whose processes have USDT probes. Ideally - # it would be possible to unload the fasttrap provider while USDT - # probes exist -- once that fix is integrated, this hack can go away - # We create two lists -- one of regular SMF services and one of legacy - # services -- since each must be enabled and disabled using a specific - # mechanism. - # - pids=$(dtrace -l | \ - perl -ne 'print "$1\n" if (/^\s*\S+\s+\S*\D(\d+)\s+/);' | \ - sort | uniq | tr '\n' ',') - - ctids=$(ps -p $pids -o ctid | tail +2 | sort | uniq) - svcs= - lrcs= - - for ct in $ctids - do - line=$(svcs -o fmri,ctid | grep " $ct\$") - svc=$(echo $line | cut -d' ' -f1) - - if [[ $(svcs -Ho STA $svc) == "LRC" ]]; then - lrc=$(svcs -Ho SVC $svc | tr _ '?') - lrcs="$lrcs $lrc" - else - svcs="$svcs $svc" - fi - done - - for svc in $svcs - do - svcadm disable -ts $svc - done - - for lrc in $lrcs - do - # - # Does it seem a little paternalistic that lsvcrun requires - # this environment variable to be set? I'd say so... - # - SMF_RESTARTER=svc:/system/svc/restarter:default \ - /lib/svc/bin/lsvcrun $lrc stop - done - - modunload -i 0 - modunload -i 0 - modunload -i 0 - modinfo | grep dtrace - success=$? - - for svc in $svcs - do - svcadm enable -ts $svc - done - - for lrc in $lrcs - do - SMF_RESTARTER=svc:/system/svc/restarter:default \ - /lib/svc/bin/lsvcrun $lrc start - done - - if [ ! $success ]; then - echo $tst: could not unload dtrace - exit 1 - fi -} - -script1() -{ - $dtrace -s /dev/stdin <<EOF - syscall:::entry - /pid != $ppid/ - { - @a[probefunc] = count(); - } - - tick-1sec - /i++ == 5/ - { - exit(0); - } -EOF -} - -script2() -{ - $dtrace -s /dev/stdin <<EOF - - #pragma D option statusrate=1ms - - syscall:::entry - /pid == $ppid/ - { - ttl++; - } - - tick-1sec - /i++ == 5/ - { - exit(2); - } - - END - /ttl/ - { - printf("success; ttl is %d", ttl); - exit(0); - } - - END - /ttl == 0/ - { - printf("error -- total should be non-zero"); - exit(1); - } -EOF -} - -if [ $# != 1 ]; then - echo expected one argument: '<'dtrace-path'>' - exit 2 -fi - -ppid=$$ -dtrace=$1 - -unload -script1 & -child=$! - -let waited=0 - -while [ "$waited" -lt 5 ]; do - seconds=`date +%S` - - if [ "$seconds" -ne "$last" ]; then - last=$seconds - let waited=waited+1 - fi -done - -wait $child -status=$? - -if [ "$status" -ne 0 ]; then - echo $tst: first dtrace failed - exit $status -fi - -unload -script2 & -child=$! - -let waited=0 - -while [ "$waited" -lt 10 ]; do - seconds=`date +%S` - - if [ "$seconds" -ne "$last" ]; then - last=$seconds - let waited=waited+1 - fi -done - -wait $child -status=$? - -exit $status diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d deleted file mode 100644 index 892b445..0000000 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/err.D_PRINT_DYN.bad.d +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 (c) 2011 by Delphix. All rights reserved. - */ - -BEGIN -{ - print(*curpsinfo); -} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.dyn.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.dyn.d new file mode 100644 index 0000000..f17551f --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.dyn.d @@ -0,0 +1,28 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +BEGIN +{ + print(*curpsinfo); +} + +BEGIN +{ + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d new file mode 100644 index 0000000..e8125d4 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#pragma D option quiet + +typedef struct pancakes { + int i; + string s; + timespec_t t; +} pancakes_t; + +translator pancakes_t < void *V > { + i = 2 * 10; + s = strjoin("I like ", "pancakes"); + t = *(timespec_t *)`dtrace_zero; +}; + +BEGIN +{ + print(*(xlate < pancakes_t * > ((void *)NULL))); +} + +BEGIN +{ + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out new file mode 100644 index 0000000..9b01402 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/tst.xlate.d.out @@ -0,0 +1,8 @@ +pancakes_t { + int i = 0x14 + string s = [ "I like pancakes" ] + timespec_t t = { + time_t tv_sec = 0 + long tv_nsec = 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 index 4d2bb11..bc7eaed 100644 --- 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 @@ -1,6 +1,6 @@ -239 -52719 +-17 +-12817 -1867788817 1311768467294899695 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 0000000..64e565e --- /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 0000000..169ac59 --- /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/speculation/err.BufSizeVariations1.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d index e97506e..c59ea3b 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/err.BufSizeVariations1.d @@ -24,7 +24,10 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + /* * ASSERTION: @@ -35,17 +38,10 @@ * * NOTES: This test behaves differently depending on the values * assigned to bufsize. - * 1. 0 > bufsize. - * 2. 0 == bufsize. - * 3. 0 < bufsize <= 7 - * 4. 8 <= bufsize <= 31 - * 5. 32 <= bufsize <= 47 - * 6. 48 <= bufsize <= 71 - * 7. 72 <= bufsize */ #pragma D option quiet -#pragma D option bufsize=41 +#pragma D option bufsize=49 BEGIN { diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d index 6b91efd..99539f9 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.SpecSizeVariations3.d @@ -24,7 +24,10 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + /* * ASSERTION: * Verify the behavior of speculations with changes in specsize. @@ -35,7 +38,7 @@ */ #pragma D option quiet -#pragma D option specsize=40 +#pragma D option specsize=48 BEGIN { diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/tst.dyn.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/tst.dyn.d new file mode 100644 index 0000000..24ad80f --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/trace/tst.dyn.d @@ -0,0 +1,28 @@ +/* + * CDDL HEADER START + * + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + * + * CDDL HEADER END + */ + +/* + * Copyright (c) 2012 by Delphix. All rights reserved. + */ + +BEGIN +{ + trace(*curpsinfo); +} + +BEGIN +{ + exit(0); +} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d deleted file mode 100644 index c664188..0000000 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/man.TestTransStability.d +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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: - * The D inline translation mechanism can be used to facilitate stable - * translations. - * - * SECTION: Translators/ Translator Declarations - * SECTION: Translators/ Translate Operator - * SECTION: Translators/Stable Translations - * - * NOTES: Uncomment the pragma that explicitly resets the attributes of - * myinfo identifier to Stable/Stable/Common from Private/Private/Unknown. - * Run the program with and without the comments as: - * /usr/sbin/dtrace -vs man.TestTransStability.d - */ - -#pragma D option quiet - -inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread); - -/* -#pragma D attributes Stable/Stable/Common myinfo -*/ - -BEGIN -{ - trace(myinfo->pr_flag); - exit(0); -} - -ERROR -{ - exit(1); -} diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh new file mode 100644 index 0000000..16eeda3 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh @@ -0,0 +1,62 @@ +# +# 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. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +# +# Test the output for stable translations. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +$dtrace -v -s /dev/stdin <<EOF + +#pragma D option quiet + +inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread); + +#pragma D attributes Stable/Stable/Common myinfo + +BEGIN +{ + this->a = myinfo->pr_flag; + exit(0); +} + +BEGIN +{ + exit(1); +} +EOF + +exit $? diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out new file mode 100644 index 0000000..43c1adb --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability1.ksh.out @@ -0,0 +1,14 @@ + +Stability attributes for script /dev/stdin: + + Minimum Probe Description Attributes + Identifier Names: Unstable + Data Semantics: Unstable + Dependency Class: Common + + Minimum Statement Attributes + Identifier Names: Stable + Data Semantics: Stable + Dependency Class: Common + + diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh new file mode 100644 index 0000000..82070cd --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh @@ -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. +# + +# +# Copyright (c) 2012 by Delphix. All rights reserved. +# + +# +# Test the output of unstable translations. +# + +if [ $# != 1 ]; then + echo expected one argument: '<'dtrace-path'>' + exit 2 +fi + +dtrace=$1 + +$dtrace -v -s /dev/stdin <<EOF + +#pragma D option quiet + +inline lwpsinfo_t *myinfo = xlate < lwpsinfo_t *> (curthread); + +BEGIN +{ + this->a = myinfo->pr_flag; + exit(0); +} + +BEGIN +{ + exit(1); +} +EOF + +exit $? diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out new file mode 100644 index 0000000..f4b70f9 --- /dev/null +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/translators/tst.TestTransStability2.ksh.out @@ -0,0 +1,14 @@ + +Stability attributes for script /dev/stdin: + + Minimum Probe Description Attributes + Identifier Names: Unstable + Data Semantics: Unstable + Dependency Class: Common + + Minimum Statement Attributes + Identifier Names: Private + Data Semantics: Private + Dependency Class: Unknown + + |