aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/testrunner.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/integrationtests/testrunner.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/testrunner.ts27
1 files changed, 17 insertions, 10 deletions
diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts
index f845f4e99..c76ce1b18 100644
--- a/packages/taler-harness/src/integrationtests/testrunner.ts
+++ b/packages/taler-harness/src/integrationtests/testrunner.ts
@@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { CancellationToken, minimatch } from "@gnu-taler/taler-util";
+import { CancellationToken, Logger, minimatch } from "@gnu-taler/taler-util";
import * as child_process from "child_process";
import * as fs from "fs";
import * as os from "os";
@@ -105,6 +105,7 @@ import { runExchangeDepositTest } from "./test-exchange-deposit.js";
/**
* Test runner.
*/
+const logger = new Logger("testrunner.ts");
/**
* Spec for one test.
@@ -199,6 +200,8 @@ export interface TestRunSpec {
includePattern?: string;
suiteSpec?: string;
dryRun?: boolean;
+ failFast?: boolean;
+ waitOnFail?: boolean;
includeExperimental: boolean;
noTimeout: boolean;
verbosity: number;
@@ -357,7 +360,7 @@ export async function runTests(spec: TestRunSpec) {
if (token.isCancelled) {
return;
}
- console.log(`process exited code=${code} signal=${signal}`);
+ logger.info(`process exited code=${code} signal=${signal}`);
if (signal) {
reject(new Error(`test worker exited with signal ${signal}`));
} else if (code != 0) {
@@ -385,6 +388,10 @@ export async function runTests(spec: TestRunSpec) {
try {
result = await token.racePromise(resultPromise);
+ if (result.status === "fail" && spec.failFast) {
+ logger.error("test failed and failing fast, exit!");
+ throw Error("exit on fail fast");
+ }
} catch (e: any) {
console.error(`test ${testName} timed out`);
if (token.isCancelled) {
@@ -469,10 +476,9 @@ if (runTestInstrStr && process.argv.includes("__TWCLI_TESTWORKER")) {
const { testRootDir, testName } = JSON.parse(
runTestInstrStr,
) as RunTestChildInstruction;
- console.log(`running test ${testName} in worker process`);
process.on("disconnect", () => {
- console.log("got disconnect from parent");
+ logger.trace("got disconnect from parent");
process.exit(3);
});
@@ -486,35 +492,36 @@ if (runTestInstrStr && process.argv.includes("__TWCLI_TESTWORKER")) {
}
if (!process.send) {
- console.error("can't communicate with parent");
+ logger.error("can't communicate with parent");
process.exit(2);
}
if (!testMain) {
- console.log(`test ${testName} not found`);
+ logger.info(`test ${testName} not found`);
process.exit(2);
}
const testDir = path.join(testRootDir, testName);
- console.log(`running test ${testName}`);
+ logger.info(`running test ${testName}`);
const gc = new GlobalTestState({
testDir,
});
const testResult = await runTestWithState(gc, testMain, testName);
+ logger.info(`done test ${testName}: ${testResult.status}`);
process.send(testResult);
};
runTest()
.then(() => {
- console.log(`test ${testName} finished in worker`);
+ logger.trace(`test ${testName} finished in worker`);
if (shouldLingerInTest()) {
- console.log("lingering ...");
+ logger.trace("lingering ...");
return;
}
process.exit(0);
})
.catch((e) => {
- console.log(e);
+ logger.error(e);
process.exit(1);
});
}