gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: also report test results when


From: gnunet
Subject: [taler-wallet-core] branch master updated: also report test results when parent gets killed
Date: Thu, 04 Feb 2021 15:32:31 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 98d205ba also report test results when parent gets killed
98d205ba is described below

commit 98d205badb3c2fbdf76b3ce202189042b7d4042f
Author: Florian Dold <florian@dold.me>
AuthorDate: Thu Feb 4 15:32:26 2021 +0100

    also report test results when parent gets killed
---
 .../src/integrationtests/testrunner.ts             | 43 ++++++++++++++++------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts 
b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
index 77d974f2..0d591573 100644
--- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
@@ -151,24 +151,20 @@ export async function runTests(spec: TestRunSpec) {
   updateCurrentSymlink(testRootDir);
   console.log("testsuite root directory: ", testRootDir);
 
-  let numTotal = 0;
-  let numFail = 0;
-  let numSkip = 0;
-  let numPass = 0;
-
   const testResults: TestRunResult[] = [];
 
   let currentChild: child_process.ChildProcess | undefined;
 
-  const handleSignal = () => {
+  const handleSignal = (s: NodeJS.Signals) => {
+    console.log(`received signal ${s} in test parent`);
     if (currentChild) {
       currentChild.kill("SIGTERM");
     }
-    process.exit(3);
+    reportAndQuit(testRootDir, testResults, true);
   };
 
-  process.on("SIGINT", () => handleSignal);
-  process.on("SIGTERM", () => handleSignal);
+  process.on("SIGINT", (s) => handleSignal(s));
+  process.on("SIGTERM", (s) => handleSignal(s));
   //process.on("unhandledRejection", handleSignal);
   //process.on("uncaughtException", handleSignal);
 
@@ -220,6 +216,7 @@ export async function runTests(spec: TestRunSpec) {
           if (token.isCancelled) {
             return;
           }
+          console.log(`process exited code=${code} signal=${signal}`);
           if (signal) {
             reject(new Error(`test worker exited with signal ${signal}`));
           } else if (code != 0) {
@@ -267,6 +264,22 @@ export async function runTests(spec: TestRunSpec) {
     console.log(`parent: got result ${JSON.stringify(result)}`);
 
     testResults.push(result);
+  }
+
+  reportAndQuit(testRootDir, testResults);
+}
+
+export function reportAndQuit(
+  testRootDir: string,
+  testResults: TestRunResult[],
+  interrupted: boolean = false,
+): never {
+  let numTotal = 0;
+  let numFail = 0;
+  let numSkip = 0;
+  let numPass = 0;
+
+  for (const result of testResults) {
     numTotal++;
     if (result.status === "fail") {
       numFail++;
@@ -280,14 +293,22 @@ export async function runTests(spec: TestRunSpec) {
   const resultsFile = path.join(testRootDir, "results.json");
   fs.writeFileSync(
     path.join(testRootDir, "results.json"),
-    JSON.stringify({ testResults }, undefined, 2),
+    JSON.stringify({ testResults, interrupted }, undefined, 2),
   );
+  if (interrupted) {
+    console.log("test suite was interrupted");
+  }
   console.log(`See ${resultsFile} for details`);
   console.log(`Skipped: ${numSkip}/${numTotal}`);
   console.log(`Failed: ${numFail}/${numTotal}`);
   console.log(`Passed: ${numPass}/${numTotal}`);
-  if (numPass < numTotal - numSkip) {
+
+  if (interrupted) {
+    process.exit(3);
+  } else if (numPass < numTotal - numSkip) {
     process.exit(1);
+  } else {
+    process.exit(0);
   }
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]