[njs] Test262: collecting all tests results before exiting.

noreply at nginx.com noreply at nginx.com
Thu Dec 19 20:19:04 UTC 2024


details:   https://github.com/nginx/njs/commit/524431e0a88f69988ca88b4095018a58b19f62b9
branches:  master
commit:    524431e0a88f69988ca88b4095018a58b19f62b9
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu, 5 Dec 2024 16:09:38 -0800
description:
Test262: collecting all tests results before exiting.


---
 test/harness/runTsuite.js | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/test/harness/runTsuite.js b/test/harness/runTsuite.js
index 8103f661..f7ec8f48 100644
--- a/test/harness/runTsuite.js
+++ b/test/harness/runTsuite.js
@@ -19,6 +19,17 @@ async function run(tlist) {
         return false;
     }
 
+    function map(ts) {
+        return ts.tests.map(t => {
+            try {
+                return ts.T(ts.prepare_args(t, ts.opts));
+
+            } catch (e) {
+                return Promise.reject(e);
+            }
+        });
+    }
+
     for (let k = 0; k < tlist.length; k++) {
         let ts = tlist[k];
 
@@ -26,12 +37,19 @@ async function run(tlist) {
             continue;
         }
 
-        let results = await Promise.allSettled(ts.tests.map(t => ts.T(ts.prepare_args(t, ts.opts))));
-        let r = results.map((r, i) => validate(ts.tests, r, i));
+        let results = await Promise.allSettled(map(ts));
+        let r = results.map((r, i) => { r.passed = validate(ts.tests, r, i); return r; });
+
+        let passed = r.filter(r => r.passed).length;
+        if (passed != ts.tests.length) {
+            r.forEach((r, i) => {
+                if (!r.passed) {
+                    console.log(`   ${JSON.stringify(ts.tests[i])}\n    with reason: ${r.reason}`);
+                }
+            })
 
-        r.forEach((v, i) => {
-            assert.sameValue(v, true, `FAILED ${ts.name}: ${JSON.stringify(ts.tests[i])}\n    with reason: ${results[i].reason}`);
-        })
+            console.log(`${ts.name} FAILED: [${passed}/${ts.tests.length}]`);
+        }
     }
 }
 


More information about the nginx-devel mailing list