Skip to content

Commit 57e792a

Browse files
committed
8334305: Remove all code for nsk.share.Log verbose mode
8341412: Various test failures after JDK-8334305 Reviewed-by: rrich Backport-of: 855c8a7def21025bc2fc47594f7285a55924c213
1 parent ba71fc0 commit 57e792a

File tree

13 files changed

+32
-123
lines changed

13 files changed

+32
-123
lines changed

test/hotspot/jtreg/vmTestbase/jit/escape/LockElision/MatMul/MatMul.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2024, 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
@@ -85,7 +85,7 @@ public static void main(String[] args) {
8585
}
8686

8787
public int run() {
88-
log = new Log(System.out, verbose);
88+
log = new Log(System.out);
8989
log.display("Parallel matrix multiplication test");
9090

9191
Matrix a = Matrix.randomMatrix(dim);

test/hotspot/jtreg/vmTestbase/nsk/jdi/LaunchingConnector/launchnosuspend/launchnosuspend001.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ private launchnosuspend001 (String args[], PrintStream out) {
7171

7272
argHandler = new ArgumentHandler(args);
7373
log = new Log(this.out, argHandler);
74-
//log.enableVerbose(true);
7574
}
7675

7776
private PrintStream out;

test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter_tagged/HeapFilter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2024, 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
@@ -49,7 +49,6 @@ public int runTest(String args[], PrintStream out) {
4949
log = new Log(out, argHandler);
5050
testObjects = new Object[]{new TaggedClass(),
5151
new UntaggedClass()};
52-
log.enableVerbose(true);
5352
log.display("Verifying reachable objects.");
5453
status = checkStatus(status);
5554
testObjects = null;

test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isCollectionUsageThresholdExceeded/isexceeded001.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2024, 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
@@ -40,7 +40,6 @@ public static void main(String[] argv) {
4040
public static int run(String[] argv, PrintStream out) {
4141
ArgumentHandler argHandler = new ArgumentHandler(argv);
4242
Log log = new Log(out, argHandler);
43-
log.enableVerbose(true);
4443

4544
monitor = Monitor.getMemoryMonitor(log, argHandler);
4645
List pools = monitor.getMemoryPoolMBeans();

test/hotspot/jtreg/vmTestbase/nsk/monitoring/MemoryPoolMBean/isUsageThresholdExceeded/isexceeded001.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2004, 2024, 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
@@ -47,7 +47,6 @@ public static void main(String[] argv) {
4747
public static int run(String[] argv, PrintStream out) {
4848
ArgumentHandler argHandler = new ArgumentHandler(argv);
4949
Log log = new Log(out, argHandler);
50-
log.enableVerbose(true); // show log output
5150

5251
MemoryMonitor monitor = Monitor.getMemoryMonitor(log, argHandler);
5352
List pools = monitor.getMemoryPoolMBeans();

test/hotspot/jtreg/vmTestbase/nsk/monitoring/stress/lowmem/lowmem001.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2024, 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
@@ -58,7 +58,7 @@ public static void main(String[] args) {
5858

5959
@Override
6060
public void run() {
61-
Log log = new Log(System.out, true);
61+
Log log = new Log(System.out);
6262
// System.err is duplicated into buffer
6363
// it should be empty
6464
MyStream stream = new MyStream(System.err);

test/hotspot/jtreg/vmTestbase/nsk/share/Log.java

Lines changed: 15 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,9 @@
3636
import java.util.HashSet;
3737
import java.util.Vector;
3838

39-
import nsk.share.test.LazyFormatString;
4039

4140
/**
42-
* This class helps to print test-execution trace messages
43-
* and filter them when execution mode is not verbose.
44-
* <p>
45-
* Verbose mode if defined by providing <i>-verbose</i> command line
46-
* option, handled by <code>ArgumentParser</code>. Use <code>verbose()</code>
47-
* method to determine which mode is used.
41+
* This class helps to print test-execution trace messages.
4842
* <p>
4943
* <code>Log</code> provides with two main methods to print messages:
5044
* <ul>
@@ -63,7 +57,6 @@
6357
* To provide printing messages from different sources into one log
6458
* with distinct prefixes use internal <code>Log.Logger</code> class.
6559
*
66-
* @see #verbose()
6760
* @see #complain(String)
6861
* @see #display(String)
6962
* @see ArgumentParser
@@ -78,18 +71,6 @@ public class Log extends FinalizableObject {
7871
@Deprecated
7972
protected PrintStream out = null;
8073

81-
/**
82-
* Is log-mode verbose?
83-
* Always enabled.
84-
*/
85-
private final boolean verbose = true;
86-
87-
/**
88-
* Should log messages prefixed with timestamps?
89-
* Always enabled.
90-
*/
91-
private final boolean timestamp = true;
92-
9374
/**
9475
* Names for trace levels
9576
*/
@@ -207,32 +188,15 @@ public Log(PrintStream stream) {
207188

208189
/**
209190
* Incarnate new Log for the given <code>stream</code>; and
210-
* either for verbose or for non-verbose mode accordingly to
211-
* the given <code>verbose</code> key.
212-
*/
213-
public Log(PrintStream stream, boolean verbose) {
214-
this(stream);
215-
}
216-
217-
/**
218-
* Incarnate new Log for the given <code>stream</code>; and
219-
* either for verbose or for non-verbose mode accordingly to
220191
* the given <code>argsHandler</code>.
221192
*/
222193
public Log(PrintStream stream, ArgumentParser argsParser) {
223-
this(stream, argsParser.verbose());
194+
this(stream);
224195
traceLevel = argsParser.getTraceLevel();
225196
}
226197

227198
/////////////////////////////////////////////////////////////////
228199

229-
/**
230-
* Return <i>true</i> if log mode is verbose.
231-
*/
232-
public boolean verbose() {
233-
return verbose;
234-
}
235-
236200
/**
237201
* Return <i>true</i> if printing errors summary at exit is enabled.
238202
*/
@@ -313,9 +277,6 @@ public static String printExceptionToString(Object prefix, Throwable exception)
313277
@Deprecated
314278
public synchronized void println(String message) {
315279
doPrint(message);
316-
if (!verbose() && isVerboseOnErrorEnabled()) {
317-
keepLog(composeLine(message));
318-
}
319280
}
320281

321282
/**
@@ -329,9 +290,6 @@ public synchronized void println(String message) {
329290
*/
330291
@Deprecated
331292
public synchronized void comment(String message) {
332-
if (!verbose()) {
333-
doPrint(message);
334-
}
335293
}
336294

337295
/**
@@ -361,19 +319,10 @@ public void trace(int level, Object message, Throwable exception) {
361319
}
362320

363321
/**
364-
* Print <code>message</code> to the assigned output stream,
365-
* if log mode is verbose. The <code>message</code> will be lost,
366-
* if execution mode is non-verbose, and there is no error messages
367-
* printed.
322+
* Print <code>message</code> to the assigned output stream.
368323
*/
369324
public synchronized void display(Object message) {
370-
if (verbose()) {
371-
doPrint(message.toString());
372-
} else if (isVerboseOnErrorEnabled()) {
373-
keepLog(composeLine(message.toString()));
374-
} else {
375-
// ignore
376-
}
325+
doPrint(message.toString());
377326
}
378327

379328
/**
@@ -382,15 +331,6 @@ public synchronized void display(Object message) {
382331
* into <code>errorsBuffer</code>.
383332
*/
384333
public synchronized void complain(Object message) {
385-
if (!verbose() && isVerboseOnErrorEnabled()) {
386-
PrintStream stream = findOutStream();
387-
stream.println("#> ");
388-
stream.println("#> WARNING: switching log to verbose mode,");
389-
stream.println("#> because error is complained");
390-
stream.println("#> ");
391-
stream.flush();
392-
enableVerbose(true);
393-
}
394334
String msgStr = message.toString();
395335
printError(msgStr);
396336
if (isErrorsSummaryEnabled()) {
@@ -458,10 +398,7 @@ private void logExceptionForFailureAnalysis(String msg) {
458398
/////////////////////////////////////////////////////////////////
459399

460400
/**
461-
* Redirect log to the given <code>stream</code>, and switch
462-
* log mode to verbose.
463-
* Prints errors summary to current stream, cancel current stream
464-
* and switches to new stream. Turns on verbose mode for new stream.
401+
* Redirect log to the given <code>stream</code>.
465402
*
466403
* @deprecated This method is obsolete.
467404
*/
@@ -480,20 +417,6 @@ public synchronized void clearLogBuffer() {
480417
logBuffer.clear();
481418
}
482419

483-
/**
484-
* Print all messages from log buffer which were hidden because
485-
* of non-verbose mode,
486-
*/
487-
private synchronized void flushLogBuffer() {
488-
if (!logBuffer.isEmpty()) {
489-
PrintStream stream = findOutStream();
490-
for (int i = 0; i < logBuffer.size(); i++) {
491-
stream.println(logBuffer.elementAt(i));
492-
}
493-
stream.flush();
494-
}
495-
}
496-
497420
/**
498421
* Return <code>out</code> stream if defined or <code>Sytem.err<code> otherwise;
499422
* print a warning message when <code>System.err</code> is used first time.
@@ -518,18 +441,15 @@ private synchronized PrintStream findOutStream() {
518441
* Compose line to print possible prefixing it with timestamp.
519442
*/
520443
private String composeLine(String message) {
521-
if (timestamp) {
522-
long time = System.currentTimeMillis();
523-
long ms = time % 1000;
524-
time /= 1000;
525-
long secs = time % 60;
526-
time /= 60;
527-
long mins = time % 60;
528-
time /= 60;
529-
long hours = time % 24;
530-
return "[" + hours + ":" + mins + ":" + secs + "." + ms + "] " + message;
531-
}
532-
return message;
444+
long time = System.currentTimeMillis();
445+
long ms = time % 1000;
446+
time /= 1000;
447+
long secs = time % 60;
448+
time /= 60;
449+
long mins = time % 60;
450+
time /= 60;
451+
long hours = time % 24;
452+
return "[" + hours + ":" + mins + ":" + secs + "." + ms + "] " + message;
533453
}
534454

535455
/**
@@ -563,13 +483,6 @@ private synchronized void printError(String message) {
563483
}
564484
}
565485

566-
/**
567-
* Keep the given log <code>message</code> into <code>logBuffer</code>.
568-
*/
569-
private synchronized void keepLog(String message) {
570-
logBuffer.addElement(message);
571-
}
572-
573486
/**
574487
* Keep the given error <code>message</code> into <code>errorsBuffer</code>.
575488
*/
@@ -603,7 +516,7 @@ private synchronized void printErrorsSummary() {
603516
* Print errors summary if mode is verbose, flush and cancel output stream.
604517
*/
605518
protected void finalize() {
606-
if (verbose() && isErrorsSummaryEnabled()) {
519+
if (isErrorsSummaryEnabled()) {
607520
printErrorsSummary();
608521
}
609522
if (out != null)

test/hotspot/jtreg/vmTestbase/nsk/share/aod/AODTestRunner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2024, 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
@@ -68,7 +68,7 @@ public class AODTestRunner {
6868
protected AODRunnerArgParser argParser;
6969

7070
protected AODTestRunner(String[] args) {
71-
log = new Log(System.out, true);
71+
log = new Log(System.out);
7272

7373
argParser = createArgParser(args);
7474
}

test/hotspot/jtreg/vmTestbase/nsk/share/aod/AbstractJarAgent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2024, 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
@@ -157,7 +157,7 @@ private void defaultInit(String[] args) {
157157
if (name == null)
158158
throw new TestBug("Agent name wasn't specified");
159159

160-
log = new Log(System.out, true);
160+
log = new Log(System.out);
161161
}
162162

163163
/*

test/hotspot/jtreg/vmTestbase/nsk/share/aod/DummyTargetApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*/
4040
public class DummyTargetApplication {
4141

42-
protected Log log = new Log(System.out, true);
42+
protected Log log = new Log(System.out);
4343

4444
protected AODTargetArgParser argParser;
4545

0 commit comments

Comments
 (0)