summaryrefslogtreecommitdiff
path: root/js/test/Common/TestRunner.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/test/Common/TestRunner.js')
-rw-r--r--js/test/Common/TestRunner.js55
1 files changed, 34 insertions, 21 deletions
diff --git a/js/test/Common/TestRunner.js b/js/test/Common/TestRunner.js
index 9725c0e9352..8fa5f6d1978 100644
--- a/js/test/Common/TestRunner.js
+++ b/js/test/Common/TestRunner.js
@@ -10,7 +10,7 @@
/* global
_test : false,
- _testBidir : false,
+ _runServer : false,
Test : false,
*/
@@ -108,7 +108,6 @@ function runTest(testsuite, language, host, protocol, testcases, out)
var communicator;
var id = new Ice.InitializationData();
var port = protocol == "ws" ? 15002 : 15003;
- var serverTestCase;
id.logger = Logger;
id.properties = Ice.createProperties();
id.properties.setProperty("Ice.Default.Host", host);
@@ -119,7 +118,7 @@ function runTest(testsuite, language, host, protocol, testcases, out)
return Ice.Promise.try(
function()
{
- if(typeof(_runServer) === "undefined" && typeof(_testBidir) === "undefined")
+ if(typeof(_runServer) === "undefined")
{
return _test(out, id);
}
@@ -140,17 +139,18 @@ function runTest(testsuite, language, host, protocol, testcases, out)
}
var runTestCase;
- if(typeof(_testBidir) !== "undefined" && client == _testBidir)
+ out.writeLine("[ running " + testcase.name + " test]");
+ if(language === "js")
{
- out.writeLine("[ running bidir " + testcase.name + " test]");
- runTestCase = function() { return controller.runTestCase("cpp", "Ice/echo", "server", language); };
+ runTestCase = function() { return controller.runTestCase("cpp", "Ice/echo", "server", ""); };
}
else
{
- out.writeLine("[ running " + testcase.name + " test]");
runTestCase = function() { return controller.runTestCase("js", testsuite, testcase.name, language) };
}
out.write("starting server side... ");
+ var serverTestCase;
+ var server;
return runTestCase().then(
function(proxy)
{
@@ -164,17 +164,40 @@ function runTest(testsuite, language, host, protocol, testcases, out)
function()
{
out.writeLine("ok")
+ process.argv = testcase.args;
+ if(language === "js")
+ {
+ var initData = id.clone();
+ if(testcase.args !== undefined)
+ {
+ initData.properties = Ice.createProperties(testcase.args, id.properties);
+ }
+ ready = new Ice.Promise();
+ server = _server(out, initData.clone(), ready)
+ return ready;
+ }
+ }
+ ).then(
+ function()
+ {
var initData = id.clone();
if(testcase.args !== undefined)
{
initData.properties = Ice.createProperties(testcase.args, id.properties);
- process.argv = testcase.args;
}
return client(out, initData);
}
).then(
function()
{
+ if(server)
+ {
+ return server; // Wait for server to terminate
+ }
+ }
+ ).then(
+ function()
+ {
return serverTestCase.stopServerSide(true);
}
).catch(
@@ -194,19 +217,9 @@ function runTest(testsuite, language, host, protocol, testcases, out)
}
var p = Ice.Promise.resolve();
- if(typeof(_runServer) !== "undefined")
- {
- testcases.forEach(function(testcase) {
- p = p.then(function() { return run(testcase, _test); })
- });
- }
- if(typeof(_testBidir) !== "undefined" && language === "cpp")
- {
- testcases.forEach(function(testcase) {
- options = typeof(_runEchoServerOptions) !== "undefined" ? _runEchoServerOptions : []
- p = p.then(function() { return run(testcase, _testBidir); })
- });
- }
+ testcases.forEach(function(testcase) {
+ p = p.then(function() { return run(testcase, _test); })
+ });
return p;
}
).finally(