1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 /* 28 * ASSERTION: 29 * Signed integer keys print and sort as expected. 30 * 31 * SECTION: Aggregations, Printing Aggregations 32 * 33 * NOTES: DTrace sorts integer keys as unsigned values, yet prints 32- 34 * and 64-bit integers as signed values. Since the Java DTrace API is 35 * expected to emulate this behavior, this test was added to ensure that 36 * the behavior is preserved. Consistency with trace() output is also 37 * tested. 38 */ 39 40 #pragma D option quiet 41 #pragma D option aggsortkey 42 43 BEGIN 44 { 45 trace((char)-2); 46 trace("\n"); 47 trace((char)-1); 48 trace("\n"); 49 trace((char)0); 50 trace("\n"); 51 trace((char)1); 52 trace("\n"); 53 trace((char)2); 54 trace("\n"); 55 trace("\n"); 56 57 trace((short)-2); 58 trace("\n"); 59 trace((short)-1); 60 trace("\n"); 61 trace((short)0); 62 trace("\n"); 63 trace((short)1); 64 trace("\n"); 65 trace((short)2); 66 trace("\n"); 67 trace("\n"); 68 69 trace(-2); 70 trace("\n"); 71 trace(-1); 72 trace("\n"); 73 trace(0); 74 trace("\n"); 75 trace(1); 76 trace("\n"); 77 trace(2); 78 trace("\n"); 79 trace("\n"); 80 81 trace((long long)-2); 82 trace("\n"); 83 trace((long long)-1); 84 trace("\n"); 85 trace((long long)0); 86 trace("\n"); 87 trace((long long)1); 88 trace("\n"); 89 trace((long long)2); 90 trace("\n"); 91 92 @i8[(char)-2] = sum(-2); 93 @i8[(char)-1] = sum(-1); 94 @i8[(char)0] = sum(0); 95 @i8[(char)1] = sum(1); 96 @i8[(char)2] = sum(2); 97 98 @i16[(short)-2] = sum(-2); 99 @i16[(short)-1] = sum(-1); 100 @i16[(short)0] = sum(0); 101 @i16[(short)1] = sum(1); 102 @i16[(short)2] = sum(2); 103 104 @i32[-2] = sum(-2); 105 @i32[-1] = sum(-1); 106 @i32[0] = sum(0); 107 @i32[1] = sum(1); 108 @i32[2] = sum(2); 109 110 @i64[(long long)-2] = sum(-2); 111 @i64[(long long)-1] = sum(-1); 112 @i64[(long long)0] = sum(0); 113 @i64[(long long)1] = sum(1); 114 @i64[(long long)2] = sum(2); 115 116 exit(0); 117 } 118