Skip to content

Commit 1246736

Browse files
committed
8319578: Few java/lang/instrument ignore test.java.opts and accept test.vm.opts only
Backport-of: 3ebe6c192a5dd5cc46ae2d263713c9ff38cd46bb
1 parent 865442e commit 1246736

14 files changed

+35
-35
lines changed

test/jdk/java/lang/instrument/BootClassPath/BootClassPathTest.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -74,7 +74,7 @@ case ${OS} in
7474
;;
7575
esac
7676

77-
"$JAVA" ${TESTVMOPTS} -classpath "${TESTCLASSES}" Setup "${TESTCLASSES}" Agent "${CYGWIN}"
77+
"$JAVA" ${TESTVMOPTS} ${TESTJAVAOPTS} -classpath "${TESTCLASSES}" Setup "${TESTCLASSES}" Agent "${CYGWIN}"
7878

7979
BOOTDIR=`cat ${TESTCLASSES}/boot.dir`
8080

@@ -94,13 +94,13 @@ echo "Creating agent jar file..."
9494

9595
echo "Running test..."
9696

97-
"${JAVA}" ${TESTVMOPTS} -javaagent:"${TESTCLASSES}"/Agent.jar -classpath "${TESTCLASSES}" DummyMain
97+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} -javaagent:"${TESTCLASSES}"/Agent.jar -classpath "${TESTCLASSES}" DummyMain
9898
result=$?
9999

100100
echo "Cleanup..."
101101

102102
"$JAVAC" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d "${TESTCLASSES}" \
103103
"${TESTSRC}"/Cleanup.java
104-
"$JAVA" ${TESTVMOPTS} -classpath "${TESTCLASSES}" Cleanup "${BOOTDIR}"
104+
"$JAVA" ${TESTVMOPTS} ${TESTJAVAOPTS} -classpath "${TESTCLASSES}" Cleanup "${BOOTDIR}"
105105

106106
exit $result

test/jdk/java/lang/instrument/ManifestTest.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -380,7 +380,7 @@ while read token; do
380380
echo "===== begin test case: $token ====="
381381
make_a_JAR "$token"
382382

383-
"${JAVA}" ${TESTVMOPTS} -javaagent:${AGENT}.jar \
383+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} -javaagent:${AGENT}.jar \
384384
-classpath "${TESTCLASSES}" ManifestTestApp > output.log 2>&1
385385
result=$?
386386

test/jdk/java/lang/instrument/RedefineBigClass.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -62,14 +62,14 @@ JAVAC="${COMPILEJAVA}"/bin/javac
6262
JAVA="${TESTJAVA}"/bin/java
6363

6464
# Does this VM support the 'detail' level of NMT?
65-
"${JAVA}" ${TESTVMOPTS} -XX:NativeMemoryTracking=detail -version
65+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} -XX:NativeMemoryTracking=detail -version
6666
if [ "$?" = 0 ]; then
6767
NMT=-XX:NativeMemoryTracking=detail
6868
else
6969
NMT=-XX:NativeMemoryTracking=summary
7070
fi
7171

72-
"${JAVA}" ${TESTVMOPTS} \
72+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} \
7373
-Xlog:redefine+class+load=debug,redefine+class+load+exceptions=info ${NMT} \
7474
-javaagent:RedefineBigClassAgent.jar=BigClass.class \
7575
-classpath "${TESTCLASSES}" RedefineBigClassApp \

test/jdk/java/lang/instrument/RedefineClassWithNativeMethod.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@ fi
5858
JAVAC="${COMPILEJAVA}"/bin/javac
5959
JAVA="${TESTJAVA}"/bin/java
6060

61-
"${JAVA}" ${TESTVMOPTS} \
61+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} \
6262
-javaagent:RedefineClassWithNativeMethodAgent.jar=java/lang/Thread.class \
6363
-classpath "${TESTCLASSES}" RedefineClassWithNativeMethodApp \
6464
> output.log 2>&1

test/jdk/java/lang/instrument/RedefineMethodAddInvoke.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -70,7 +70,7 @@ cp "${TESTSRC}"/RedefineMethodAddInvokeTarget_2.java \
7070
mv RedefineMethodAddInvokeTarget.java RedefineMethodAddInvokeTarget_2.java
7171
mv RedefineMethodAddInvokeTarget.class RedefineMethodAddInvokeTarget_2.class
7272

