RFR: 8317965: TestLoadLibraryDeadlock.java fails with "Unable to load native library.: expected true, was false" [v2]
Mandy Chung
mchung at openjdk.org
Wed Nov 1 19:46:33 UTC 2023
On Wed, 1 Nov 2023 19:15:15 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>> test/jdk/java/lang/ClassLoader/loadLibraryDeadlock/TestLoadLibraryDeadlock.java line 115:
>>
>>> 113: Collections.addAll(commands, java);
>>> 114: Collections.addAll(commands, Utils.getTestJavaOpts());
>>> 115: Collections.addAll(commands, command);
>>
>> The prose description talks about using ProcessTools, but the runCommand code doesn't use ProcessTools.createTestJavaProcessBuilder. It could save a few steps.
>
> `runCommand` sets the working directory whereas `ProcessTools.createTestJavaProcessBuilder` does not. Either way is okay with me if we want to use `createTestJavaProcessBuilder` (which will set the VM options).
>
>
> + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-cp",
> + "a.jar" + classPathSeparator +
> + "b.jar" + classPathSeparator +
> + "c.jar",
> + "-Djava.library.path=" + testLibraryPath,
> + "LoadLibraryDeadlock")
> + .directory(new File(testClassPath));
> + OutputAnalyzer outputAnalyzer = ProcessTools.executeCommand(pb)
> + .shouldHaveExitValue(0);
>
>
> or set the class path to the explicit path of the JAR files.
Updated to use `createTestJavaProcessBuilder` and more clean up.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16459#discussion_r1379231980
More information about the core-libs-dev
mailing list