/*
* 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
* 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"
*/
/**
* Prove that enable() handles multiple programs, recognizing programs
* that are already enabled and programs that were compiled by another
* consumer.
*/
public class TestEnable {
static void
{
}
public static void
{
try {
try {
"enabled (p0, p1)");
exit(1);
} catch (IllegalStateException e) {
} catch (Exception e) {
e.printStackTrace();
exit(1);
}
try {
"already enabled (p0, p1)");
exit(1);
} catch (IllegalStateException e) {
} catch (Exception e) {
e.printStackTrace();
exit(1);
}
try {
"has already been enabled (p0)");
exit(1);
} catch (IllegalStateException e) {
} catch (Exception e) {
e.printStackTrace();
exit(1);
}
try {
"enabled (p0, p1, p2)");
exit(1);
} catch (IllegalStateException e) {
} catch (Exception e) {
e.printStackTrace();
exit(1);
}
try {
"already enabled (p0, p1, p2)");
exit(1);
} catch (IllegalStateException e) {
} catch (Exception e) {
e.printStackTrace();
exit(1);
}
// Try to fool the consumer with a program compiled by
// another consumer
try {
"by another consumer");
exit(1);
} catch (IllegalArgumentException e) {
} catch (Exception e) {
e.printStackTrace();
exit(1);
} finally {
}
// Enable all compiled programs at once
consumer = new LocalConsumer();
exit(0);
} catch (DTraceException e) {
e.printStackTrace();
exit(1);
}
}
}