73-
"${JAVA}" ${TESTVMOPTS} -javaagent:RedefineMethodAddInvokeAgent.jar \
73+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} -javaagent:RedefineMethodAddInvokeAgent.jar \
7474
-XX:+AllowRedefinitionToAddDeleteMethods \
7575
-classpath "${TESTCLASSES}" RedefineMethodAddInvokeApp > output.log 2>&1
7676
cat output.log

test/jdk/java/lang/instrument/RedefineMethodDelInvoke.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@ cp "${TESTSRC}"/RedefineMethodDelInvokeTarget_2.java \
7171
mv RedefineMethodDelInvokeTarget.java RedefineMethodDelInvokeTarget_2.java
7272
mv RedefineMethodDelInvokeTarget.class RedefineMethodDelInvokeTarget_2.class
7373

74-
"${JAVA}" ${TESTVMOPTS} -javaagent:RedefineMethodDelInvokeAgent.jar \
74+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} -javaagent:RedefineMethodDelInvokeAgent.jar \
7575
-XX:+AllowRedefinitionToAddDeleteMethods \
7676
-classpath "${TESTCLASSES}" RedefineMethodDelInvokeApp > output.log 2>&1
7777

test/jdk/java/lang/instrument/RedefineMethodInBacktrace.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@ cp "${TESTSRC}"/RedefineMethodInBacktraceTargetB_2.java \
6868
RedefineMethodInBacktraceTargetB.java
6969
"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . RedefineMethodInBacktraceTargetB.java
7070

71-
"${JAVA}" ${TESTVMOPTS} -javaagent:RedefineMethodInBacktraceAgent.jar \
71+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} -javaagent:RedefineMethodInBacktraceAgent.jar \
7272
-XX:+AllowRedefinitionToAddDeleteMethods \
7373
-classpath "${TESTCLASSES}" RedefineMethodInBacktraceApp > output.log 2>&1
7474
RUN_RESULT=$?

test/jdk/java/lang/instrument/RedefineMethodWithAnnotations.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,7 @@ cp "${TESTSRC}"/RedefineMethodWithAnnotationsAnnotations.java \
6767
RedefineMethodWithAnnotationsTarget.java \
6868
RedefineMethodWithAnnotationsAnnotations.java
6969

70-
"${JAVA}" ${TESTVMOPTS} -javaagent:RedefineMethodWithAnnotationsAgent.jar \
70+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} -javaagent:RedefineMethodWithAnnotationsAgent.jar \
7171
-XX:+UnlockDiagnosticVMOptions -XX:+StressLdcRewrite -XX:+IgnoreUnrecognizedVMOptions \
7272
-cp "${TESTCLASSES}" RedefineMethodWithAnnotationsApp > output.log 2>&1
7373
cat output.log

test/jdk/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@ cp "${TESTSRC}"/RedefineSubclassWithTwoInterfacesImpl_1.java \
6969
"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
7070
-cp "${TESTCLASSES}" -d . \
7171
RedefineSubclassWithTwoInterfacesTarget.java \
72-
RedefineSubclassWithTwoInterfacesImpl.java
72+
RedefineSubclassWithTwoInterfacesImpl.java
7373
status="$?"
7474
if [ "$status" != 0 ]; then
7575
echo "FAIL: compile of *_1.java files failed."
@@ -87,7 +87,7 @@ mv RedefineSubclassWithTwoInterfacesImpl.class \
8787

8888
echo "INFO: launching RedefineSubclassWithTwoInterfacesApp"
8989

90-
"${JAVA}" ${TESTVMOPTS} \
90+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} \
9191
-Xlog:redefine+class+load=trace,redefine+class+load+exceptions=trace,redefine+class+timer=trace,redefine+class+obsolete=trace,redefine+class+obsolete+metadata=trace,redefine+class+constantpool=trace \
9292
-javaagent:RedefineSubclassWithTwoInterfacesAgent.jar \
9393
-classpath "${TESTCLASSES}" \

