changeset 3350:6747331f9e3f

6505802 test suite failure: tst.Bean.ksh 6505806 test suite failure: tst.MultiAggPrinta.ksh 6506495 -DJAVA_DTRACE_MAX_CONSUMERS=N for any N < 8 is treated as if it were 8
author tomee
date Tue, 02 Jan 2007 19:16:46 -0800
parents 52a149909ce5
children 853fb8df244a
files usr/src/cmd/dtrace/test/pkg/SUNWdtrt/prototype_com usr/src/cmd/dtrace/test/tst/common/java_api/src/TestMaxConsumers.java usr/src/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh usr/src/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh.out usr/src/lib/libdtrace_jni/common/dtj_consume.c usr/src/lib/libdtrace_jni/common/dtrace_jni.c usr/src/lib/libdtrace_jni/java/src/org/opensolaris/os/dtrace/Aggregation.java usr/src/lib/libdtrace_jni/java/src/org/opensolaris/os/dtrace/ProbeDescription.java
diffstat 8 files changed, 183 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/dtrace/test/pkg/SUNWdtrt/prototype_com	Tue Jan 02 16:27:54 2007 -0800
+++ b/usr/src/cmd/dtrace/test/pkg/SUNWdtrt/prototype_com	Tue Jan 02 19:16:46 2007 -0800
@@ -20,7 +20,7 @@
 #
 
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -1391,3 +1391,5 @@
 f none opt/SUNWdtrt/tst/common/java_api/tst.StateMachine.ksh.out 0444 root bin
 f none opt/SUNWdtrt/tst/common/java_api/tst.Enable.ksh 0444 root bin
 f none opt/SUNWdtrt/tst/common/java_api/tst.Enable.ksh.out 0444 root bin
