Don't print absolute paths when:
(1) Printing the "location" of ERROR/INFO/etc messages. Instead, print a path relative to the workspace or a --package_path root. Behavior is controlled by flag --experimental_ui_attempt_to_print_relative_paths).
(2) Printing the absolute path to a test log. Instead print a relative path under the "testlogs" convenience symlink. Behavior is controlled by flag --print_relative_test_log_paths.
There are drawbacks to both these new features (discussed below and also in the flag help strings).
Out of scope (these can be addressed in followup feature requests, as necessary):
(3) Arbitrary strings in messages.
(4) Non-usefulness of relative paths when running Blaze underneath the workspace directory.
(5) Non-usefulness of the a path that contains the "testlogs" convenience symlink when changing configurations in a subsequent invocation.
(6) Other things besides error message prefixes and test log paths in test summaries.
RELNOTES: None
PiperOrigin-RevId: 218762875
diff --git a/src/test/java/com/google/devtools/build/lib/runtime/TerminalTestResultNotifierTest.java b/src/test/java/com/google/devtools/build/lib/runtime/TerminalTestResultNotifierTest.java
index af2e211..7ab653b 100644
--- a/src/test/java/com/google/devtools/build/lib/runtime/TerminalTestResultNotifierTest.java
+++ b/src/test/java/com/google/devtools/build/lib/runtime/TerminalTestResultNotifierTest.java
@@ -24,6 +24,7 @@
import com.google.devtools.build.lib.exec.TestStrategy.TestSummaryFormat;
import com.google.devtools.build.lib.runtime.TerminalTestResultNotifier.TestSummaryOptions;
import com.google.devtools.build.lib.util.io.AnsiTerminalPrinter;
+import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.view.test.TestStatus.BlazeTestStatus;
import com.google.devtools.build.lib.view.test.TestStatus.TestCase;
import com.google.devtools.build.lib.view.test.TestStatus.TestCase.Status;
@@ -61,8 +62,8 @@
int numOfFailedCases = random.nextInt(numOfTotalTestCases);
int numOfSuccessfulTestCases = numOfTotalTestCases - numOfFailedCases;
- TerminalTestResultNotifier terminalTestResultNotifier =
- new TerminalTestResultNotifier(ansiTerminalPrinter, optionsParsingResult);
+ TerminalTestResultNotifier terminalTestResultNotifier = new TerminalTestResultNotifier(
+ ansiTerminalPrinter, Path::getPathString, optionsParsingResult);
TestSummary testSummary = Mockito.mock(TestSummary.class);
when(testSummary.getTotalTestCases()).thenReturn(numOfTotalTestCases);