From 15862a2f116331b7f439619c3aa1b5965e737044 Mon Sep 17 00:00:00 2001 From: Jan Lahoda Date: Mon, 6 May 2024 08:48:46 +0000 Subject: [PATCH] 8331708: jdk/internal/jline/RedirectedStdOut.java times-out on macosx-aarch64 Reviewed-by: asotona --- test/jdk/jdk/internal/jline/RedirectedStdOut.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/jdk/jdk/internal/jline/RedirectedStdOut.java b/test/jdk/jdk/internal/jline/RedirectedStdOut.java index 7cbf913219a..fb614e3d754 100644 --- a/test/jdk/jdk/internal/jline/RedirectedStdOut.java +++ b/test/jdk/jdk/internal/jline/RedirectedStdOut.java @@ -29,9 +29,11 @@ * @modules jdk.internal.le * @library /test/lib * @run main RedirectedStdOut runRedirectAllTest - * @run main/othervm RedirectedStdOut runRedirectOutOnly + * @run main/othervm --enable-native-access=ALL-UNNAMED RedirectedStdOut runRedirectOutOnly */ +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; import java.lang.foreign.Arena; import java.lang.foreign.FunctionDescriptor; import java.lang.foreign.Linker; @@ -58,7 +60,6 @@ public class RedirectedStdOut { //verify the case where neither stdin/out/err is attached to a terminal, //this test is weaker, but more reliable: void runRedirectAllTest() throws Exception { - if (true) return ; ProcessBuilder builder = ProcessTools.createTestJavaProcessBuilder(ConsoleTest.class.getName()); OutputAnalyzer output = ProcessTools.executeProcess(builder); @@ -147,6 +148,10 @@ public class RedirectedStdOut { loginttyDescriptor); logintty.invoke(child.get(ValueLayout.JAVA_INT, 0)); + //createTestJavaProcessBuilder logs to (current process') System.out, but + //that may not work since the redirect. Setting System.out to a scratch value: + System.setOut(new PrintStream(new ByteArrayOutputStream())); + ProcessBuilder builder = ProcessTools.createTestJavaProcessBuilder(ConsoleTest.class.getName());