I almost always have to adjust the rerun script generated by jtreg. Apart from converting double back slashes to singe back slashes (CODETOOLS-7903537), it doesn't seem to handle tests that use the WhiteBox test library. For these tests, I always get:
java.lang.UnsatisfiedLinkError: 'void jdk.test.whitebox.WhiteBox.registerNatives()'
at jdk.test.whitebox.WhiteBox.registerNatives(Native Method)
at jdk.test.whitebox.WhiteBox.<clinit>(WhiteBox.java:67)
at compiler.cha.Utils.<clinit>(Utils.java:49)
at compiler.cha.StrengthReduceInterfaceCall.main(StrengthReduceInterfaceCall.java:61)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1570)
The problem is that these lib classes need to be on the bootclasspath and when initialially being run, these classes are directly in the scratch directory. The first step of the =the rerun script is to cd into this directory and then it configures bootclasspath with "-Xbootclasspath/a:." but when it comes to re-run time, these classes have been saved somewhere else.
For example, with the compiler/cha/StrengthReduceInterfaceCall.java test, I see:
> find build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java | grep WhiteBox.class
build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java/extraPropDefns/bootClasses/jdk/test/whitebox/WhiteBox.class
build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java/classes/0/test/lib/jdk/test/whitebox/WhiteBox.class
build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java/classes/0/compiler/cha/StrengthReduceInterfaceCall.d/jdk/test/whitebox/WhiteBox.class
build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java/compiler/cha/StrengthReduceInterfaceCall/jdk/test/whitebox/WhiteBox.class
If I adjust the rerun script to add one of these directories to the -Xbootclasspath argument, it works. It seems like the rerun script could do this automatically.
java.lang.UnsatisfiedLinkError: 'void jdk.test.whitebox.WhiteBox.registerNatives()'
at jdk.test.whitebox.WhiteBox.registerNatives(Native Method)
at jdk.test.whitebox.WhiteBox.<clinit>(WhiteBox.java:67)
at compiler.cha.Utils.<clinit>(Utils.java:49)
at compiler.cha.StrengthReduceInterfaceCall.main(StrengthReduceInterfaceCall.java:61)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1570)
The problem is that these lib classes need to be on the bootclasspath and when initialially being run, these classes are directly in the scratch directory. The first step of the =the rerun script is to cd into this directory and then it configures bootclasspath with "-Xbootclasspath/a:." but when it comes to re-run time, these classes have been saved somewhere else.
For example, with the compiler/cha/StrengthReduceInterfaceCall.java test, I see:
> find build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java | grep WhiteBox.class
build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java/extraPropDefns/bootClasses/jdk/test/whitebox/WhiteBox.class
build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java/classes/0/test/lib/jdk/test/whitebox/WhiteBox.class
build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java/classes/0/compiler/cha/StrengthReduceInterfaceCall.d/jdk/test/whitebox/WhiteBox.class
build/macosx-aarch64-debug/test-support/jtreg_open_test_hotspot_jtreg_compiler_cha_StrengthReduceInterfaceCall_java/compiler/cha/StrengthReduceInterfaceCall/jdk/test/whitebox/WhiteBox.class
If I adjust the rerun script to add one of these directories to the -Xbootclasspath argument, it works. It seems like the rerun script could do this automatically.