diff options
| author | 2016-04-07 10:12:31 +0100 | |
|---|---|---|
| committer | 2016-04-07 10:53:12 +0100 | |
| commit | 1939a8866fccbef90167eeb644ba1fa517228ff9 (patch) | |
| tree | 225a57bc12253e7ca9854bf564fdb2d69263c31a | |
| parent | 75563e34a4e64a8e805e6810b13e07f1cafec137 (diff) | |
Add 20s timeout to 570-checker-osr.
It's better to report a timeout than to hang indefinitely.
Change-Id: Ibfa8059c8b44220c7a55801b020094fc342c8047
| -rw-r--r-- | test/570-checker-osr/src/Main.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/570-checker-osr/src/Main.java b/test/570-checker-osr/src/Main.java index 1142d49eed..6514334af1 100644 --- a/test/570-checker-osr/src/Main.java +++ b/test/570-checker-osr/src/Main.java @@ -16,8 +16,28 @@ public class Main { public static void main(String[] args) { - new SubMain(); System.loadLibrary(args[0]); + Thread testThread = new Thread() { + public void run() { + performTest(); + } + }; + testThread.start(); + try { + testThread.join(20 * 1000); // 20s timeout. + } catch (InterruptedException ie) { + System.out.println("Interrupted."); + System.exit(1); + } + Thread.State state = testThread.getState(); + if (state != Thread.State.TERMINATED) { + System.out.println("Test timed out, current state: " + state); + System.exit(1); + } + } + + public static void performTest() { + new SubMain(); if ($noinline$returnInt() != 53) { throw new Error("Unexpected return value"); } |