use of org.h2.test.synth.OutputCatcher in project h2database by h2database.
the class TestAll method main.
/**
* Run all tests.
*
* @param args the command line arguments
*/
public static void main(String... args) throws Exception {
OutputCatcher catcher = OutputCatcher.start();
run(args);
catcher.stop();
catcher.writeTo("Test Output", "docs/html/testOutput.html");
if (atLeastOneTestFailed) {
System.exit(1);
}
}
use of org.h2.test.synth.OutputCatcher in project h2database by h2database.
the class TestRecoverKillLoop method runTest.
private void runTest(int count) throws Exception {
FileUtils.deleteRecursive("data/db", false);
Random random = new Random(1);
for (int i = 0; i < count; i++) {
String[] procDef = { "java", "-cp", getClassPath(), "-Dtest.dir=data/db", TestRecover.class.getName() };
Process p = Runtime.getRuntime().exec(procDef);
InputStream in = p.getInputStream();
OutputCatcher catcher = new OutputCatcher(in);
catcher.start();
while (true) {
String s = catcher.readLine(60 * 1000);
// System.out.println("> " + s);
if (s == null) {
fail("No reply from process");
} else if (s.startsWith("testing...")) {
int sleep = random.nextInt(10000);
Thread.sleep(sleep);
printTime("killing");
p.destroy();
p.waitFor();
break;
} else if (s.startsWith("error!")) {
fail("Failed: " + s);
}
}
}
}
Aggregations