8194067: [Testbug] serviceability/sa/Jhsdb* tests can't tolerate unrelated warnings
Reviewed-by: dholmes, sspitsyn
This commit is contained in:
parent
edd2c3b6ca
commit
8ae759dd32
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -21,6 +21,11 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
import jdk.test.lib.Platform;
|
import jdk.test.lib.Platform;
|
||||||
@ -69,7 +74,18 @@ public class JhsdbThreadInfoTest {
|
|||||||
out.shouldMatch(" JavaThread state: _thread_.+");
|
out.shouldMatch(" JavaThread state: _thread_.+");
|
||||||
|
|
||||||
out.shouldNotContain(" java.lang.Thread.State: UNKNOWN");
|
out.shouldNotContain(" java.lang.Thread.State: UNKNOWN");
|
||||||
out.stderrShouldBeEmpty();
|
|
||||||
|
// stderr should be empty except for VM warnings.
|
||||||
|
if (!out.getStderr().isEmpty()) {
|
||||||
|
List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)"));
|
||||||
|
Pattern p = Pattern.compile(".*VM warning.*");
|
||||||
|
for (String line : lines) {
|
||||||
|
Matcher m = p.matcher(line);
|
||||||
|
if (!m.matches()) {
|
||||||
|
throw new RuntimeException("Stderr has output other than VM warnings");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("Test Completed");
|
System.out.println("Test Completed");
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,7 +24,11 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import jdk.test.lib.apps.LingeredApp;
|
import jdk.test.lib.apps.LingeredApp;
|
||||||
import jdk.test.lib.Asserts;
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.JDKToolLauncher;
|
import jdk.test.lib.JDKToolLauncher;
|
||||||
@ -76,7 +80,19 @@ public class TestJhsdbJstackLock {
|
|||||||
out.shouldMatch("^\\s+- waiting to lock <0x[0-9a-f]+> \\(a java\\.lang\\.Class for LingeredAppWithLock\\)$");
|
out.shouldMatch("^\\s+- waiting to lock <0x[0-9a-f]+> \\(a java\\.lang\\.Class for LingeredAppWithLock\\)$");
|
||||||
out.shouldMatch("^\\s+- locked <0x[0-9a-f]+> \\(a java\\.lang\\.Thread\\)$");
|
out.shouldMatch("^\\s+- locked <0x[0-9a-f]+> \\(a java\\.lang\\.Thread\\)$");
|
||||||
out.shouldMatch("^\\s+- locked <0x[0-9a-f]+> \\(a java\\.lang\\.Class for int\\)$");
|
out.shouldMatch("^\\s+- locked <0x[0-9a-f]+> \\(a java\\.lang\\.Class for int\\)$");
|
||||||
out.stderrShouldBeEmpty();
|
|
||||||
|
// stderr should be empty except for VM warnings.
|
||||||
|
if (!out.getStderr().isEmpty()) {
|
||||||
|
List<String> lines = Arrays.asList(out.getStderr().split("(\\r\\n|\\n|\\r)"));
|
||||||
|
Pattern p = Pattern.compile(".*VM warning.*");
|
||||||
|
for (String line : lines) {
|
||||||
|
Matcher m = p.matcher(line);
|
||||||
|
if (!m.matches()) {
|
||||||
|
throw new RuntimeException("Stderr has output other than VM warnings");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
System.out.println("Test Completed");
|
System.out.println("Test Completed");
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user