test/jdk/java/lang/instrument/RetransformBigClass.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -62,14 +62,14 @@ JAVAC="${COMPILEJAVA}"/bin/javac
6262
JAVA="${TESTJAVA}"/bin/java
6363

6464
# Does this VM support the 'detail' level of NMT?
65-
"${JAVA}" ${TESTVMOPTS} -XX:NativeMemoryTracking=detail -version
65+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} -XX:NativeMemoryTracking=detail -version
6666
if [ "$?" = 0 ]; then
6767
NMT=-XX:NativeMemoryTracking=detail
6868
else
6969
NMT=-XX:NativeMemoryTracking=summary
7070
fi
7171

72-
"${JAVA}" ${TESTVMOPTS} \
72+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} \
7373
-Xlog:redefine+class+load=debug,redefine+class+load+exceptions=info ${NMT} \
7474
-javaagent:RetransformBigClassAgent.jar=BigClass.class \
7575
-classpath "${TESTCLASSES}" RetransformBigClassApp \

test/jdk/java/lang/instrument/StressGetObjectSizeTest.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@ fi
5151

5252
JAVA="${TESTJAVA}"/bin/java
5353

54-
"${JAVA}" ${TESTVMOPTS} -javaagent:basicAgent.jar \
54+
"${JAVA}" ${TESTVMOPTS} ${TESTJAVAOPTS} -javaagent:basicAgent.jar \
5555
-classpath "${TESTCLASSES}" StressGetObjectSizeApp StressGetObjectSizeApp \
5656
> output.log 2>&1
5757
cat output.log

test/jdk/java/lang/instrument/appendToClassLoaderSearch/CircularityErrorTest.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -77,4 +77,4 @@ $JAR ${TESTTOOLVMOPTS} -cfm "${TESTCLASSES}"/CircularityErrorTest.jar "${MANIFES
7777

7878
# Finally we run the test
7979
(cd "${TESTCLASSES}";
80-
$JAVA ${TESTVMOPTS} -javaagent:CircularityErrorTest.jar CircularityErrorTest)
80+
$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} -javaagent:CircularityErrorTest.jar CircularityErrorTest)

test/jdk/java/lang/instrument/appendToClassLoaderSearch/ClassUnloadTest.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -80,5 +80,5 @@ $JAR ${TESTTOOLVMOPTS} -cfm "${TESTCLASSES}"/ClassUnloadTest.jar "${MANIFEST}" \
8080

8181
# Finally we run the test
8282
(cd "${TESTCLASSES}"; \
83-
$JAVA ${TESTVMOPTS} -Xlog:class+unload \
83+
$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} -Xlog:class+unload \
8484
-javaagent:ClassUnloadTest.jar ClassUnloadTest "${OTHERDIR}" Bar.jar)

test/jdk/java/lang/instrument/appendToClassLoaderSearch/run_tests.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
4+
# Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
55
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
66
#
77
# This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,7 @@ failures=0
5656

5757
go() {
5858
echo ''
59-
sh -xc "$JAVA ${TESTVMOPTS} -javaagent:Agent.jar -classpath SimpleTests.jar $1 $2 $3" 2>&1
59+
sh -xc "$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} -javaagent:Agent.jar -classpath SimpleTests.jar $1 $2 $3" 2>&1
6060
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
6161
}
6262

@@ -85,11 +85,11 @@ mv Application.class InstrumentedApplication.bytes
8585
cp "${TESTSRC}"/Application.java .
8686
"${JAVAC}" ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d . Application.java
8787

88-
sh -xc "$JAVA ${TESTVMOPTS} -classpath . -javaagent:Agent.jar DynamicTest" 2>&1
88+
sh -xc "$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} -classpath . -javaagent:Agent.jar DynamicTest" 2>&1
8989
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
9090

9191
# Repeat test with security manager
92-
sh -xc "$JAVA ${TESTVMOPTS} -classpath . -javaagent:Agent.jar -Djava.security.manager DynamicTest" 2>&1
92+
sh -xc "$JAVA ${TESTVMOPTS} ${TESTJAVAOPTS} -classpath . -javaagent:Agent.jar -Djava.security.manager DynamicTest" 2>&1
9393
if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
9494

9595
#

0 commit comments

Comments
 (0)