From cc9a2b87e7cf2f7e1113c693d1e470062b7e49ec Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:15:02 +0200 Subject: [PATCH] Tue 27 Aug 00:14:56 CEST 2024 --- test/test-singlestep2.js | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/test-singlestep2.js diff --git a/test/test-singlestep2.js b/test/test-singlestep2.js new file mode 100644 index 0000000..2f6115b --- /dev/null +++ b/test/test-singlestep2.js @@ -0,0 +1,41 @@ +// Remote single stepping using RPC (controller) +// jamsh test-singlestep1.js -- 9001 +// ... +var N=2,verbose=0,runCount=0; +var workers = [ + 'udp://localhost:9001', + 'udp://localhost:9002', + 'udp://localhost:9003', + 'udp://localhost:9004' +] + +workers=workers.slice(0,N); +var t = time(); +function run1 () { + var ready = workers.length; + runCount++; + workers.forEach(function (url) { + if (verbose) log(url+' '+runCount); + else if ((runCount % 1000)==1) log(url+' '+runCount); + Rpc.trans(url,{ + command:'sensor', + value : Math.random(), + }) + Rpc.trans(url,{ + command:'step' + },function (reply) { + if (verbose>1) log(url+inspect(reply)) + else if ((runCount % 1000)==1) log(url+inspect(reply)); + if (reply.status) ready--; + if (ready==0) { + if ((runCount % 1000)==1) { + var t1=time()-t; + log(t1); + t=time(); + } + run1(); + } + }); + }); +}; +run1()