From 1f74caa7da9dc0bf0eb515b36791f6fd069e044d Mon Sep 17 00:00:00 2001 From: Theo Weidmann Date: Tue, 28 Jan 2025 09:41:12 +0000 Subject: [PATCH] 8348401: [IR Framework] PrintTimes should not require verbose Reviewed-by: kvn, chagedorn --- .../lib/ir_framework/shared/TestFrameworkSocket.java | 7 +++++++ .../jtreg/compiler/lib/ir_framework/test/TestVM.java | 9 ++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java index c59f432f5ff..7f7aa3f5b32 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java @@ -43,6 +43,7 @@ public class TestFrameworkSocket implements AutoCloseable { public static final String STDOUT_PREFIX = "[STDOUT]"; public static final String TESTLIST_TAG = "[TESTLIST]"; public static final String DEFAULT_REGEX_TAG = "[DEFAULT_REGEX]"; + public static final String PRINT_TIMES_TAG = "[PRINT_TIMES]"; // Static fields used for test VM only. private static final String SERVER_PORT_PROPERTY = "ir.framework.server.port"; @@ -123,6 +124,12 @@ public class TestFrameworkSocket implements AutoCloseable { /** * Only called by test VM to write to server socket. + *

+ * The test VM is spawned by the main jtreg VM. The stdout of the test VM is hidden + * unless the Verbose or ReportStdout flag is used. TestFrameworkSocket is used by the parent jtreg + * VM and the test VM to communicate. By sending the prints through the TestFrameworkSocket with the + * parameter stdout set to true, the parent VM will print the received messages to its stdout, making it + * visible to the user. */ public static void write(String msg, String tag, boolean stdout) { if (REPRODUCE) { diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java index 4e601ec9739..e4f49d494d2 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,6 +38,8 @@ import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; +import static compiler.lib.ir_framework.shared.TestFrameworkSocket.PRINT_TIMES_TAG; + /** * This class' main method is called from {@link TestFramework} and represents the so-called "test VM". The class is * the heart of the framework and is responsible for executing all the specified tests in the test class. It uses the @@ -883,9 +885,10 @@ public class TestVM { // Print execution times if (VERBOSE || PRINT_TIMES) { - System.out.println(System.lineSeparator() + System.lineSeparator() + "Test execution times:"); + TestFrameworkSocket.write("Test execution times:", PRINT_TIMES_TAG, true); for (Map.Entry entry : durations.entrySet()) { - System.out.format("%-10s%15d ns%n", entry.getValue() + ":", entry.getKey()); + TestFrameworkSocket.write(String.format("%-25s%15d ns%n", entry.getValue() + ":", entry.getKey()), + PRINT_TIMES_TAG, true); } }