Skip to content

Commit 7c69d0f

Browse files
Stefan Ringneurobase
Stefan Ring
authored andcommitted
malva: Re-enable Runtime#addShutdownHook test
It was disabled in commit b1bb3f6. The occasional failure happened because the thread, having nothing to do, finished before it was expected to be alive.
1 parent b79efed commit 7c69d0f

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/malva/java/lang/RuntimeTest.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ public static void testAddShutdownHook() {
1616

1717
assertThrows(new Block() {
1818
@Override public void run() {
19-
Thread shutdownHook = new Thread();
20-
shutdownHook.start();
21-
rt.addShutdownHook(shutdownHook);
19+
Thread shutdownHook = new Thread() {
20+
@Override public void run() {
21+
synchronized(RuntimeTest.class) {
22+
}
23+
}
24+
};
25+
synchronized(RuntimeTest.class) {
26+
shutdownHook.start();
27+
rt.addShutdownHook(shutdownHook);
28+
}
2229
}
2330
}, IllegalArgumentException.class);
2431
}
@@ -106,8 +113,7 @@ public static void testTraceMethodCalls() {
106113
}
107114

108115
public static void main(String[] args) throws IOException {
109-
// FAILS:
110-
// testAddShutdownHook();
116+
testAddShutdownHook();
111117
testAvailableProcessors();
112118
testExec();
113119
testExit();

0 commit comments

Comments
 (0)