RFR: 8353190: Use "/native" Run Option for TestAvailableProcessors Execution [v2]

Oleksii Sylichenko duke at openjdk.org
Tue Apr 22 19:51:25 UTC 2025


On Mon, 31 Mar 2025 12:08:07 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> test/hotspot/jtreg/runtime/os/windows/TestAvailableProcessors.java line 171:
>> 
>>> 169:     @Test
>>> 170:     private static void testProcessorAvailability() throws IOException {
>>> 171:         // Launch "<nativepath>/GetProcessorInfo.exe" to gather processor counts
>> 
>> How does this launch the executable in the way you describe? I am not aware that the `native` directive puts the `<nativepath>` directory into the PATH. From what I can see from an existing jtr file the PATH used for executing the test is unchanged.  ??
>
> I discovered that the PATH is only updated when `othervm` and `native` appear together.

The `TestNGAction` class inherits from the `MainAction` class.

The run method of `MainAction` checks for the othervm option:


case OTHERVM:
    showMode(ExecMode.OTHERVM, othervmOverrideReasons);
    status = runOtherJVM();
    break;


https://github.com/openjdk/jtreg/blob/19cdb8404930c3025bd48436907ccc65bd133fee/src/share/classes/com/sun/javatest/regtest/exec/MainAction.java#L350

The method `MainAction.runOtherJVM()` includes the following line:


env.putAll(getEnvVars(nativeCode));


https://github.com/openjdk/jtreg/blob/19cdb8404930c3025bd48436907ccc65bd133fee/src/share/classes/com/sun/javatest/regtest/exec/MainAction.java#L415C9-L415C44

The method `Action.getEnvVars(nativeCode)` modifies the environment variables:


String libPath = envVars.get(libPathName);
if (libPath == null) {
    envVars.put(libPathName, nativeDir.toString());
} else {
    envVars.put(libPathName, libPath + File.pathSeparator + nativeDir);
}


https://github.com/openjdk/jtreg/blob/19cdb8404930c3025bd48436907ccc65bd133fee/src/share/classes/com/sun/javatest/regtest/exec/Action.java#L158

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23803#discussion_r2054751073


More information about the hotspot-runtime-dev mailing list