protected static void testBuilder(final BuilderTestRunner runner, String name, String testArgs) throws Exception { String realName = name; if (runner.getName().indexOf('_') != -1 && !runner.getName().startsWith("CVE_")) { realName = runner.getName().substring(0, runner.getName().indexOf('_') + 1) + name; if (name.equals("BindMultiTCP") || name.startsWith("Integrated$") || name.startsWith("Spawn_")) return; } if (runner.getName().indexOf("Embedded") == -1 && runner.getName().indexOf("Injector") == -1 && name.indexOf("Integrated$") != -1) return; final String[] args = StageMenu.splitArgs(realName + " " + testArgs + " -- TestStub Fast"); final StagerHandler.Loader loader = (runner.getName().indexOf("Injector") != -1) ? null : new StagerHandler.Loader(args); if (runner.getName().indexOf("[kill]") != -1) { if (name.startsWith("Spawn")) return; ((TestStub) loader.stageHandler).sendExit = true; } if (loader != null) loader.handleBefore(System.err, null); runner.runBuilder(loader == null ? args : loader.getArgs()); final Throwable[] tt = new Throwable[1]; Thread t = new Thread( new Runnable() { public void run() { try { runner.runResult(loader == null ? args : loader.getArgs()); } catch (Throwable t) { tt[0] = t; } }; }); t.start(); runner.waitReady(); if (loader != null) loader.handleAfter(System.err, null); t.join(); if (tt[0] != null) { /* #JDK1.4 */ try { throw new Exception("Builder result died", tt[0]); } catch (NoSuchMethodError ex2) /**/ { throw new Exception("Builder result died: " + tt[0].toString()); } } }
public void waitReady() throws InterruptedException { runner.waitReady(); }