mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-16 05:15:22 +00:00
7035555: 4/4 attach/BasicTests.sh needs another tweak for Cygwin
Test needs to properly detect missing AgentInitializationException. Clarify when exceptions are expected. Another Cygwin tweak. Reviewed-by: dsamersoff, ohair
This commit is contained in:
parent
31a03639b0
commit
3d4a927981
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -40,7 +40,8 @@ rm -f ${OUTPUTFILE}
|
||||
|
||||
startApplication()
|
||||
{
|
||||
${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} &
|
||||
# put all output from the app into ${OUTPUTFILE}
|
||||
${JAVA} $1 $2 $3 -jar "${TESTCLASSES}"/Application.jar > ${OUTPUTFILE} 2>&1 &
|
||||
pid="$!"
|
||||
|
||||
# MKS creates an intermediate shell to launch ${JAVA} so
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -75,14 +75,23 @@ public class BasicTests {
|
||||
|
||||
// Test 3 - load an "bad" agent (agentmain throws an exception)
|
||||
System.out.println(" - Test: Load a bad agent");
|
||||
System.out.println("INFO: This test will cause error messages "
|
||||
+ "to appear in the application log about SilverBullet.jar "
|
||||
+ "not being found and an agent failing to start.");
|
||||
try {
|
||||
vm.loadAgent(badagent);
|
||||
throw new RuntimeException(
|
||||
"AgentInitializationException not thrown as expected!");
|
||||
} catch (AgentInitializationException x) {
|
||||
System.out.println(" - AgentInitializationException throws as expected!");
|
||||
System.out.println(
|
||||
" - AgentInitializationException thrown as expected!");
|
||||
}
|
||||
|
||||
// Test 4 - detach from the VM and attempt a load (should throw IOE)
|
||||
System.out.println(" - Test: Detach from VM");
|
||||
System.out.println("INFO: This test will cause error messages "
|
||||
+ "to appear in the application log about a BadAgent including "
|
||||
+ "a RuntimeException and an InvocationTargetException.");
|
||||
vm.detach();
|
||||
try {
|
||||
vm.loadAgent(agent);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,11 +39,9 @@ fi
|
||||
|
||||
# Windows 2000 is a problem here, so we skip it, see 6962615
|
||||
osrev=`uname -a`
|
||||
if [ "`echo ${osrev} | grep 'CYGWIN'`" != "" ] ; then
|
||||
if [ "`echo ${osrev} | grep '5.0'`" != "" ] ; then
|
||||
echo "Treating as a pass, not testing Windows 2000"
|
||||
exit 0
|
||||
fi
|
||||
if [ "`echo ${osrev} | grep 'CYGWIN[^ ]*-5\.0'`" != "" ] ; then
|
||||
echo "Treating as a pass, not testing Windows 2000"
|
||||
exit 0
|
||||
fi
|
||||
if [ "`echo ${osrev} | grep 'Windows'`" != "" ] ; then
|
||||
if [ "`echo ${osrev} | grep '5 00'`" != "" ] ; then
|
||||
@ -58,7 +56,7 @@ fi
|
||||
|
||||
startApplication -Dattach.test=true
|
||||
# pid = process-id, port = shutdown port
|
||||
|
||||
|
||||
failures=0
|
||||
|
||||
echo "Running tests ..."
|
||||
@ -69,6 +67,18 @@ if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
|
||||
|
||||
stopApplication $port
|
||||
|
||||
# Add these info messages to $OUTPUTFILE just in case someone
|
||||
# looks at it and wonders about the failures. We have to do
|
||||
# this after the application is stopped because it is writing
|
||||
# to $OUTPUTFILE.
|
||||
(
|
||||
echo ""
|
||||
echo "INFO: Test 2 will cause error messages about SilverBullet.jar" \
|
||||
"and an agent failing to start."
|
||||
echo "INFO: Test 3 will cause error messages about BadAgent" \
|
||||
"including a RuntimeException and an InvocationTargetException."
|
||||
) >> ${OUTPUTFILE}
|
||||
|
||||
if [ $failures = 0 ];
|
||||
then echo "All tests passed.";
|
||||
else echo "$failures test(s) failed:"; cat ${OUTPUTFILE};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user