This is an automated email from the ASF dual-hosted git repository.
zixuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 76308f0bc92 [improve][test] Print stacktrace when the test fails
(#18498)
76308f0bc92 is described below
commit 76308f0bc92d2694e909817fb079f38a0466b722
Author: Zixuan Liu <[email protected]>
AuthorDate: Wed Nov 16 22:50:18 2022 +0800
[improve][test] Print stacktrace when the test fails (#18498)
Signed-off-by: Zixuan Liu <[email protected]>
---
.../main/java/org/apache/pulsar/tests/PulsarTestListener.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git
a/buildtools/src/main/java/org/apache/pulsar/tests/PulsarTestListener.java
b/buildtools/src/main/java/org/apache/pulsar/tests/PulsarTestListener.java
index 057bad25a0a..b3d70621843 100644
--- a/buildtools/src/main/java/org/apache/pulsar/tests/PulsarTestListener.java
+++ b/buildtools/src/main/java/org/apache/pulsar/tests/PulsarTestListener.java
@@ -45,9 +45,12 @@ public class PulsarTestListener implements ITestListener {
System.out.format("!!!!!!!!! FAILURE-- %s.%s(%s)-------\n",
result.getTestClass(),
result.getMethod().getMethodName(),
Arrays.toString(result.getParameters()));
}
- if (result.getThrowable() instanceof ThreadTimeoutException) {
- System.out.println("====== THREAD DUMPS ======");
- System.out.println(ThreadDumpUtil.buildThreadDiagnosticString());
+ if (result.getThrowable() != null) {
+ result.getThrowable().printStackTrace();
+ if (result.getThrowable() instanceof ThreadTimeoutException) {
+ System.out.println("====== THREAD DUMPS ======");
+
System.out.println(ThreadDumpUtil.buildThreadDiagnosticString());
+ }
}
}