Skip to content

Commit 1f74caa

Browse files
Theo Weidmannchhagedorn
Theo Weidmann
authored andcommittedJan 28, 2025
8348401: [IR Framework] PrintTimes should not require verbose
Reviewed-by: kvn, chagedorn
1 parent f71541c commit 1f74caa

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
 

‎test/hotspot/jtreg/compiler/lib/ir_framework/shared/TestFrameworkSocket.java

+7
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public class TestFrameworkSocket implements AutoCloseable {
4343
public static final String STDOUT_PREFIX = "[STDOUT]";
4444
public static final String TESTLIST_TAG = "[TESTLIST]";
4545
public static final String DEFAULT_REGEX_TAG = "[DEFAULT_REGEX]";
46+
public static final String PRINT_TIMES_TAG = "[PRINT_TIMES]";
4647

4748
// Static fields used for test VM only.
4849
private static final String SERVER_PORT_PROPERTY = "ir.framework.server.port";
@@ -123,6 +124,12 @@ public static void write(String msg, String tag) {
123124

124125
/**
125126
* Only called by test VM to write to server socket.
127+
* <p>
128+
* The test VM is spawned by the main jtreg VM. The stdout of the test VM is hidden
129+
* unless the Verbose or ReportStdout flag is used. TestFrameworkSocket is used by the parent jtreg
130+
* VM and the test VM to communicate. By sending the prints through the TestFrameworkSocket with the
131+
* parameter stdout set to true, the parent VM will print the received messages to its stdout, making it
132+
* visible to the user.
126133
*/
127134
public static void write(String msg, String tag, boolean stdout) {
128135
if (REPRODUCE) {

‎test/hotspot/jtreg/compiler/lib/ir_framework/test/TestVM.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,8 @@
3838
import java.util.stream.Collectors;
3939
import java.util.stream.Stream;
4040

41+
import static compiler.lib.ir_framework.shared.TestFrameworkSocket.PRINT_TIMES_TAG;
42+
4143
/**
4244
* This class' main method is called from {@link TestFramework} and represents the so-called "test VM". The class is
4345
* 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 @@ private void runTests() {
883885

884886
// Print execution times
885887
if (VERBOSE || PRINT_TIMES) {
886-
System.out.println(System.lineSeparator() + System.lineSeparator() + "Test execution times:");
888+
TestFrameworkSocket.write("Test execution times:", PRINT_TIMES_TAG, true);
887889
for (Map.Entry<Long, String> entry : durations.entrySet()) {
888-
System.out.format("%-10s%15d ns%n", entry.getValue() + ":", entry.getKey());
890+
TestFrameworkSocket.write(String.format("%-25s%15d ns%n", entry.getValue() + ":", entry.getKey()),
891+
PRINT_TIMES_TAG, true);
889892
}
890893
}
891894

0 commit comments

Comments
 (0)
Please sign in to comment.