+f none opt/SUNWdtrt/tst/common/java_api/tst.MaxConsumers.ksh 0444 root bin
+f none opt/SUNWdtrt/tst/common/java_api/tst.MaxConsumers.ksh.out 0444 root bin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/java_api/src/TestMaxConsumers.java	Tue Jan 02 19:16:46 2007 -0800
@@ -0,0 +1,97 @@
+/*
+ * 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"
+ */
+
+import org.opensolaris.os.dtrace.*;
+
+/**
+ * Regression for 6506495 -DJAVA_DTRACE_MAX_CONSUMERS=N for any N &lt; 8
+ * is treated as if it were 8.
+ */
+public class TestMaxConsumers {
+    static final String MAX_CONSUMERS_PROPERTY_NAME =
+	    "JAVA_DTRACE_MAX_CONSUMERS";
+
+    static Integer
+    getIntegerProperty(String name)
+    {
+	Integer value = null;
+	String property = System.getProperty(name);
+	if (property != null && property.length() != 0) {
+	    try {
+		value = Integer.parseInt(property);
+	    } catch (NumberFormatException e) {
+		e.printStackTrace();
+	    }
+	}
+	return value;
+    }
+
+    public static void
+    main(String[] args)
+    {
+	Integer property = getIntegerProperty(MAX_CONSUMERS_PROPERTY_NAME);
+	int max = (property == null ? 0 : property);
+	int n = (property == null ? 11 : (max < 1 ? 1 : max));
+
+	Consumer[] consumers = new Consumer[n];
+	try {
+	    for (int i = 0; i < n; ++i) {
+		consumers[i] = new LocalConsumer();
+		consumers[i].open();
+	    }
+	    for (int i = 0; i < n; ++i) {
+		consumers[i].close();
+	    }
+	    for (int i = 0; i < n; ++i) {
+		consumers[i] = new LocalConsumer();
+		consumers[i].open();
+	    }
+	} catch (Exception e) {
+	    e.printStackTrace();
+	    System.exit(1);
+	}
+
+	try {
+	    Consumer consumer = new LocalConsumer();
+	    consumer.open();
+	    if (max > 0) {
+		System.out.println("Error: " + (max + 1) + " > " +
+			MAX_CONSUMERS_PROPERTY_NAME);
+	    } else {
+		System.out.println("Success");
+	    }
+	    consumer.close();
+	} catch (Exception e) {
+	    System.out.println("Success");
+	} finally {
+	    for (int i = 0; i < n; ++i) {
+		consumers[i].close();
+	    }
+	}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh	Tue Jan 02 19:16:46 2007 -0800
@@ -0,0 +1,54 @@
+#!/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"
+
+############################################################################
+# ASSERTION:
+#	Fixed bug 6506495 -DJAVA_DTRACE_MAX_CONSUMERS=N for any N < 8 is
+#	treated as if it were 8.
+#
+# SECTION: Java API
+#
+############################################################################
+
+FLAGS=""
+ARCH=`bitarch.exe`
+
+if [ $ARCH == "64" ]; then
+	FLAGS="-d64"
+fi
+
+java $FLAGS -cp test.jar TestMaxConsumers
+java $FLAGS -DJAVA_DTRACE_MAX_CONSUMERS=-1 -cp test.jar TestMaxConsumers
+java $FLAGS -DJAVA_DTRACE_MAX_CONSUMERS=0 -cp test.jar TestMaxConsumers
+java $FLAGS -DJAVA_DTRACE_MAX_CONSUMERS=1 -cp test.jar TestMaxConsumers
+java $FLAGS -DJAVA_DTRACE_MAX_CONSUMERS=2 -cp test.jar TestMaxConsumers
+java $FLAGS -DJAVA_DTRACE_MAX_CONSUMERS=7 -cp test.jar TestMaxConsumers
+java $FLAGS -DJAVA_DTRACE_MAX_CONSUMERS=8 -cp test.jar TestMaxConsumers
+java $FLAGS -DJAVA_DTRACE_MAX_CONSUMERS=9 -cp test.jar TestMaxConsumers
+java $FLAGS -DJAVA_DTRACE_MAX_CONSUMERS=19 -cp test.jar TestMaxConsumers
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/cmd/dtrace/test/tst/common/java_api/tst.MaxConsumers.ksh.out	Tue Jan 02 19:16:46 2007 -0800
@@ -0,0 +1,17 @@
+Success
+JAVA_DTRACE_MAX_CONSUMERS=-1
+Success
+JAVA_DTRACE_MAX_CONSUMERS=0
+Success
+JAVA_DTRACE_MAX_CONSUMERS=1
+Success
+JAVA_DTRACE_MAX_CONSUMERS=2
+Success
+JAVA_DTRACE_MAX_CONSUMERS=7
+Success
+JAVA_DTRACE_MAX_CONSUMERS=8
+Success
+JAVA_DTRACE_MAX_CONSUMERS=9
+Success
+JAVA_DTRACE_MAX_CONSUMERS=19
+Success
--- a/usr/src/lib/libdtrace_jni/common/dtj_consume.c	Tue Jan 02 16:27:54 2007 -0800
+++ b/usr/src/lib/libdtrace_jni/common/dtj_consume.c	Tue Jan 02 19:16:46 2007 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -1784,6 +1784,7 @@
 		if (jc->dtjj_tuple == NULL) {
 			(*jenv)->CallVoidMethod(jenv, jc->dtjj_probedata,
 			    g_pdatainvalidate_printa_jm);
+			goto printa_output;
 		}
 
 		tuple_member_count = (*jenv)->CallIntMethod(jenv,
@@ -1794,9 +1795,6 @@
 			    g_pdatainvalidate_printa_jm);
 			(*jenv)->DeleteLocalRef(jenv, jc->dtjj_tuple);
 			jc->dtjj_tuple = NULL;
-		}
-
-		if (jc->dtjj_tuple == NULL) {
 			goto printa_output;
 		}
 
--- a/usr/src/lib/libdtrace_jni/common/dtrace_jni.c	Tue Jan 02 16:27:54 2007 -0800
+++ b/usr/src/lib/libdtrace_jni/common/dtrace_jni.c	Tue Jan 02 19:16:46 2007 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -231,17 +231,15 @@
 		bzero(g_consumer_table, (INITIAL_CAPACITY *
 		    sizeof (dtj_consumer_t *)));
 		g_consumer_capacity = INITIAL_CAPACITY;
+	} else if ((g_max_consumers > 0) && (g_consumer_count >=
+	    g_max_consumers)) {
+		dtj_throw_resource_limit(jenv, "Too many consumers");
+		(void) pthread_mutex_unlock(&g_table_lock);
+		return (B_FALSE);
 	} else if (g_consumer_count >= g_consumer_capacity) {
 		dtj_consumer_t **t;
 		size_t new_capacity;
 
-		if ((g_max_consumers > 0) && (g_consumer_count >=
-		    g_max_consumers)) {
-			dtj_throw_resource_limit(jenv, "Too many consumers");
-			(void) pthread_mutex_unlock(&g_table_lock);
-			return (B_FALSE);
-		}
-
 		if (g_consumer_capacity <= g_max_capacity_increment) {
 			new_capacity = (g_consumer_capacity * 2);
 		} else {
--- a/usr/src/lib/libdtrace_jni/java/src/org/opensolaris/os/dtrace/Aggregation.java	Tue Jan 02 16:27:54 2007 -0800
+++ b/usr/src/lib/libdtrace_jni/java/src/org/opensolaris/os/dtrace/Aggregation.java	Tue Jan 02 19:16:46 2007 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * ident	"%Z%%M%	%I%	%E% SMI"
@@ -79,7 +79,7 @@
 	    BeanInfo info = Introspector.getBeanInfo(Aggregation.class);
 	    PersistenceDelegate persistenceDelegate =
 		    new DefaultPersistenceDelegate(
-		    new String[] {"name", "id", "records"})
+		    new String[] {"name", "ID", "records"})
 	    {
 		@Override
 		protected boolean
--- a/usr/src/lib/libdtrace_jni/java/src/org/opensolaris/os/dtrace/ProbeDescription.java	Tue Jan 02 16:27:54 2007 -0800
+++ b/usr/src/lib/libdtrace_jni/java/src/org/opensolaris/os/dtrace/ProbeDescription.java	Tue Jan 02 19:16:46 2007 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * ident	"%Z%%M%	%I%	%E% SMI"
@@ -88,7 +88,7 @@
 	    BeanInfo info = Introspector.getBeanInfo(ProbeDescription.class);
 	    PersistenceDelegate persistenceDelegate =
 		    new DefaultPersistenceDelegate(
-		    new String[] {"id", "provider", "module",
+		    new String[] {"ID", "provider", "module",
 		    "function", "name"});
 	    BeanDescriptor d = info.getBeanDescriptor();
 	    d.setValue("persistenceDelegate", persistenceDelegate);