Skip to content

Commit ada8f52

Browse files
committed
[GR-55104] Print the main thread stacktrace in case of exception for TruffleSafepointTest
1 parent c871185 commit ada8f52

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/TruffleSafepointTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,7 @@ static class TestRootNode extends RootNode {
18501850
@SuppressWarnings("unchecked")
18511851
@Override
18521852
public Object execute(VirtualFrame frame) {
1853-
waitForLatch(latch);
1853+
barrier(latch);
18541854
do {
18551855
Boolean result = callable.call(setup, this);
18561856
if (result) {
@@ -1957,6 +1957,9 @@ private TestSetup setupSafepointLoop(int threads, NodeCallable callable, Consume
19571957
return setup;
19581958
} catch (Throwable t) {
19591959
if (setup != null && setup.futures != null) {
1960+
// Print it now, because if some futures also fail they would override the current
1961+
// exception
1962+
t.printStackTrace();
19601963
setup.close();
19611964
} else {
19621965
c.close();
@@ -2039,8 +2042,9 @@ protected Context createTestContext() {
20392042
private ByteArrayOutputStream outputStream;
20402043

20412044
@TruffleBoundary
2042-
private static void waitForLatch(CountDownLatch latch) throws AssertionError {
2045+
private static void barrier(CountDownLatch latch) throws AssertionError {
20432046
latch.countDown();
2047+
20442048
boolean interrupted = false;
20452049
while (true) {
20462050
try {

0 commit comments

Comments
 (0)