提交 e68c01e1 authored 作者: Noel Grandin's avatar Noel Grandin

return a non-zero status code if the unit tests fail

上级 ac948af9
...@@ -410,6 +410,11 @@ java org.h2.test.TestAll timer ...@@ -410,6 +410,11 @@ java org.h2.test.TestAll timer
*/ */
ArrayList<TestBase> tests = New.arrayList(); ArrayList<TestBase> tests = New.arrayList();
/**
* Set to true if any of the tests fail. Used to return an error code from the whole program.
*/
static boolean atLeastOneTestFailed;
private Server server; private Server server;
/** /**
...@@ -422,6 +427,9 @@ java org.h2.test.TestAll timer ...@@ -422,6 +427,9 @@ java org.h2.test.TestAll timer
run(args); run(args);
catcher.stop(); catcher.stop();
catcher.writeTo("Test Output", "docs/html/testOutput.html"); catcher.writeTo("Test Output", "docs/html/testOutput.html");
if (atLeastOneTestFailed) {
System.exit(1);
}
} }
private static void run(String... args) throws Exception { private static void run(String... args) throws Exception {
......
...@@ -153,6 +153,7 @@ public abstract class TestBase { ...@@ -153,6 +153,7 @@ public abstract class TestBase {
if (config.stopOnError) { if (config.stopOnError) {
throw new AssertionError("ERROR"); throw new AssertionError("ERROR");
} }
conf.atLeastOneTestFailed = true;
if (e instanceof OutOfMemoryError) { if (e instanceof OutOfMemoryError) {
throw (OutOfMemoryError) e; throw (OutOfMemoryError) e;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论