diff options
Diffstat (limited to 'netwerk/test/unit/node_execute')
-rw-r--r-- | netwerk/test/unit/node_execute/test_node_execute_loop.js | 22 | ||||
-rw-r--r-- | netwerk/test/unit/node_execute/xpcshell.toml | 5 |
2 files changed, 27 insertions, 0 deletions
diff --git a/netwerk/test/unit/node_execute/test_node_execute_loop.js b/netwerk/test/unit/node_execute/test_node_execute_loop.js new file mode 100644 index 0000000000..10400b8b54 --- /dev/null +++ b/netwerk/test/unit/node_execute/test_node_execute_loop.js @@ -0,0 +1,22 @@ +// This test checks that the interaction between NodeServer.execute defined in +// httpd.js and the node server that we're interacting with defined in +// moz-http2.js is working properly. +// This test spawns a node server that loops on while true and makes sure +// the the process group is killed by runxpcshelltests.py at exit. +// See bug 1855174 + +"use strict"; + +const { NodeServer } = ChromeUtils.importESModule( + "resource://testing-common/httpd.sys.mjs" +); + +add_task(async function killOnEnd() { + let id = await NodeServer.fork(); + await NodeServer.execute(id, `console.log("hello");`); + await NodeServer.execute(id, `console.error("hello");`); + // Make the forked subprocess hang forever. + NodeServer.execute(id, "while (true) {}").catch(e => {}); + await new Promise(resolve => do_timeout(10, resolve)); + // Should get killed at the end of the test by the harness. +}); diff --git a/netwerk/test/unit/node_execute/xpcshell.toml b/netwerk/test/unit/node_execute/xpcshell.toml new file mode 100644 index 0000000000..7d881a3bda --- /dev/null +++ b/netwerk/test/unit/node_execute/xpcshell.toml @@ -0,0 +1,5 @@ +[DEFAULT] + +["test_node_execute_loop.js"] +run-sequentially = "node server exceptions dont replay well" +skip-if = ["verify"] # running it once hangs forever so don't run it in a loop. |