RFR: 8272600: (test) Use native "sleep" in Basic.java
Ioi Lam
iklam at openjdk.java.net
Tue Aug 24 16:36:28 UTC 2021
On Tue, 24 Aug 2021 15:55:28 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> The intermittent test in java/lang/ProcessBuilder/Basic.java has identified unexpected messages from a child Java VM
> as the cause of the test failure. Attempts to control the output of the child VM have failed, the VM is unrepentant .
>
> There is no functionality in the child except to wait long enough for the test to finish and the child is destroyed.
> The fix is to switch from using a Java child to using a native child; a new executable `sleepmillis`.
test/jdk/java/lang/ProcessBuilder/Basic.java line 30:
> 28: * 6464154 6523983 6206031 4960438 6631352 6631966 6850957 6850958
> 29: * 4947220 7018606 7034570 4244896 5049299 8003488 8054494 8058464
> 30: * 8067796 8224905 8263729 8265173 8272600 8231297
The test should also be modified to use `@run main/othervm/native/timeout=300` so that this test will be flagged by jtreg if `-nativepath:` is not specified.
test/jdk/java/lang/ProcessBuilder/Basic.java line 2635:
> 2633: List<String> childArgs = null;
> 2634: Path sleepExe = TEST_NATIVEPATH.resolve("sleepmillis");
> 2635: if (sleepExe.toFile().canExecute()) {
Why is the fallback necessary? Other test cases such as test/jdk/tools/launcher/JliLaunchTest.java do not have such a fallback.
Also, I noticed that JliLaunchTest does something like this:
Path launcher = Paths.get(System.getProperty("test.nativepath"),
"JliLaunchTest" + (Platform.isWindows() ? ".exe" : ""));
but test/jdk/java/lang/reflect/exeCallerAccessTest/CallerAccessTest.java doesn't add ".exe", so it may not be necessary.
test/jdk/java/lang/ProcessBuilder/exeSleepMillis.c line 45:
> 43: sleeptime.tv_nsec = (millis % 1000) * 1000 * 1000;
> 44: int rc;
> 45: while ((rc = nanosleep(&sleeptime, &sleeptime)) > 0) {
is `nanosleep` a portable call? I couldn't find documentation for it with google search of `nanosleep site:docs.microsoft.com`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5239
More information about the core-libs-dev
mailing list