8348401: [IR Framework] PrintTimes should not require verbose

Reviewed-by: kvn, chagedorn
This commit is contained in:
Theo Weidmann 2025-01-28 09:41:12 +00:00 committed by Christian Hagedorn
parent f71541c93b
commit 1f74caa7da
2 changed files with 13 additions and 3 deletions

View File

@ -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.
* <p>
* 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) {

View File

@ -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<Long, String> 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);
}
}