summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-11-25 13:13:22 +0100
committerBenoit Foucher <benoit@zeroc.com>2016-11-25 13:13:22 +0100
commitdcdc32af1fced49d80a8ccd93230e15d91ab45d8 (patch)
treeeb69e2555fbd54496fce8a33f4dd610e1473ff51 /cpp/test
parentC# IceSSL/configuration log expired certificate exceptions. (diff)
downloadice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.tar.bz2
ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.tar.xz
ice-dcdc32af1fced49d80a8ccd93230e15d91ab45d8.zip
Refactored test scripts
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/Common/TestCommon.cpp43
-rw-r--r--cpp/test/Glacier2/attack/Client.cpp10
-rw-r--r--cpp/test/Glacier2/attack/Server.cpp6
-rwxr-xr-xcpp/test/Glacier2/attack/run.py50
-rw-r--r--cpp/test/Glacier2/attack/test.py11
-rw-r--r--cpp/test/Glacier2/dynamicFiltering/Client.cpp10
-rw-r--r--cpp/test/Glacier2/dynamicFiltering/Server.cpp13
-rw-r--r--cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp27
-rw-r--r--cpp/test/Glacier2/dynamicFiltering/TestControllerI.h6
-rwxr-xr-xcpp/test/Glacier2/dynamicFiltering/run.py62
-rw-r--r--cpp/test/Glacier2/dynamicFiltering/test.py23
-rwxr-xr-xcpp/test/Glacier2/hashpassword/run.py111
-rw-r--r--cpp/test/Glacier2/hashpassword/test.py103
-rw-r--r--cpp/test/Glacier2/override/Client.cpp12
-rw-r--r--cpp/test/Glacier2/override/Server.cpp6
-rwxr-xr-xcpp/test/Glacier2/override/run.py66
-rw-r--r--cpp/test/Glacier2/override/test.py33
-rw-r--r--cpp/test/Glacier2/router/Client.cpp21
-rw-r--r--cpp/test/Glacier2/router/Server.cpp6
-rwxr-xr-xcpp/test/Glacier2/router/run.py86
-rw-r--r--cpp/test/Glacier2/sessionControl/Client.cpp8
-rw-r--r--cpp/test/Glacier2/sessionControl/Server.cpp6
-rw-r--r--cpp/test/Glacier2/sessionControl/SessionI.cpp6
-rwxr-xr-xcpp/test/Glacier2/sessionControl/run.py65
-rw-r--r--cpp/test/Glacier2/sessionControl/test.py20
-rw-r--r--cpp/test/Glacier2/sessionHelper/Client.cpp24
-rw-r--r--cpp/test/Glacier2/sessionHelper/Server.cpp9
-rwxr-xr-xcpp/test/Glacier2/sessionHelper/run.py48
-rw-r--r--cpp/test/Glacier2/ssl/Client.cpp10
-rw-r--r--cpp/test/Glacier2/ssl/Server.cpp31
-rwxr-xr-xcpp/test/Glacier2/ssl/run.py69
-rw-r--r--cpp/test/Glacier2/ssl/test.py29
-rw-r--r--cpp/test/Glacier2/staticFiltering/.gitignore2
-rw-r--r--cpp/test/Glacier2/staticFiltering/Client.cpp8
-rwxr-xr-xcpp/test/Glacier2/staticFiltering/run.py367
-rw-r--r--cpp/test/Glacier2/staticFiltering/test.py294
-rw-r--r--cpp/test/Ice/acm/Client.cpp3
-rw-r--r--cpp/test/Ice/acm/Server.cpp3
-rwxr-xr-xcpp/test/Ice/acm/run.py24
-rw-r--r--cpp/test/Ice/adapterDeactivation/AllTests.cpp16
-rw-r--r--cpp/test/Ice/adapterDeactivation/Client.cpp3
-rw-r--r--cpp/test/Ice/adapterDeactivation/Collocated.cpp3
-rw-r--r--cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp6
-rw-r--r--cpp/test/Ice/adapterDeactivation/Server.cpp3
-rw-r--r--cpp/test/Ice/adapterDeactivation/TestI.cpp6
-rwxr-xr-xcpp/test/Ice/adapterDeactivation/run.py25
-rw-r--r--cpp/test/Ice/admin/Client.cpp3
-rw-r--r--cpp/test/Ice/admin/Server.cpp3
-rwxr-xr-xcpp/test/Ice/admin/run.py24
-rw-r--r--cpp/test/Ice/ami/Client.cpp3
-rw-r--r--cpp/test/Ice/ami/Collocated.cpp3
-rw-r--r--cpp/test/Ice/ami/Server.cpp3
-rwxr-xr-xcpp/test/Ice/ami/run.py25
-rw-r--r--cpp/test/Ice/background/Client.cpp5
-rw-r--r--cpp/test/Ice/background/Server.cpp3
-rwxr-xr-xcpp/test/Ice/background/run.py25
-rw-r--r--cpp/test/Ice/binding/AllTests.cpp19
-rw-r--r--cpp/test/Ice/binding/Client.cpp3
-rw-r--r--cpp/test/Ice/binding/Server.cpp3
-rw-r--r--cpp/test/Ice/binding/TestI.cpp23
-rwxr-xr-xcpp/test/Ice/binding/run.py24
-rw-r--r--cpp/test/Ice/checksum/Client.cpp5
-rw-r--r--cpp/test/Ice/checksum/Server.cpp3
-rwxr-xr-xcpp/test/Ice/checksum/run.py24
-rw-r--r--cpp/test/Ice/custom/Client.cpp3
-rw-r--r--cpp/test/Ice/custom/Collocated.cpp3
-rw-r--r--cpp/test/Ice/custom/Server.cpp3
-rw-r--r--cpp/test/Ice/custom/ServerAMD.cpp3
-rwxr-xr-xcpp/test/Ice/custom/run.py27
-rw-r--r--cpp/test/Ice/custom/test.py12
-rw-r--r--cpp/test/Ice/defaultServant/Client.cpp3
-rwxr-xr-xcpp/test/Ice/defaultServant/run.py25
-rwxr-xr-xcpp/test/Ice/defaultValue/run.py24
-rw-r--r--cpp/test/Ice/dispatcher/Client.cpp3
-rw-r--r--cpp/test/Ice/dispatcher/Collocated.cpp3
-rw-r--r--cpp/test/Ice/dispatcher/Server.cpp3
-rwxr-xr-xcpp/test/Ice/dispatcher/run.py25
-rw-r--r--cpp/test/Ice/echo/Server.cpp3
-rwxr-xr-xcpp/test/Ice/echo/run.py29
-rw-r--r--cpp/test/Ice/echo/test.py15
-rw-r--r--cpp/test/Ice/enums/Client.cpp3
-rw-r--r--cpp/test/Ice/enums/Server.cpp3
-rwxr-xr-xcpp/test/Ice/enums/run.py28
-rw-r--r--cpp/test/Ice/exceptions/Client.cpp3
-rw-r--r--cpp/test/Ice/exceptions/Collocated.cpp3
-rw-r--r--cpp/test/Ice/exceptions/Server.cpp3
-rw-r--r--cpp/test/Ice/exceptions/ServerAMD.cpp3
-rwxr-xr-xcpp/test/Ice/exceptions/run.py50
-rw-r--r--cpp/test/Ice/facets/Client.cpp3
-rw-r--r--cpp/test/Ice/facets/Collocated.cpp3
-rw-r--r--cpp/test/Ice/facets/Server.cpp3
-rwxr-xr-xcpp/test/Ice/facets/run.py25
-rw-r--r--cpp/test/Ice/faultTolerance/AllTests.cpp4
-rw-r--r--cpp/test/Ice/faultTolerance/Client.cpp3
-rw-r--r--cpp/test/Ice/faultTolerance/Server.cpp6
-rwxr-xr-xcpp/test/Ice/faultTolerance/run.py48
-rwxr-xr-xcpp/test/Ice/gc/run.py23
-rw-r--r--cpp/test/Ice/gc/test.py11
-rwxr-xr-xcpp/test/Ice/hash/run.py25
-rw-r--r--cpp/test/Ice/hold/Client.cpp3
-rw-r--r--cpp/test/Ice/hold/Server.cpp3
-rwxr-xr-xcpp/test/Ice/hold/run.py24
-rw-r--r--cpp/test/Ice/impl/Server.cpp3
-rw-r--r--cpp/test/Ice/impl/ServerAMD.cpp3
-rw-r--r--cpp/test/Ice/info/AllTests.cpp28
-rw-r--r--cpp/test/Ice/info/Client.cpp3
-rw-r--r--cpp/test/Ice/info/Server.cpp6
-rwxr-xr-xcpp/test/Ice/info/run.py24
-rw-r--r--cpp/test/Ice/inheritance/Client.cpp3
-rw-r--r--cpp/test/Ice/inheritance/Collocated.cpp3
-rw-r--r--cpp/test/Ice/inheritance/Server.cpp3
-rwxr-xr-xcpp/test/Ice/inheritance/run.py25
-rw-r--r--cpp/test/Ice/interceptor/Client.cpp3
-rwxr-xr-xcpp/test/Ice/interceptor/run.py26
-rw-r--r--cpp/test/Ice/invoke/Client.cpp3
-rw-r--r--cpp/test/Ice/invoke/Server.cpp3
-rwxr-xr-xcpp/test/Ice/invoke/run.py31
-rw-r--r--cpp/test/Ice/library/Client.cpp3
-rw-r--r--cpp/test/Ice/library/run.py29
-rw-r--r--cpp/test/Ice/library/test.py10
-rw-r--r--cpp/test/Ice/location/Client.cpp5
-rw-r--r--cpp/test/Ice/location/Server.cpp6
-rw-r--r--cpp/test/Ice/location/TestI.cpp24
-rwxr-xr-xcpp/test/Ice/location/run.py24
-rwxr-xr-xcpp/test/Ice/logger/run.py147
-rw-r--r--cpp/test/Ice/metrics/AllTests.cpp108
-rw-r--r--cpp/test/Ice/metrics/Client.cpp4
-rw-r--r--cpp/test/Ice/metrics/Collocated.cpp8
-rw-r--r--cpp/test/Ice/metrics/Server.cpp8
-rw-r--r--cpp/test/Ice/metrics/ServerAMD.cpp13
-rwxr-xr-xcpp/test/Ice/metrics/run.py27
-rw-r--r--cpp/test/Ice/networkProxy/AllTests.cpp10
-rw-r--r--cpp/test/Ice/networkProxy/Client.cpp6
-rw-r--r--cpp/test/Ice/networkProxy/Server.cpp5
-rwxr-xr-xcpp/test/Ice/networkProxy/run.py45
-rw-r--r--cpp/test/Ice/objects/Client.cpp5
-rw-r--r--cpp/test/Ice/objects/Collocated.cpp3
-rw-r--r--cpp/test/Ice/objects/Server.cpp3
-rwxr-xr-xcpp/test/Ice/objects/run.py34
-rw-r--r--cpp/test/Ice/operations/Client.cpp3
-rw-r--r--cpp/test/Ice/operations/Collocated.cpp3
-rw-r--r--cpp/test/Ice/operations/Server.cpp3
-rw-r--r--cpp/test/Ice/operations/ServerAMD.cpp3
-rw-r--r--cpp/test/Ice/operations/TwowaysAMI.cpp4
-rwxr-xr-xcpp/test/Ice/operations/run.py28
-rw-r--r--cpp/test/Ice/optional/Client.cpp3
-rw-r--r--cpp/test/Ice/optional/Server.cpp3
-rw-r--r--cpp/test/Ice/optional/ServerAMD.cpp3
-rwxr-xr-xcpp/test/Ice/optional/run.py29
-rw-r--r--cpp/test/Ice/plugin/Client.cpp34
-rwxr-xr-xcpp/test/Ice/plugin/run.py25
-rw-r--r--cpp/test/Ice/plugin/test.py12
-rwxr-xr-xcpp/test/Ice/properties/run.py55
-rw-r--r--cpp/test/Ice/proxy/AllTests.cpp21
-rw-r--r--cpp/test/Ice/proxy/Client.cpp3
-rw-r--r--cpp/test/Ice/proxy/Collocated.cpp3
-rw-r--r--cpp/test/Ice/proxy/Server.cpp4
-rw-r--r--cpp/test/Ice/proxy/ServerAMD.cpp3
-rwxr-xr-xcpp/test/Ice/proxy/run.py27
-rw-r--r--cpp/test/Ice/retry/Client.cpp3
-rw-r--r--cpp/test/Ice/retry/Collocated.cpp3
-rw-r--r--cpp/test/Ice/retry/Server.cpp3
-rwxr-xr-xcpp/test/Ice/retry/run.py25
-rw-r--r--cpp/test/Ice/servantLocator/Client.cpp3
-rw-r--r--cpp/test/Ice/servantLocator/Collocated.cpp3
-rw-r--r--cpp/test/Ice/servantLocator/Server.cpp3
-rw-r--r--cpp/test/Ice/servantLocator/ServerAMD.cpp3
-rwxr-xr-xcpp/test/Ice/servantLocator/run.py27
-rw-r--r--cpp/test/Ice/services/AllTests.cpp2
-rw-r--r--cpp/test/Ice/services/Client.cpp3
-rwxr-xr-xcpp/test/Ice/services/run.py24
-rw-r--r--cpp/test/Ice/slicing/exceptions/Client.cpp3
-rw-r--r--cpp/test/Ice/slicing/exceptions/Server.cpp3
-rw-r--r--cpp/test/Ice/slicing/exceptions/ServerAMD.cpp3
-rwxr-xr-xcpp/test/Ice/slicing/exceptions/run.py37
-rw-r--r--cpp/test/Ice/slicing/objects/Client.cpp3
-rw-r--r--cpp/test/Ice/slicing/objects/Server.cpp3
-rw-r--r--cpp/test/Ice/slicing/objects/ServerAMD.cpp3
-rwxr-xr-xcpp/test/Ice/slicing/objects/run.py37
-rw-r--r--cpp/test/Ice/stream/Client.cpp3
-rwxr-xr-xcpp/test/Ice/stream/run.py29
-rw-r--r--cpp/test/Ice/stringConverter/Client.cpp3
-rw-r--r--cpp/test/Ice/stringConverter/Server.cpp3
-rwxr-xr-xcpp/test/Ice/stringConverter/run.py24
-rw-r--r--cpp/test/Ice/threadPoolPriority/Client.cpp3
-rw-r--r--cpp/test/Ice/threadPoolPriority/Server.cpp3
-rw-r--r--cpp/test/Ice/threadPoolPriority/ServerCustomThreadPool.cpp3
-rwxr-xr-xcpp/test/Ice/threadPoolPriority/run.py26
-rw-r--r--cpp/test/Ice/threadPoolPriority/test.py14
-rw-r--r--cpp/test/Ice/timeout/Client.cpp3
-rw-r--r--cpp/test/Ice/timeout/Server.cpp3
-rwxr-xr-xcpp/test/Ice/timeout/run.py24
-rw-r--r--cpp/test/Ice/udp/AllTests.cpp16
-rw-r--r--cpp/test/Ice/udp/Client.cpp5
-rw-r--r--cpp/test/Ice/udp/Server.cpp9
-rwxr-xr-xcpp/test/Ice/udp/run.py52
-rw-r--r--cpp/test/IceBox/admin/Client.cpp3
-rwxr-xr-xcpp/test/IceBox/admin/run.py45
-rw-r--r--cpp/test/IceBox/configuration/AllTests.cpp10
-rw-r--r--cpp/test/IceBox/configuration/Client.cpp3
-rw-r--r--cpp/test/IceBox/configuration/config.service12
-rw-r--r--cpp/test/IceBox/configuration/config.service1-22
-rw-r--r--cpp/test/IceBox/configuration/config.service22
-rw-r--r--cpp/test/IceBox/configuration/config.service2-22
-rw-r--r--cpp/test/IceBox/configuration/config.service32
-rw-r--r--cpp/test/IceBox/configuration/config.service42
-rwxr-xr-xcpp/test/IceBox/configuration/run.py30
-rw-r--r--cpp/test/IceDiscovery/simple/AllTests.cpp2
-rw-r--r--cpp/test/IceDiscovery/simple/Client.cpp3
-rw-r--r--cpp/test/IceDiscovery/simple/Server.cpp6
-rwxr-xr-xcpp/test/IceDiscovery/simple/run.py52
-rw-r--r--cpp/test/IceGrid/activation/Client.cpp3
-rwxr-xr-xcpp/test/IceGrid/activation/run.py27
-rw-r--r--cpp/test/IceGrid/activation/test.py11
-rwxr-xr-xcpp/test/IceGrid/admin/run.py262
-rw-r--r--cpp/test/IceGrid/admin/test.py167
-rw-r--r--cpp/test/IceGrid/allocation/Client.cpp5
-rwxr-xr-xcpp/test/IceGrid/allocation/run.py24
-rw-r--r--cpp/test/IceGrid/allocation/test.py11
-rw-r--r--cpp/test/IceGrid/deployer/Client.cpp3
-rwxr-xr-xcpp/test/IceGrid/deployer/run.py32
-rw-r--r--cpp/test/IceGrid/deployer/test.py21
-rw-r--r--cpp/test/IceGrid/distribution/Client.cpp5
-rwxr-xr-xcpp/test/IceGrid/distribution/run.py64
-rw-r--r--cpp/test/IceGrid/distribution/test.py45
-rwxr-xr-xcpp/test/IceGrid/fileLock/run.py58
-rw-r--r--cpp/test/IceGrid/fileLock/test.py23
-rw-r--r--cpp/test/IceGrid/noRestartUpdate/Client.cpp5
-rwxr-xr-xcpp/test/IceGrid/noRestartUpdate/run.py44
-rw-r--r--cpp/test/IceGrid/noRestartUpdate/test.py26
-rw-r--r--cpp/test/IceGrid/replicaGroup/Client.cpp3
-rwxr-xr-xcpp/test/IceGrid/replicaGroup/run.py39
-rw-r--r--cpp/test/IceGrid/replicaGroup/test.py24
-rw-r--r--cpp/test/IceGrid/replication/Client.cpp3
-rwxr-xr-xcpp/test/IceGrid/replication/run.py30
-rw-r--r--cpp/test/IceGrid/replication/test.py16
-rw-r--r--cpp/test/IceGrid/session/Client.cpp3
-rw-r--r--cpp/test/IceGrid/session/PermissionsVerifier.cpp13
-rwxr-xr-xcpp/test/IceGrid/session/run.py74
-rw-r--r--cpp/test/IceGrid/session/test.py60
-rw-r--r--cpp/test/IceGrid/simple/AllTests.cpp8
-rw-r--r--cpp/test/IceGrid/simple/Client.cpp5
-rw-r--r--cpp/test/IceGrid/simple/application.xml (renamed from cpp/test/IceGrid/simple/simple_server.xml)0
-rwxr-xr-xcpp/test/IceGrid/simple/run.py36
-rw-r--r--cpp/test/IceGrid/update/Client.cpp5
-rwxr-xr-xcpp/test/IceGrid/update/run.py45
-rw-r--r--cpp/test/IceGrid/update/test.py25
-rw-r--r--cpp/test/IceSSL/configuration/AllTests.cpp2
-rw-r--r--cpp/test/IceSSL/configuration/Client.cpp3
-rw-r--r--cpp/test/IceSSL/configuration/Server.cpp5
-rwxr-xr-xcpp/test/IceSSL/configuration/run.py56
-rw-r--r--cpp/test/IceStorm/federation/0.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/federation/1.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/federation/2.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/federation/Publisher.cpp11
-rw-r--r--cpp/test/IceStorm/federation/Subscriber.cpp4
-rwxr-xr-xcpp/test/IceStorm/federation/run.py96
-rw-r--r--cpp/test/IceStorm/federation/test.py39
-rw-r--r--cpp/test/IceStorm/federation2/0.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/federation2/Publisher.cpp9
-rw-r--r--cpp/test/IceStorm/federation2/Subscriber.cpp4
-rwxr-xr-xcpp/test/IceStorm/federation2/run.py275
-rw-r--r--cpp/test/IceStorm/federation2/test.py196
-rw-r--r--cpp/test/IceStorm/rep1/Publisher.cpp5
-rw-r--r--cpp/test/IceStorm/rep1/Sub.cpp4
-rw-r--r--cpp/test/IceStorm/rep1/Subscriber.cpp4
-rwxr-xr-xcpp/test/IceStorm/rep1/run.py292
-rw-r--r--cpp/test/IceStorm/rep1/test.py290
-rw-r--r--cpp/test/IceStorm/repgrid/Client.cpp4
-rwxr-xr-xcpp/test/IceStorm/repgrid/run.py42
-rw-r--r--cpp/test/IceStorm/repgrid/test.py13
-rw-r--r--cpp/test/IceStorm/repstress/Control.cpp5
-rw-r--r--cpp/test/IceStorm/repstress/Publisher.cpp9
-rw-r--r--cpp/test/IceStorm/repstress/Subscriber.cpp4
-rwxr-xr-xcpp/test/IceStorm/repstress/run.py125
-rw-r--r--cpp/test/IceStorm/repstress/test.py113
-rw-r--r--cpp/test/IceStorm/single/0.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/single/1.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/single/2.db/.gitignore1
-rw-r--r--cpp/test/IceStorm/single/Publisher.cpp4
-rw-r--r--cpp/test/IceStorm/single/Subscriber.cpp3
-rw-r--r--cpp/test/IceStorm/single/db/.gitignore1
-rwxr-xr-xcpp/test/IceStorm/single/run.py89
-rw-r--r--cpp/test/IceStorm/single/test.py39
-rw-r--r--cpp/test/IceStorm/stress/Publisher.cpp5
-rw-r--r--cpp/test/IceStorm/stress/Subscriber.cpp4
-rwxr-xr-xcpp/test/IceStorm/stress/run.py204
-rw-r--r--cpp/test/IceStorm/stress/test.py155
-rwxr-xr-xcpp/test/IceUtil/condvar/run.py33
-rw-r--r--cpp/test/IceUtil/ctrlCHandler/test.py10
-rwxr-xr-xcpp/test/IceUtil/inputUtil/run.py24
-rwxr-xr-xcpp/test/IceUtil/priority/run.py25
-rw-r--r--cpp/test/IceUtil/priority/test.py11
-rwxr-xr-xcpp/test/IceUtil/sha1/run.py24
-rwxr-xr-xcpp/test/IceUtil/stacktrace/run.py24
-rw-r--r--cpp/test/IceUtil/stacktrace/test.py11
-rwxr-xr-xcpp/test/IceUtil/thread/run.py25
-rwxr-xr-xcpp/test/IceUtil/timer/run.py24
-rwxr-xr-xcpp/test/IceUtil/unicode/run.py25
-rw-r--r--cpp/test/IceUtil/unicode/test.py11
-rwxr-xr-xcpp/test/IceUtil/uuid/run.py24
-rwxr-xr-xcpp/test/Slice/errorDetection/run.py69
-rw-r--r--cpp/test/Slice/errorDetection/test.py49
-rwxr-xr-xcpp/test/Slice/headers/run.py156
-rw-r--r--cpp/test/Slice/headers/test.py154
-rw-r--r--cpp/test/Slice/keyword/Client.cpp2
-rwxr-xr-xcpp/test/Slice/keyword/run.py24
-rwxr-xr-xcpp/test/Slice/macros/run.py24
-rwxr-xr-xcpp/test/Slice/structure/run.py24
-rw-r--r--cpp/test/Slice/unicodePaths/run.py82
-rw-r--r--cpp/test/Slice/unicodePaths/test.py71
-rw-r--r--cpp/test/include/TestCommon.h8
312 files changed, 2772 insertions, 5512 deletions
diff --git a/cpp/test/Common/TestCommon.cpp b/cpp/test/Common/TestCommon.cpp
index c0ebd57c449..e869c7fd0f4 100644
--- a/cpp/test/Common/TestCommon.cpp
+++ b/cpp/test/Common/TestCommon.cpp
@@ -13,15 +13,23 @@
#include <Ice/Communicator.h>
std::string
-getTestEndpoint(const Ice::CommunicatorPtr& communicator, int num, const std::string prot)
+getTestEndpoint(const Ice::CommunicatorPtr& communicator, int num, const std::string& protocol)
+{
+ return getTestEndpoint(communicator->getProperties(), num, protocol);
+}
+
+std::string
+getTestEndpoint(const Ice::PropertiesPtr& properties, int num, const std::string& prot)
{
std::ostringstream ostr;
std::string protocol = prot;
if(protocol.empty())
{
- protocol = communicator->getProperties()->getPropertyWithDefault("Ice.Default.Protocol", "default");
+ protocol = properties->getPropertyWithDefault("Ice.Default.Protocol", "default");
}
+ int basePort = properties->getPropertyAsIntWithDefault("Test.BasePort", 12010);
+
if(protocol == "bt")
{
//
@@ -45,11 +53,40 @@ getTestEndpoint(const Ice::CommunicatorPtr& communicator, int num, const std::st
}
else
{
- ostr << protocol << " -p " << (12010 + num);
+ ostr << protocol << " -p " << (basePort + num);
}
return ostr.str();
}
+std::string
+getTestHost(const Ice::PropertiesPtr& properties)
+{
+ return properties->getPropertyWithDefault("Ice.Default.Host", "127.0.0.1");
+}
+
+std::string
+getTestProtocol(const Ice::PropertiesPtr& properties)
+{
+ return properties->getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+}
+
+int
+getTestPort(const Ice::PropertiesPtr& properties, int num)
+{
+ return properties->getPropertyAsIntWithDefault("Test.BasePort", 12010) + num;
+}
+
+Ice::InitializationData
+getTestInitData(int& argc, char* argv[])
+{
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
+ Ice::StringSeq args = Ice::argsToStringSeq(argc, argv);
+ args = initData.properties->parseCommandLineOptions("Test", args);
+ Ice::stringSeqToArgs(args, argc, argv);
+ return initData;
+}
+
RemoteConfig::RemoteConfig(const std::string& name, int argc, char** argv, const Ice::CommunicatorPtr& communicator) :
_status(1)
{
diff --git a/cpp/test/Glacier2/attack/Client.cpp b/cpp/test/Glacier2/attack/Client.cpp
index b028a45e4a3..69022d72a15 100644
--- a/cpp/test/Glacier2/attack/Client.cpp
+++ b/cpp/test/Glacier2/attack/Client.cpp
@@ -32,8 +32,7 @@ main(int argc, char* argv[])
Ice::registerIceSSL();
#endif
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// We want to check whether the client retries for evicted
@@ -49,7 +48,7 @@ int
AttackClient::run(int, char**)
{
cout << "getting router... " << flush;
- ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347");
+ ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10));
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
test(router);
communicator()->setDefaultRouter(router);
@@ -60,7 +59,7 @@ AttackClient::run(int, char**)
cout << "ok" << endl;
cout << "making thousands of invocations on proxies... " << flush;
- ObjectPrx backendBase = communicator()->stringToProxy("dummy:tcp -p 12010");
+ ObjectPrx backendBase = communicator()->stringToProxy("dummy:" + getTestEndpoint(communicator(), 0));
BackendPrx backend = BackendPrx::uncheckedCast(backendBase);
backend->ice_ping();
@@ -118,7 +117,8 @@ AttackClient::run(int, char**)
cout << "testing server and router shutdown... " << flush;
backend->shutdown();
communicator()->setDefaultRouter(0);
- ObjectPrx adminBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348");
+ ObjectPrx adminBase = communicator()->stringToProxy("Glacier2/admin -f Process:" +
+ getTestEndpoint(communicator(), 11, "tcp"));
Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(adminBase);
test(process);
process->shutdown();
diff --git a/cpp/test/Glacier2/attack/Server.cpp b/cpp/test/Glacier2/attack/Server.cpp
index 04db46171ac..89df9f0a9bb 100644
--- a/cpp/test/Glacier2/attack/Server.cpp
+++ b/cpp/test/Glacier2/attack/Server.cpp
@@ -8,6 +8,7 @@
// **********************************************************************
#include <Ice/Application.h>
+#include <TestCommon.h>
#include <BackendI.h>
using namespace std;
@@ -56,13 +57,14 @@ main(int argc, char* argv[])
#endif
BackendServer app;
- return app.main(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ return app.main(argc, argv, initData);
}
int
BackendServer::run(int, char**)
{
- communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", "tcp -p 12010");
+ communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", getTestEndpoint(communicator(), 0));
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("BackendAdapter");
adapter->addServantLocator(new ServantLocatorI, "");
adapter->activate();
diff --git a/cpp/test/Glacier2/attack/run.py b/cpp/test/Glacier2/attack/run.py
deleted file mode 100755
index dc2b17c162d..00000000000
--- a/cpp/test/Glacier2/attack/run.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-testdir = os.getcwd()
-router = TestUtil.getGlacier2Router()
-
-if TestUtil.appverifier:
- TestUtil.setAppVerifierSettings([router])
-
-#
-# Generate the crypt passwords file
-#
-TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"})
-
-args = ' --Glacier2.RoutingTable.MaxSize=10' + \
- ' --Glacier2.Client.Endpoints="default -p 12347"' + \
- ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \
- ' --Ice.Admin.InstanceName=Glacier2' + \
- ' --Glacier2.CryptPasswords="' + os.path.join(testdir, "passwords") + '"'
-
-sys.stdout.write("starting router... ")
-sys.stdout.flush()
-starterProc = TestUtil.startServer(router, args, count=2)
-print("ok")
-
-TestUtil.clientServerTest()
-
-starterProc.waitTestSuccess()
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd([router])
diff --git a/cpp/test/Glacier2/attack/test.py b/cpp/test/Glacier2/attack/test.py
new file mode 100644
index 00000000000..b499394b559
--- /dev/null
+++ b/cpp/test/Glacier2/attack/test.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+Glacier2TestSuite(__name__, routerProps = { "Glacier2.RoutingTable.MaxSize" : 10 })
diff --git a/cpp/test/Glacier2/dynamicFiltering/Client.cpp b/cpp/test/Glacier2/dynamicFiltering/Client.cpp
index 4941dea7c5f..e29d7afacf5 100644
--- a/cpp/test/Glacier2/dynamicFiltering/Client.cpp
+++ b/cpp/test/Glacier2/dynamicFiltering/Client.cpp
@@ -32,8 +32,7 @@ main(int argc, char* argv[])
SessionControlClient app;
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// We want to check whether the client retries for evicted
@@ -57,7 +56,7 @@ SessionControlClient::run(int argc, char* argv[])
initData.properties = communicator()->getProperties();
Ice::CommunicatorPtr controlComm = Ice::initialize(argc, argv, initData);
TestControllerPrx controller = TestControllerPrx::checkedCast(
- controlComm->stringToProxy("testController:tcp -p 12013"));
+ controlComm->stringToProxy("testController:" + getTestEndpoint(communicator(), 2, "tcp")));
test(controller);
TestToken currentState;
TestToken newState;
@@ -70,7 +69,7 @@ SessionControlClient::run(int argc, char* argv[])
cout << "ok" << endl;
cout << "getting router... " << flush;
- ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347");
+ ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10));
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
test(router);
communicator()->setDefaultRouter(router);
@@ -164,7 +163,8 @@ SessionControlClient::run(int argc, char* argv[])
// Shut down the router.
//
communicator()->setDefaultRouter(0);
- ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -p 12348");
+ ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" +
+ getTestEndpoint(communicator(), 11, "tcp"));
Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(processBase);
test(process);
process->shutdown();
diff --git a/cpp/test/Glacier2/dynamicFiltering/Server.cpp b/cpp/test/Glacier2/dynamicFiltering/Server.cpp
index 82fc03b1598..883778ca047 100644
--- a/cpp/test/Glacier2/dynamicFiltering/Server.cpp
+++ b/cpp/test/Glacier2/dynamicFiltering/Server.cpp
@@ -10,6 +10,7 @@
#include <Ice/Application.h>
#include <Ice/Locator.h>
#include <Glacier2/PermissionsVerifier.h>
+#include <TestCommon.h>
#include <TestControllerI.h>
#include <SessionI.h>
#include <BackendI.h>
@@ -126,7 +127,8 @@ main(int argc, char* argv[])
#endif
SessionControlServer app;
- return app.main(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ return app.main(argc, argv, initData);
}
int
@@ -143,19 +145,20 @@ SessionControlServer::run(int, char*[])
// servant, allowing us to use any reference as long as the client
// expects to use a proxy for the correct type of object.
//
- communicator()->getProperties()->setProperty("TestControllerAdapter.Endpoints", "tcp -p 12013");
+ communicator()->getProperties()->setProperty("TestControllerAdapter.Endpoints",
+ getTestEndpoint(communicator(), 2, "tcp"));
ObjectAdapterPtr controllerAdapter = communicator()->createObjectAdapter("TestControllerAdapter");
- TestControllerIPtr controller = new TestControllerI;
+ TestControllerIPtr controller = new TestControllerI(getTestEndpoint(communicator(), 1));
controllerAdapter->add(controller, Ice::stringToIdentity("testController"));
controllerAdapter->activate();
- communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", "tcp -p 12010");
+ communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", getTestEndpoint(communicator(), 0));
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("SessionControlAdapter");
adapter->add(new SessionManagerI(controller), Ice::stringToIdentity("SessionManager"));
adapter->activate();
BackendPtr backend = new BackendI;
- communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", "default -p 12012");
+ communicator()->getProperties()->setProperty("BackendAdapter.Endpoints", getTestEndpoint(communicator(), 1));
ObjectAdapterPtr backendAdapter = communicator()->createObjectAdapter("BackendAdapter");
backendAdapter->addServantLocator(new ServantLocatorI(backend), "");
backendAdapter->activate();
diff --git a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp
index 6f2cf003845..10b93a5c397 100644
--- a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp
+++ b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp
@@ -9,6 +9,7 @@
#include <Ice/Ice.h>
#include <TestControllerI.h>
+#include <TestCommon.h>
#include <vector>
#include <string>
@@ -20,23 +21,23 @@ using namespace std;
// TODO: More test cases.
//
-TestControllerI::TestControllerI()
+TestControllerI::TestControllerI(const string& endpoint)
{
TestConfiguration current;
current.description = "No filters at all";
- current.cases.push_back(TestCase("foo/bar:default -p 12012", true));
+ current.cases.push_back(TestCase("foo/bar:" + endpoint, true));
_configurations.push_back(current);
current = TestConfiguration();
current.description = "Category filter";
- current.cases.push_back(TestCase("foo/barA:default -p 12012", true));
- current.cases.push_back(TestCase("bar/fooA:default -p 12012", false));
- current.cases.push_back(TestCase("\"a cat with spaces/fooX\":default -p 12012", true));
+ current.cases.push_back(TestCase("foo/barA:" + endpoint, true));
+ current.cases.push_back(TestCase("bar/fooA:" + endpoint, false));
+ current.cases.push_back(TestCase("\"a cat with spaces/fooX\":" + endpoint, true));
current.categoryFiltersAccept.push_back("foo");
current.categoryFiltersAccept.push_back("a cat with spaces");
_configurations.push_back(current);
-
+
current = TestConfiguration();
current.description = "Adapter id filter";
current.cases.push_back(TestCase("fooB @ bar", true));
@@ -46,8 +47,8 @@ TestControllerI::TestControllerI()
current = TestConfiguration();
current.description = "Object id filter";
- current.cases.push_back(TestCase("foo/barC:default -p 12012", true));
- current.cases.push_back(TestCase("bar/fooC:default -p 12012", false));
+ current.cases.push_back(TestCase("foo/barC:" + endpoint, true));
+ current.cases.push_back(TestCase("bar/fooC:" + endpoint, false));
Identity id;
id.category = "foo";
id.name = "barC";
@@ -66,13 +67,13 @@ TestControllerI::step(const Glacier2::SessionPrx& currentSession, const TestToke
assert("TestController::step() shouldn't have been called with a state of Finished" == 0);
break;
}
-
+
case Test::Running:
{
TestConfiguration& config = _configurations[currentState.config];
assert(!config.description.empty());
-
+
bool found = false;
SessionTuple session;
for(vector<SessionTuple>::const_iterator i = _sessions.begin(); i != _sessions.end() && !found; ++i)
@@ -95,7 +96,7 @@ TestControllerI::step(const Glacier2::SessionPrx& currentSession, const TestToke
// We start with the previous known state.
//
newState = currentState;
-
+
++newState.caseIndex;
if(!(newState.caseIndex < (long)config.cases.size()))
{
@@ -134,14 +135,14 @@ TestControllerI::step(const Glacier2::SessionPrx& currentSession, const TestToke
Glacier2::StringSetPrx adapterIds = session.sessionControl->adapterIds();
adapterIds->add(config.adapterIdFiltersAccept);
-
+
Glacier2::IdentitySetPrx ids = session.sessionControl->identities();
ids->add(config.objectIdFiltersAccept);
session.configured = true;
}
break;
}
-
+
default:
{
newState.code = Running;
diff --git a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h
index 7e21639a8d9..75b07c22c66 100644
--- a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h
+++ b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h
@@ -54,7 +54,7 @@ struct TestCase
std::string proxy;
bool expectedResult;
- TestCase(const char* s, const bool b) : proxy(s), expectedResult(b) {}
+ TestCase(const std::string& s, const bool b) : proxy(s), expectedResult(b) {}
};
struct TestConfiguration
@@ -74,7 +74,7 @@ struct TestConfiguration
class TestControllerI : public Test::TestController
{
public:
- TestControllerI();
+ TestControllerI(const std::string&);
//
// Slice to C++ mapping.
//
@@ -93,7 +93,7 @@ public:
private:
std::vector<SessionTuple> _sessions;
std::vector<TestConfiguration> _configurations;
-
+
};
typedef IceUtil::Handle<TestControllerI> TestControllerIPtr;
diff --git a/cpp/test/Glacier2/dynamicFiltering/run.py b/cpp/test/Glacier2/dynamicFiltering/run.py
deleted file mode 100755
index 81e4b7a753d..00000000000
--- a/cpp/test/Glacier2/dynamicFiltering/run.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server"))
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-router = os.path.join(TestUtil.getGlacier2Router())
-
-targets = []
-if TestUtil.appverifier:
- targets = [server, client, router]
- TestUtil.setAppVerifierSettings(targets)
-
-
-sys.stdout.write("starting server... ")
-sys.stdout.flush()
-serverProc = TestUtil.startServer(server, count=3)
-print("ok")
-
-args = r' --Glacier2.Client.Endpoints="default -p 12347"' + \
- r' --Ice.Admin.Endpoints="tcp -p 12348"' + \
- r' --Ice.Admin.InstanceName=Glacier2' + \
- r' --Glacier2.Server.Endpoints="default -p 12349"' + \
- r' --Glacier2.SessionManager="SessionManager:tcp -p 12010"' + \
- r' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"' + \
- r' --Ice.Default.Locator="locator:default -p 12012"'
-
-sys.stdout.write("starting router... ")
-sys.stdout.flush()
-starterProc = TestUtil.startServer(router, args, count=2)
-print("ok")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-proc = TestUtil.startClient(client, startReader = False)
-print("ok")
-proc.startReader()
-proc.waitTestSuccess()
-
-serverProc.waitTestSuccess()
-starterProc.waitTestSuccess()
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets)
diff --git a/cpp/test/Glacier2/dynamicFiltering/test.py b/cpp/test/Glacier2/dynamicFiltering/test.py
new file mode 100644
index 00000000000..cbf251816ae
--- /dev/null
+++ b/cpp/test/Glacier2/dynamicFiltering/test.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# Note: we limit the send buffer size with Ice.TCP.SndSize, the
+# test relies on send() blocking
+#
+routerProps = lambda process, current : {
+ 'Glacier2.SessionManager' : 'SessionManager:{0}'.format(current.getTestEndpoint(0)),
+ 'Glacier2.PermissionsVerifier' : 'Glacier2/NullPermissionsVerifier',
+ 'Ice.Default.Locator' : 'locator:{0}'.format(current.getTestEndpoint(1)),
+}
+
+Glacier2TestSuite(__name__,
+ testcases=[ClientServerTestCase(servers=[Glacier2Router(props=routerProps, passwords=None),
+ Server(readyCount=3)])])
diff --git a/cpp/test/Glacier2/hashpassword/run.py b/cpp/test/Glacier2/hashpassword/run.py
deleted file mode 100755
index 7abe7831eec..00000000000
--- a/cpp/test/Glacier2/hashpassword/run.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, passlib.hash, subprocess
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-hashpassword = os.path.join(path[0], "scripts", "icehashpassword.py")
-
-def test(b):
- if not b:
- raise RuntimeError('test assertion failed')
-
-def hashPasswords(password, args = ""):
- p = subprocess.Popen('%s "%s" %s' % (sys.executable, hashpassword, args), shell=True, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
- p.stdin.write(password.encode('UTF-8'))
- p.stdin.write('\r\n'.encode('UTF-8'))
- p.stdin.flush()
- if(p.wait() != 0):
- print("icehashpassword.py failed:\n" + p.stdout.read().decode('UTF-8').strip())
- sys.exit(1)
- hash = p.stdout.readline().decode('UTF-8').strip()
- return hash
-
-
-usePBKDF2 = sys.platform == "win32" or sys.platform == "darwin"
-useCryptExt = sys.platform.startswith("linux")
-
-if usePBKDF2:
-
- sys.stdout.write("Testing PBKDF2 crypt passwords...")
- sys.stdout.flush()
-
- test(passlib.hash.pbkdf2_sha256.verify("abc123", hashPasswords("abc123")))
- test(not passlib.hash.pbkdf2_sha256.verify("abc123", hashPasswords("abc")))
-
- test(passlib.hash.pbkdf2_sha1.verify("abc123", hashPasswords("abc123", "-d sha1")))
- test(not passlib.hash.pbkdf2_sha1.verify("abc123", hashPasswords("abc", "-d sha1")))
-
- test(passlib.hash.pbkdf2_sha512.verify("abc123", hashPasswords("abc123", "-d sha512")))
- test(not passlib.hash.pbkdf2_sha512.verify("abc123", hashPasswords("abc", "-d sha512")))
-
- #
- # Now use custom rounds
- #
- hash = hashPasswords("abc123", "-r 1000")
- if hash.find("$pbkdf2-sha256$1000$") == -1:
- test(False)
- test(passlib.hash.pbkdf2_sha256.verify("abc123", hash))
-
- hash = hashPasswords("abc123", "-r 1000 -d sha1")
- if hash.find("$pbkdf2$1000$") == -1:
- test(False)
- test(passlib.hash.pbkdf2_sha1.verify("abc123", hash))
-
- hash = hashPasswords("abc123", "-r 1000 -d sha512")
- if hash.find("$pbkdf2-sha512$1000$") == -1:
- test(False)
- test(passlib.hash.pbkdf2_sha512.verify("abc123", hash))
-
- print("ok")
-
-elif useCryptExt:
-
- sys.stdout.write("Testing Linux crypt passwords...")
- sys.stdout.flush()
-
- test(passlib.hash.sha512_crypt.verify("abc123", hashPasswords("abc123")))
- test(not passlib.hash.sha512_crypt.verify("abc123", hashPasswords("abc")))
-
- test(passlib.hash.sha256_crypt.verify("abc123", hashPasswords("abc123", "-d sha256")))
- test(not passlib.hash.sha256_crypt.verify("abc123", hashPasswords("abc", "-d sha256")))
-
- #
- # Now use custom rounds
- #
- hash = hashPasswords("abc123", "-r 5000")
- if hash.find("rounds=") != -1:
- test(False)
- test(passlib.hash.sha512_crypt.verify("abc123", hash))
- hash = hashPasswords("abc123", "-d sha256 -r 5000")
- if hash.find("rounds=") != -1:
- test(False)
- test(passlib.hash.sha256_crypt.verify("abc123", hash))
-
- hash = hashPasswords("abc123", "-r 10000")
- if hash.find("$rounds=10000$") == -1:
- test(False)
- test(passlib.hash.sha512_crypt.verify("abc123", hash))
- hash = hashPasswords("abc123", "-d sha256 -r 10000")
- if hash.find("$rounds=10000$") == -1:
- test(False)
- test(passlib.hash.sha256_crypt.verify("abc123", hash))
-
- print("ok")
diff --git a/cpp/test/Glacier2/hashpassword/test.py b/cpp/test/Glacier2/hashpassword/test.py
new file mode 100644
index 00000000000..7560276a141
--- /dev/null
+++ b/cpp/test/Glacier2/hashpassword/test.py
@@ -0,0 +1,103 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class Glacier2HashPasswordTestCase(ClientTestCase):
+
+ def runClientSide(self, current):
+
+ import passlib.hash
+
+ hashpassword = os.path.join(toplevel, "scripts", "icehashpassword.py")
+
+ def test(b):
+ if not b:
+ raise RuntimeError('test assertion failed')
+
+ def hashPasswords(password, args = ""):
+ p = subprocess.Popen('%s "%s" %s' % (sys.executable, hashpassword, args), shell=True, stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
+ p.stdin.write(password.encode('UTF-8'))
+ p.stdin.write('\r\n'.encode('UTF-8'))
+ p.stdin.flush()
+ if(p.wait() != 0):
+ raise RuntimeError("icehashpassword.py failed:\n" + p.stdout.read().decode('UTF-8').strip())
+ hash = p.stdout.readline().decode('UTF-8').strip()
+ return hash
+
+ usePBKDF2 = sys.platform == "win32" or sys.platform == "darwin"
+ useCryptExt = sys.platform.startswith("linux")
+
+ if usePBKDF2:
+
+ current.write("Testing PBKDF2 crypt passwords...")
+
+ test(passlib.hash.pbkdf2_sha256.verify("abc123", hashPasswords("abc123")))
+ test(not passlib.hash.pbkdf2_sha256.verify("abc123", hashPasswords("abc")))
+
+ test(passlib.hash.pbkdf2_sha1.verify("abc123", hashPasswords("abc123", "-d sha1")))
+ test(not passlib.hash.pbkdf2_sha1.verify("abc123", hashPasswords("abc", "-d sha1")))
+
+ test(passlib.hash.pbkdf2_sha512.verify("abc123", hashPasswords("abc123", "-d sha512")))
+ test(not passlib.hash.pbkdf2_sha512.verify("abc123", hashPasswords("abc", "-d sha512")))
+
+ #
+ # Now use custom rounds
+ #
+ hash = hashPasswords("abc123", "-r 1000")
+ if hash.find("$pbkdf2-sha256$1000$") == -1:
+ test(False)
+ test(passlib.hash.pbkdf2_sha256.verify("abc123", hash))
+
+ hash = hashPasswords("abc123", "-r 1000 -d sha1")
+ if hash.find("$pbkdf2$1000$") == -1:
+ test(False)
+ test(passlib.hash.pbkdf2_sha1.verify("abc123", hash))
+
+ hash = hashPasswords("abc123", "-r 1000 -d sha512")
+ if hash.find("$pbkdf2-sha512$1000$") == -1:
+ test(False)
+ test(passlib.hash.pbkdf2_sha512.verify("abc123", hash))
+
+ current.writeln("ok")
+
+ elif useCryptExt:
+
+ current.write("Testing Linux crypt passwords...")
+
+ test(passlib.hash.sha512_crypt.verify("abc123", hashPasswords("abc123")))
+ test(not passlib.hash.sha512_crypt.verify("abc123", hashPasswords("abc")))
+
+ test(passlib.hash.sha256_crypt.verify("abc123", hashPasswords("abc123", "-d sha256")))
+ test(not passlib.hash.sha256_crypt.verify("abc123", hashPasswords("abc", "-d sha256")))
+
+ #
+ # Now use custom rounds
+ #
+ hash = hashPasswords("abc123", "-r 5000")
+ if hash.find("rounds=") != -1:
+ test(False)
+ test(passlib.hash.sha512_crypt.verify("abc123", hash))
+ hash = hashPasswords("abc123", "-d sha256 -r 5000")
+ if hash.find("rounds=") != -1:
+ test(False)
+ test(passlib.hash.sha256_crypt.verify("abc123", hash))
+
+ hash = hashPasswords("abc123", "-r 10000")
+ if hash.find("$rounds=10000$") == -1:
+ test(False)
+ test(passlib.hash.sha512_crypt.verify("abc123", hash))
+ hash = hashPasswords("abc123", "-d sha256 -r 10000")
+ if hash.find("$rounds=10000$") == -1:
+ test(False)
+ test(passlib.hash.sha256_crypt.verify("abc123", hash))
+
+ current.writeln("ok")
+
+TestSuite(__name__, [Glacier2HashPasswordTestCase()])
diff --git a/cpp/test/Glacier2/override/Client.cpp b/cpp/test/Glacier2/override/Client.cpp
index 651cc31883b..8e351d2d574 100644
--- a/cpp/test/Glacier2/override/Client.cpp
+++ b/cpp/test/Glacier2/override/Client.cpp
@@ -17,9 +17,6 @@ using namespace std;
using namespace Ice;
using namespace Test;
-static Ice::InitializationData initData;
-
-
class CallbackClient : public Application
{
public:
@@ -39,7 +36,7 @@ main(int argc, char* argv[])
// the router before session establishment, as well as after
// session destruction. Both will cause a ConnectionLostException.
//
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.ThreadPool.Client.Serialize", "1");
@@ -50,11 +47,11 @@ main(int argc, char* argv[])
int
CallbackClient::run(int, char**)
{
- ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347");
+ ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10));
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
communicator()->setDefaultRouter(router);
- ObjectPrx base = communicator()->stringToProxy("c/callback:tcp -p 12010");
+ ObjectPrx base = communicator()->stringToProxy("c/callback:" + getTestEndpoint(communicator(), 0));
Glacier2::SessionPrx session = router->createSession("userid", "abc123");
base->ice_ping();
@@ -213,7 +210,8 @@ CallbackClient::run(int, char**)
}
communicator()->setDefaultRouter(0);
- ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348");
+ ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" +
+ getTestEndpoint(communicator(), 11, "tcp"));
Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(processBase);
process->shutdown();
try
diff --git a/cpp/test/Glacier2/override/Server.cpp b/cpp/test/Glacier2/override/Server.cpp
index e7317bf1108..16d84f6fb0b 100644
--- a/cpp/test/Glacier2/override/Server.cpp
+++ b/cpp/test/Glacier2/override/Server.cpp
@@ -8,6 +8,7 @@
// **********************************************************************
#include <Ice/Application.h>
+#include <TestCommon.h>
#include <CallbackI.h>
using namespace std;
@@ -28,8 +29,7 @@ main(int argc, char* argv[])
Ice::registerIceSSL();
#endif
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
@@ -42,7 +42,7 @@ main(int argc, char* argv[])
int
CallbackServer::run(int, char**)
{
- communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", "tcp -p 12010");
+ communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", getTestEndpoint(communicator(), 0));
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter");
adapter->add(new CallbackI(), Ice::stringToIdentity("c/callback"));
adapter->activate();
diff --git a/cpp/test/Glacier2/override/run.py b/cpp/test/Glacier2/override/run.py
deleted file mode 100755
index 1bd6be79285..00000000000
--- a/cpp/test/Glacier2/override/run.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-router = TestUtil.getGlacier2Router()
-
-if TestUtil.appverifier:
- TestUtil.setAppVerifierSettings([router])
-
-def startRouter():
- #
- # Note: we limit the send buffer size with Ice.TCP.SndSize, the
- # test relies on send() blocking
- #
- args = ' --Ice.Warn.Dispatch=0' + \
- ' --Ice.Warn.Connections=0' + \
- ' --Ice.TCP.SndSize=100000' + \
- ' --Ice.ThreadPool.Server.Serialize=1' + \
- ' --Ice.ThreadPool.Client.Serialize=1' + \
- ' --Glacier2.Filter.Category.Accept="c"' + \
- ' --Glacier2.SessionTimeout="30"' + \
- ' --Glacier2.Client.Endpoints="default -p 12347"' + \
- ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \
- ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \
- ' --Glacier2.PermissionsVerifier=Glacier2/NullPermissionsVerifier' + \
- ' --Glacier2.Client.ForwardContext=1' + \
- ' --Glacier2.Client.Trace.Override=0' + \
- ' --Glacier2.Client.Trace.Request=0' + \
- ' --Glacier2.Server.Trace.Override=0' + \
- ' --Glacier2.Server.Trace.Request=0' + \
- ' --Ice.Admin.InstanceName="Glacier2"' + \
- ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1' + \
- ' --Glacier2.Client.SleepTime=50 --Glacier2.Server.SleepTime=50'
-
- sys.stdout.write("starting router in buffered mode... ")
- sys.stdout.flush()
- starterProc = TestUtil.startServer(router, args, count=2)
- print("ok")
- return starterProc
-
-name = os.path.join("Glacier2", "override")
-
-starterProc = startRouter()
-TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown")
-starterProc.waitTestSuccess()
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd([router])
diff --git a/cpp/test/Glacier2/override/test.py b/cpp/test/Glacier2/override/test.py
new file mode 100644
index 00000000000..2678f78d835
--- /dev/null
+++ b/cpp/test/Glacier2/override/test.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# Note: we limit the send buffer size with Ice.TCP.SndSize, the
+# test relies on send() blocking
+#
+routerProps = {
+ 'Ice.Warn.Dispatch' : '0',
+ 'Ice.Warn.Connections' : '0',
+ 'Ice.TCP.SndSize' : '100000',
+ 'Ice.ThreadPool.Server.Serialize' : '1',
+ 'Ice.ThreadPool.Client.Serialize' : '1',
+ 'Glacier2.Filter.Category.Accept' : '"c"',
+ 'Glacier2.SessionTimeout' : '"30"',
+ 'Glacier2.PermissionsVerifier' : 'Glacier2/NullPermissionsVerifier',
+ 'Glacier2.Client.ForwardContext' : '1',
+ 'Glacier2.Client.Trace.Override' : '0',
+ 'Glacier2.Client.Trace.Request' : '0',
+ 'Glacier2.Server.Trace.Override' : '0',
+ 'Glacier2.Server.Trace.Request' : '0',
+ 'Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered' : '1',
+ 'Glacier2.Client.SleepTime=50 --Glacier2.Server.SleepTime' : '50',
+}
+
+Glacier2TestSuite(__name__, routerProps=routerProps)
diff --git a/cpp/test/Glacier2/router/Client.cpp b/cpp/test/Glacier2/router/Client.cpp
index 937a114e053..1a27a8726c1 100644
--- a/cpp/test/Glacier2/router/Client.cpp
+++ b/cpp/test/Glacier2/router/Client.cpp
@@ -82,7 +82,7 @@ public:
void run()
{
CommunicatorPtr communicator = initialize(initData);
- ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347");
+ ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator, 10));
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
communicator->setDefaultRouter(router);
@@ -109,7 +109,7 @@ public:
ident.category = category;
CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident));
- ObjectPrx base = communicator->stringToProxy("c1/callback:tcp -p 12010");
+ ObjectPrx base = communicator->stringToProxy("c1/callback:" + getTestEndpoint(communicator, 0));
base = base->ice_oneway();
CallbackPrx callback = CallbackPrx::uncheckedCast(base);
@@ -189,7 +189,7 @@ public:
void run()
{
CommunicatorPtr communicator = initialize(initData);
- ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:default -p 12347");
+ ObjectPrx routerBase = communicator->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator, 10));
_router = Glacier2::RouterPrx::checkedCast(routerBase);
communicator->setDefaultRouter(_router);
@@ -207,7 +207,7 @@ public:
ident.category = category;
CallbackReceiverPrx receiver = CallbackReceiverPrx::uncheckedCast(adapter->add(_callbackReceiver, ident));
- ObjectPrx base = communicator->stringToProxy("c1/callback:tcp -p 12010");
+ ObjectPrx base = communicator->stringToProxy("c1/callback:" + getTestEndpoint(communicator, 0));
base = base->ice_oneway();
CallbackPrx callback = CallbackPrx::uncheckedCast(base);
@@ -428,7 +428,7 @@ main(int argc, char* argv[])
// the router before session establishment, as well as after
// session destruction. Both will cause a ConnectionLostException.
//
- initData.properties = Ice::createProperties(argc, argv);
+ initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
CallbackClient app;
@@ -442,7 +442,7 @@ CallbackClient::run(int argc, char* argv[])
{
cout << "testing stringToProxy for router... " << flush;
- routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347");
+ routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10));
cout << "ok" << endl;
}
@@ -458,7 +458,8 @@ CallbackClient::run(int argc, char* argv[])
{
cout << "testing router finder... " << flush;
Ice::RouterFinderPrx finder =
- RouterFinderPrx::uncheckedCast(communicator()->stringToProxy("Ice/RouterFinder:default -p 12347"));
+ RouterFinderPrx::uncheckedCast(communicator()->stringToProxy("Ice/RouterFinder:" +
+ getTestEndpoint(communicator(), 10)));
test(finder->getRouter()->ice_getIdentity() == router->ice_getIdentity());
cout << "ok" << endl;
}
@@ -480,7 +481,7 @@ CallbackClient::run(int argc, char* argv[])
{
cout << "testing stringToProxy for server object... " << flush;
- base = communicator()->stringToProxy("c1/callback:tcp -p 12010");
+ base = communicator()->stringToProxy("c1/callback:" + getTestEndpoint(communicator(), 0));
cout << "ok" << endl;
}
@@ -849,6 +850,7 @@ CallbackClient::run(int argc, char* argv[])
cout << "ok" << endl;
}
+ if(argc >= 2 && strcmp(argv[1], "--shutdown") == 0)
{
cout << "testing server shutdown... " << flush;
twoway->shutdown();
@@ -908,7 +910,8 @@ CallbackClient::run(int argc, char* argv[])
{
cout << "testing stringToProxy for admin process facet... " << flush;
- processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348");
+ processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" +
+ getTestEndpoint(communicator(), 11, "tcp"));
cout << "ok" << endl;
}
diff --git a/cpp/test/Glacier2/router/Server.cpp b/cpp/test/Glacier2/router/Server.cpp
index f07ce8fc713..350a8ae3a03 100644
--- a/cpp/test/Glacier2/router/Server.cpp
+++ b/cpp/test/Glacier2/router/Server.cpp
@@ -8,6 +8,7 @@
// **********************************************************************
#include <Ice/Application.h>
+#include <TestCommon.h>
#include <CallbackI.h>
using namespace std;
@@ -28,8 +29,7 @@ main(int argc, char* argv[])
Ice::registerIceSSL();
#endif
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
@@ -41,7 +41,7 @@ main(int argc, char* argv[])
int
CallbackServer::run(int, char**)
{
- communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", "tcp -p 12010");
+ communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", getTestEndpoint(communicator(), 0));
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter");
adapter->add(new CallbackI(), Ice::stringToIdentity("c1/callback")); // The test allows "c1" as category.
adapter->add(new CallbackI(), Ice::stringToIdentity("c2/callback")); // The test allows "c2" as category.
diff --git a/cpp/test/Glacier2/router/run.py b/cpp/test/Glacier2/router/run.py
deleted file mode 100755
index 436b1a8df9c..00000000000
--- a/cpp/test/Glacier2/router/run.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-router = TestUtil.getGlacier2Router()
-
-if TestUtil.appverifier:
- TestUtil.setAppVerifierSettings([router])
-
-def startRouter(buffered):
-
- args = ' --Ice.Warn.Dispatch=0' + \
- ' --Ice.Warn.Connections=0' + \
- ' --Glacier2.Filter.Category.Accept="c1 c2"' + \
- ' --Glacier2.Filter.Category.AcceptUser="2"' + \
- ' --Glacier2.SessionTimeout="30"' + \
- ' --Glacier2.Client.Endpoints="default -p 12347"' + \
- ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \
- ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \
- ' --Ice.Admin.InstanceName="Glacier2"' + \
- ' --Glacier2.CryptPasswords="%s"' % os.path.join(os.getcwd(), "passwords")
-
- if buffered:
- args += ' --Glacier2.Client.Buffered=1 --Glacier2.Server.Buffered=1'
- sys.stdout.write("starting router in buffered mode... ")
- sys.stdout.flush()
- else:
- args += ' --Glacier2.Client.Buffered=0 --Glacier2.Server.Buffered=0'
- sys.stdout.write("starting router in unbuffered mode... ")
- sys.stdout.flush()
-
- starterProc = TestUtil.startServer(router, args, count=2)
-
- print("ok")
- return starterProc
-
-name = os.path.join("Glacier2", "router")
-
-#
-# Generate the crypt passwords file
-#
-TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"),
- {"userid": "abc123", "userid-0": "abc123", "userid-1": "abc123",
- "userid-2": "abc123", "userid-3": "abc123","userid-4": "abc123"})
-#
-# We first run the test with unbuffered mode.
-#
-starterProc = startRouter(False)
-TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown")
-starterProc.waitTestSuccess()
-
-#
-# Then we run the test in buffered mode.
-#
-starterProc = startRouter(True)
-TestUtil.clientServerTest()
-
-#
-# We run the test again, to check whether the glacier router can
-# handle multiple clients. Also, when we run for the second time, we
-# want the client to shutdown the router after running the tests.
-#
-TestUtil.clientServerTest(name, additionalClientOptions = " --shutdown")
-
-starterProc.waitTestSuccess()
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd([router])
diff --git a/cpp/test/Glacier2/sessionControl/Client.cpp b/cpp/test/Glacier2/sessionControl/Client.cpp
index 3e1bd96b9ba..4c437886367 100644
--- a/cpp/test/Glacier2/sessionControl/Client.cpp
+++ b/cpp/test/Glacier2/sessionControl/Client.cpp
@@ -31,8 +31,7 @@ main(int argc, char* argv[])
Ice::registerIceSSL();
#endif
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// We want to check whether the client retries for evicted
@@ -49,7 +48,7 @@ int
SessionControlClient::run(int, char**)
{
cout << "getting router... " << flush;
- ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347");
+ ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10));
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
test(router);
communicator()->setDefaultRouter(router);
@@ -103,7 +102,8 @@ SessionControlClient::run(int, char**)
session = Test::SessionPrx::uncheckedCast(router->createSession("userid", "abc123"));
session->shutdown();
communicator()->setDefaultRouter(0);
- ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -p 12348");
+ ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" +
+ getTestEndpoint(communicator(), 11, "tcp"));
Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(processBase);
test(process);
process->shutdown();
diff --git a/cpp/test/Glacier2/sessionControl/Server.cpp b/cpp/test/Glacier2/sessionControl/Server.cpp
index cffa77ec01a..2ba45328230 100644
--- a/cpp/test/Glacier2/sessionControl/Server.cpp
+++ b/cpp/test/Glacier2/sessionControl/Server.cpp
@@ -8,6 +8,7 @@
// **********************************************************************
#include <Ice/Application.h>
+#include <TestCommon.h>
#include <Glacier2/PermissionsVerifier.h>
#include <SessionI.h>
@@ -30,13 +31,14 @@ main(int argc, char* argv[])
#endif
SessionControlServer app;
- return app.main(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ return app.main(argc, argv, initData);
}
int
SessionControlServer::run(int, char**)
{
- communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", "tcp -p 12010");
+ communicator()->getProperties()->setProperty("SessionControlAdapter.Endpoints", getTestEndpoint(communicator(), 0));
ObjectAdapterPtr adapter = communicator()->createObjectAdapter("SessionControlAdapter");
adapter->add(new SessionManagerI, Ice::stringToIdentity("SessionManager"));
adapter->activate();
diff --git a/cpp/test/Glacier2/sessionControl/SessionI.cpp b/cpp/test/Glacier2/sessionControl/SessionI.cpp
index ef34316c4ce..acb1b9927e7 100644
--- a/cpp/test/Glacier2/sessionControl/SessionI.cpp
+++ b/cpp/test/Glacier2/sessionControl/SessionI.cpp
@@ -22,7 +22,7 @@ public:
{
}
- void
+ void
response()
{
_cb->ice_response();
@@ -66,8 +66,8 @@ void
SessionI::destroyFromClient_async(const Test::AMD_Session_destroyFromClientPtr& cb, const Ice::Current&)
{
DestroyCBPtr asyncCB = new DestroyCB(cb);
- Glacier2::Callback_SessionControl_destroyPtr amiCB = Glacier2::newCallback_SessionControl_destroy(asyncCB,
- &DestroyCB::response,
+ Glacier2::Callback_SessionControl_destroyPtr amiCB = Glacier2::newCallback_SessionControl_destroy(asyncCB,
+ &DestroyCB::response,
&DestroyCB::exception);
_sessionControl->begin_destroy(amiCB);
}
diff --git a/cpp/test/Glacier2/sessionControl/run.py b/cpp/test/Glacier2/sessionControl/run.py
deleted file mode 100755
index 3499a044fb4..00000000000
--- a/cpp/test/Glacier2/sessionControl/run.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, time
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server"))
-router = TestUtil.getGlacier2Router()
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-targets = []
-if TestUtil.appverifier:
- targets = [server, client, router]
- TestUtil.setAppVerifierSettings(targets)
-
-sys.stdout.write("starting server... ")
-sys.stdout.flush()
-serverProc = TestUtil.startServer(server)
-print("ok")
-
-args = ' --Glacier2.Client.Endpoints="default -p 12347"' + \
- ' --Ice.Admin.Endpoints="tcp -p 12348"' + \
- ' --Ice.Admin.InstanceName=Glacier2' + \
- ' --Glacier2.Server.Endpoints="default -p 12349"' + \
- ' --Glacier2.SessionManager="SessionManager:tcp -p 12010"' \
- ' --Glacier2.PermissionsVerifier="Glacier2/NullPermissionsVerifier"'
-
-sys.stdout.write("starting router... ")
-sys.stdout.flush()
-starterProc = TestUtil.startServer(router, args, count = 2)
-print("ok")
-
-#
-# The test may sporadically fail without this slight pause.
-#
-time.sleep(1)
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
-serverProc.waitTestSuccess()
-starterProc.waitTestSuccess()
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets)
diff --git a/cpp/test/Glacier2/sessionControl/test.py b/cpp/test/Glacier2/sessionControl/test.py
new file mode 100644
index 00000000000..480a1741b7a
--- /dev/null
+++ b/cpp/test/Glacier2/sessionControl/test.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# Note: we limit the send buffer size with Ice.TCP.SndSize, the
+# test relies on send() blocking
+#
+routerProps = lambda process, current : {
+ 'Glacier2.SessionManager' : 'SessionManager:{0}'.format(current.getTestEndpoint(0)),
+ 'Glacier2.PermissionsVerifier' : 'Glacier2/NullPermissionsVerifier',
+}
+
+Glacier2TestSuite(__name__, testcases=[ClientServerTestCase(servers=[Glacier2Router(props=routerProps), Server()])])
diff --git a/cpp/test/Glacier2/sessionHelper/Client.cpp b/cpp/test/Glacier2/sessionHelper/Client.cpp
index 29363f71a1f..7bb1649f1f4 100644
--- a/cpp/test/Glacier2/sessionHelper/Client.cpp
+++ b/cpp/test/Glacier2/sessionHelper/Client.cpp
@@ -211,7 +211,7 @@ public:
cout << "ok" << endl;
instance->notify();
}
- catch(...)
+ catch(const Ice::LocalException&)
{
test(false);
}
@@ -273,10 +273,11 @@ public:
int run(int argc, char* argv[])
{
instance = this;
- string protocol = communicator()->getProperties()->getPropertyWithDefault("Ice.Default.Protocol", "tcp");
- string host = communicator()->getProperties()->getPropertyWithDefault("Ice.Default.Host", "127.0.0.1");
+ string protocol = getTestProtocol(communicator()->getProperties());
+ string host = getTestHost(communicator()->getProperties());
_initData.properties = Ice::createProperties(argc, argv, communicator()->getProperties());
- _initData.properties->setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347");
+ _initData.properties->setProperty("Ice.Default.Router", "Glacier2/router:" +
+ getTestEndpoint(communicator(), 10));
DispatcherPtr dispatcher = new Dispatcher();
dispatcher->start();
@@ -313,7 +314,7 @@ public:
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
cout << "testing SessionHelper connect interrupt... " << flush;
_factory->setRouterHost(host);
- _factory->setPort(12011);
+ _factory->setPort(getTestPort(_initData.properties, 1));
_factory->setProtocol(protocol);
_session = _factory->connect("userid", "abc123");
@@ -333,7 +334,7 @@ public:
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
cout << "testing SessionHelper connect... " << flush;
_factory->setRouterHost(host);
- _factory->setPort(12347);
+ _factory->setPort(getTestPort(_initData.properties, 10));
_factory->setProtocol(protocol);
_session = _factory->connect("userid", "abc123");
@@ -367,7 +368,8 @@ public:
// }
cout << "testing stringToProxy for server object... " << flush;
- Ice::ObjectPrx base = _session->communicator()->stringToProxy("callback:default -p 12010");
+ Ice::ObjectPrx base = _session->communicator()->stringToProxy("callback:" +
+ getTestEndpoint(_session->communicator(), 0));
cout << "ok" << endl;
cout << "pinging server after session creation... " << flush;
@@ -450,7 +452,8 @@ public:
Ice::ObjectPrx processBase;
{
cout << "testing stringToProxy for process object... " << flush;
- processBase = communicator()->stringToProxy("Glacier2/admin -f Process:default -h \"" + host + "\" -p 12348");
+ processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" +
+ getTestEndpoint(communicator(), 11, "tcp"));
cout << "ok" << endl;
}
@@ -490,7 +493,7 @@ public:
IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
cout << "testing SessionHelper connect after router shutdown... " << flush;
_factory->setRouterHost(host);
- _factory->setPort(12347);
+ _factory->setPort(getTestPort(_initData.properties, 10));
_factory->setProtocol(protocol);
_session = _factory->connect("userid", "abc123");
@@ -557,5 +560,6 @@ main(int argc, char* argv[])
#endif
SessionHelperClient c;
- return c.main(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ return c.main(argc, argv, initData);
}
diff --git a/cpp/test/Glacier2/sessionHelper/Server.cpp b/cpp/test/Glacier2/sessionHelper/Server.cpp
index f359b5f557d..9f33dc89d78 100644
--- a/cpp/test/Glacier2/sessionHelper/Server.cpp
+++ b/cpp/test/Glacier2/sessionHelper/Server.cpp
@@ -9,7 +9,7 @@
#include <IceUtil/IceUtil.h>
#include <Ice/Ice.h>
-
+#include <TestCommon.h>
#include <Callback.h>
using namespace std;
@@ -54,10 +54,10 @@ public:
int
SessionHelperServer::run(int, char**)
{
- communicator()->getProperties()->setProperty("DeactivatedAdapter.Endpoints", "default -p 12011");
+ communicator()->getProperties()->setProperty("DeactivatedAdapter.Endpoints", getTestEndpoint(communicator(), 1));
communicator()->createObjectAdapter("DeactivatedAdapter");
- communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", "default -p 12010");
+ communicator()->getProperties()->setProperty("CallbackAdapter.Endpoints", getTestEndpoint(communicator(), 0));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("CallbackAdapter");
adapter->add(new CallbackI(), Ice::stringToIdentity("callback"));
adapter->activate();
@@ -74,6 +74,7 @@ main(int argc, char* argv[])
#endif
SessionHelperServer app;
- return app.main(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ return app.main(argc, argv, initData);
}
diff --git a/cpp/test/Glacier2/sessionHelper/run.py b/cpp/test/Glacier2/sessionHelper/run.py
deleted file mode 100755
index 48bae2a0f31..00000000000
--- a/cpp/test/Glacier2/sessionHelper/run.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-router = os.path.join(TestUtil.getCppBinDir(), "glacier2router")
-
-#
-# Generate the crypt passwords file
-#
-TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"})
-
-args = ' --Ice.Warn.Dispatch=0' + \
- ' --Ice.Warn.Connections=0' + \
- ' --Glacier2.SessionTimeout="30"' + \
- ' --Glacier2.Client.Endpoints="default -p 12347"' + \
- ' --Glacier2.Server.Endpoints="default"' \
- ' --Ice.Admin.Endpoints="default -p 12348"' + \
- ' --Ice.Admin.InstanceName=Glacier2' + \
- ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"'
-
-sys.stdout.write("starting router... ")
-sys.stdout.flush()
-routerConfig = TestUtil.DriverConfig("server")
-routerConfig.lang = "cpp"
-starterProc = TestUtil.startServer(router, args, count=2, config=routerConfig)
-print("ok")
-
-TestUtil.clientServerTest(additionalClientOptions=" --shutdown")
-
-starterProc.waitTestSuccess()
diff --git a/cpp/test/Glacier2/ssl/Client.cpp b/cpp/test/Glacier2/ssl/Client.cpp
index 4859e556e16..6ed1c17550a 100644
--- a/cpp/test/Glacier2/ssl/Client.cpp
+++ b/cpp/test/Glacier2/ssl/Client.cpp
@@ -34,10 +34,8 @@ main(int argc, char* argv[])
// the router before session establishment, as well as after
// session destruction. Both will cause a ConnectionLostException.
//
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
-
CallbackClient app;
return app.main(argc, argv, initData);
}
@@ -46,7 +44,7 @@ int
CallbackClient::run(int, char**)
{
Glacier2::RouterPrx router = Glacier2::RouterPrx::uncheckedCast(
- communicator()->stringToProxy("Glacier2/router:tcp -h 127.0.0.1 -p 12347"));
+ communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 0, "tcp")));
communicator()->setDefaultRouter(router);
//
@@ -82,7 +80,7 @@ CallbackClient::run(int, char**)
//
communicator()->setDefaultRouter(Glacier2::RouterPrx());
router = Glacier2::RouterPrx::uncheckedCast(
- communicator()->stringToProxy("Glacier2/router:ssl -h 127.0.0.1 -p 12348"));
+ communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 1, "ssl")));
communicator()->setDefaultRouter(router);
//
@@ -116,7 +114,7 @@ CallbackClient::run(int, char**)
communicator()->setDefaultRouter(0);
Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(
- communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12349"));
+ communicator()->stringToProxy("Glacier2/admin -f Process:" + getTestEndpoint(communicator(), 2, "tcp")));
process->shutdown();
return EXIT_SUCCESS;
diff --git a/cpp/test/Glacier2/ssl/Server.cpp b/cpp/test/Glacier2/ssl/Server.cpp
index fcaf8d411b9..ad112cb23c2 100644
--- a/cpp/test/Glacier2/ssl/Server.cpp
+++ b/cpp/test/Glacier2/ssl/Server.cpp
@@ -18,18 +18,22 @@ using namespace std;
namespace
{
-void testContext(bool ssl, const Ice::Context& context)
+void testContext(bool ssl, const Ice::CommunicatorPtr& communicator, const Ice::Context& context)
{
Ice::Context ctx = context;
if(!ssl)
{
test(ctx["_con.type"] == "tcp");
- test(ctx["_con.localPort"] == "12347");
+ ostringstream port;
+ port << getTestPort(communicator->getProperties(), 0);
+ test(ctx["_con.localPort"] == port.str());
}
else
{
test(ctx["_con.type"] == "ssl");
- test(ctx["_con.localPort"] == "12348");
+ ostringstream port;
+ port << getTestPort(communicator->getProperties(), 1);
+ test(ctx["_con.localPort"] == port.str());
}
test(ctx["_con.localAddress"] == "127.0.0.1");
test(ctx["_con.remotePort"] != "");
@@ -45,7 +49,7 @@ public:
virtual bool
checkPermissions(const string& userId, const string&, string&, const Ice::Current& current) const
{
- testContext(userId == "ssl", current.ctx);
+ testContext(userId == "ssl", current.adapter->getCommunicator(), current.ctx);
return true;
}
};
@@ -57,7 +61,7 @@ public:
virtual bool
authorize(const Glacier2::SSLInfo& info, string&, const Ice::Current& current) const
{
- testContext(true, current.ctx);
+ testContext(true, current.adapter->getCommunicator(), current.ctx);
IceSSL::CertificatePtr cert = IceSSL::Certificate::decode(info.certs[0]);
test(cert->getIssuerDN() == IceSSL::DistinguishedName(
@@ -81,7 +85,7 @@ public:
virtual void
destroy(const Ice::Current& current)
{
- testContext(_ssl, current.ctx);
+ testContext(_ssl, current.adapter->getCommunicator(), current.ctx);
current.adapter->remove(current.id);
if(_shutdown)
@@ -93,7 +97,7 @@ public:
virtual void
ice_ping(const Ice::Current& current) const
{
- testContext(_ssl, current.ctx);
+ testContext(_ssl, current.adapter->getCommunicator(), current.ctx);
}
private:
@@ -109,7 +113,7 @@ public:
virtual Glacier2::SessionPrx
create(const string& userId, const Glacier2::SessionControlPrx&, const Ice::Current& current)
{
- testContext(userId == "ssl", current.ctx);
+ testContext(userId == "ssl", current.adapter->getCommunicator(), current.ctx);
Glacier2::SessionPtr session = new SessionI(false, userId == "ssl");
return Glacier2::SessionPrx::uncheckedCast(current.adapter->addWithUUID(session));
@@ -123,11 +127,11 @@ public:
virtual Glacier2::SessionPrx
create(const Glacier2::SSLInfo& info, const Glacier2::SessionControlPrx&, const Ice::Current& current)
{
- testContext(true, current.ctx);
+ testContext(true, current.adapter->getCommunicator(), current.ctx);
test(info.remoteHost == "127.0.0.1");
test(info.localHost == "127.0.0.1");
- test(info.localPort == 12348);
+ test(info.localPort == getTestPort(current.adapter->getCommunicator()->getProperties(), 1));
try
{
@@ -163,14 +167,15 @@ main(int argc, char* argv[])
#endif
SessionServer app;
- return app.main(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ return app.main(argc, argv, initData);
}
int
SessionServer::run(int, char**)
{
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints(
- "SessionServer", "tcp -h 127.0.0.1 -p 12350");
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints("SessionServer",
+ getTestEndpoint(communicator(), 3, "tcp"));
adapter->add(new PermissionsVerifierI, Ice::stringToIdentity("verifier"));
adapter->add(new SSLPermissionsVerifierI, Ice::stringToIdentity("sslverifier"));
adapter->add(new SessionManagerI, Ice::stringToIdentity("sessionmanager"));
diff --git a/cpp/test/Glacier2/ssl/run.py b/cpp/test/Glacier2/ssl/run.py
deleted file mode 100755
index a28b3c7a83b..00000000000
--- a/cpp/test/Glacier2/ssl/run.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server"))
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-router = TestUtil.getGlacier2Router()
-
-targets = []
-if TestUtil.appverifier:
- targets = [server, client, router]
- TestUtil.setAppVerifierSettings(targets)
-
-sys.stdout.write("starting server... ")
-sys.stdout.flush()
-serverProc = TestUtil.startServer(server)
-print("ok")
-
-args = ' --Ice.Warn.Dispatch=0' + \
- ' --Glacier2.AddConnectionContext=1' + \
- ' --Glacier2.Client.Endpoints="tcp -h 127.0.0.1 -p 12347:ssl -h 127.0.0.1 -p 12348"' + \
- ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \
- ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12349"' + \
- ' --Ice.Admin.InstanceName=Glacier2' + \
- ' --Glacier2.SessionManager="sessionmanager:tcp -h 127.0.0.1 -p 12350"' + \
- ' --Glacier2.PermissionsVerifier="verifier:tcp -h 127.0.0.1 -p 12350"' + \
- ' --Glacier2.SSLSessionManager="sslsessionmanager:tcp -h 127.0.0.1 -p 12350"' + \
- ' --Glacier2.SSLPermissionsVerifier="sslverifier:tcp -h 127.0.0.1 -p 12350"'
-
-routerCfg = TestUtil.DriverConfig("server")
-routerCfg.protocol = "ssl"
-sys.stdout.write("starting router... ")
-sys.stdout.flush()
-starterProc = TestUtil.startServer(router, args, routerCfg, count = 2)
-print("ok")
-
-clientCfg = TestUtil.DriverConfig("client")
-clientCfg.protocol = "ssl"
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, "", clientCfg, startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
-serverProc.waitTestSuccess()
-starterProc.waitTestSuccess()
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets)
diff --git a/cpp/test/Glacier2/ssl/test.py b/cpp/test/Glacier2/ssl/test.py
new file mode 100644
index 00000000000..d63c1f866ac
--- /dev/null
+++ b/cpp/test/Glacier2/ssl/test.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+routerProps = lambda process, current : {
+ 'Ice.Warn.Dispatch' : '0',
+ 'Glacier2.AddConnectionContext' : '1',
+ 'Glacier2.Client.Endpoints' : '{0}:{1}'.format(current.getTestEndpoint(0, "tcp"), current.getTestEndpoint(1, "ssl")),
+ 'Ice.Admin.Endpoints' : current.getTestEndpoint(2, "tcp"),
+ 'Glacier2.SessionManager' : 'sessionmanager:{0}'.format(current.getTestEndpoint(3, "tcp")),
+ 'Glacier2.PermissionsVerifier' : 'verifier:{0}'.format(current.getTestEndpoint(3, "tcp")),
+ 'Glacier2.SSLSessionManager' : 'sslsessionmanager:{0}'.format(current.getTestEndpoint(3, "tcp")),
+ 'Glacier2.SSLPermissionsVerifier' : 'sslverifier:{0}'.format(current.getTestEndpoint(3, "tcp")),
+}
+
+#
+# Always enable SSL for the Glacier2 router and client
+#
+sslProps = lambda process, current: current.testcase.getMapping().getSSLProps(process)
+
+Glacier2TestSuite(__name__, routerProps=routerProps, options={ "ipv6" : [ False ] }, multihost=False,
+ testcases=[ClientServerTestCase(servers=[Glacier2Router(props=sslProps), Server()],
+ client=Client(props=sslProps))])
diff --git a/cpp/test/Glacier2/staticFiltering/.gitignore b/cpp/test/Glacier2/staticFiltering/.gitignore
index 896ef01805f..91cc546abba 100644
--- a/cpp/test/Glacier2/staticFiltering/.gitignore
+++ b/cpp/test/Glacier2/staticFiltering/.gitignore
@@ -1,3 +1,3 @@
-attack.cfg
+client.cfg
router.cfg
server.cfg
diff --git a/cpp/test/Glacier2/staticFiltering/Client.cpp b/cpp/test/Glacier2/staticFiltering/Client.cpp
index 9e115fecd41..64223ab657f 100644
--- a/cpp/test/Glacier2/staticFiltering/Client.cpp
+++ b/cpp/test/Glacier2/staticFiltering/Client.cpp
@@ -30,8 +30,7 @@ main(int argc, char* argv[])
Ice::registerIceSSL();
#endif
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// We want to check whether the client retries for evicted
@@ -46,7 +45,7 @@ main(int argc, char* argv[])
int
AttackClient::run(int, char**)
{
- ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:default -p 12347");
+ ObjectPrx routerBase = communicator()->stringToProxy("Glacier2/router:" + getTestEndpoint(communicator(), 10));
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(routerBase);
test(router);
communicator()->setDefaultRouter(router);
@@ -152,7 +151,8 @@ AttackClient::run(int, char**)
test(false);
}
- ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348");
+ ObjectPrx processBase = communicator()->stringToProxy("Glacier2/admin -f Process:" +
+ getTestEndpoint(communicator(), 11, "tcp"));
Ice::ProcessPrx process = Ice::ProcessPrx::checkedCast(processBase);
test(process);
process->shutdown();
diff --git a/cpp/test/Glacier2/staticFiltering/run.py b/cpp/test/Glacier2/staticFiltering/run.py
deleted file mode 100755
index d84921d2778..00000000000
--- a/cpp/test/Glacier2/staticFiltering/run.py
+++ /dev/null
@@ -1,367 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, time, socket
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-hostname = socket.gethostname().lower()
-fqdn = socket.getfqdn().lower()
-
-limitedTests = False
-
-router = TestUtil.getGlacier2Router()
-clientCmd = os.path.join(os.getcwd(), TestUtil.getTestExecutable('client'))
-serverCmd = os.path.join(os.getcwd(), TestUtil.getTestExecutable('server'))
-
-#
-# Generate the crypt passwords file
-#
-TestUtil.hashPasswords(os.path.join(os.getcwd(), "passwords"), {"userid": "abc123"})
-
-targets = []
-if TestUtil.appverifier:
- targets = [serverCmd, clientCmd, router]
- TestUtil.setAppVerifierSettings(targets)
-
-#
-# Try and figure out what tests are reasonable with this host's
-# configuration.
-#
-if fqdn.endswith("localdomain") or fqdn.endswith("local") or fqdn.endswith("domain"):
- #
- # No real configured domain name, this means that anything that
- # requires a domain name isn't likely going to work. Furthermore, it
- # might be the case that the hostname contains this suffix, so we
- # should just toss it and pretend that there is no 'hostname'
- # configured for this box.
- #
- hostname = "127.0.0.1"
- fqdn = ""
- domainname = ""
- limitedTests = True
-elif hostname.startswith("localhost"):
- #
- # No configured host name (and possibly no domain name), minimal
- # tests.
- #
- hostname = "127.0.0.1"
- fqdn = ""
- domainname = ""
- limitedTests = True
-elif fqdn.find(".") == -1:
- #
- # No real configured domain.
- #
- hostname = "127.0.0.1"
- fqdn = ""
- domainname = ""
- limitedTests = True
-else:
- dot = fqdn.find(".")
- domainname = fqdn[dot+1:]
- #
- # Some Python installs are going to return a FQDN for gethostname().
- # This invalidates the tests that need to differentiate between the
- # hostname and the FQDN. If these tests fail because of a DNS error,
- # it may be that an alias is not present for the host partition of
- # the FQDN.
- #
- if fqdn == hostname:
- hostname = hostname[:dot]
- if domainname == "":
- limitedTests = True
-try:
- testaddr1 = socket.gethostbyname(fqdn)
- testaddr2 = socket.gethostbyname(hostname)
-
- # On SuSE distributions, 127.0.0.2 is sometime used in /etc/hosts
- # for the hostname (apparently if no network interface was found
- # when the OS was installed). However, connecting to this IP addr
- # doesn't work (even if can be "ping").
- if testaddr1 == "127.0.0.2" or testaddr2 == "127.0.0.2":
- limitedTests = True
- hostname = "127.0.0.1"
- fqdn = ""
- domainname = ""
-except:
- limitedTests = True
- hostname = "127.0.0.1"
- fqdn = ""
- domainname = ""
-
-testcases = [
- ('testing category filter',
- ('', '', '', 'foo "a cat with spaces"', '', ''),
- [(True, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010')], []),
- ('testing adapter id filter',
- ('', '*', '', '', '', 'foo "an adapter with spaces"'),
- [(False, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'),
- (False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
- (False, 'helloE @ bar'),
- (True, 'helloF1 @ "an adapter with spaces"'),
- (True, 'helloF @ foo')], []),
- ('test identity filters',
- ('', '', '', '', 'myident cata/fooa "a funny id/that might mess it up"', ''),
- [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
- (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, 'myident:tcp -h 127.0.0.1 -p 12010'),
- (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
- ('test mixing filters',
- ('', '', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up" "a\\"nother"',
- 'myadapter'),
- [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
- (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'),
- (True, 'mycat/foo @ jimbo'),
- (False, 'hiscatA @ jimbo'),
- (True, 'hiscat @ myadapter'),
- (True, 'a\"nother @ jimbo'),
- (True, 'myident:tcp -h 127.0.0.1 -p 12010'),
- (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
- ('test mixing filters (indirect only)',
- ('', '*', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up"', 'myadapter'),
- [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
- (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
- (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (False, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'),
- (False, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'),
- (True, 'mycat/foo @ jimbo'),
- (False, 'hiscatA @ jimbo'),
- (True, 'hiscat @ myadapter'),
- (False, 'myident:tcp -h 127.0.0.1 -p 12010'),
- (False, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
- (True, '"a funny id/that might mess it up" @ myadapter'),
- (False, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
- ]
-
-if not limitedTests:
- testcases.extend([
- ('testing reject all',
- ('', '*', '', '', '', ''),
- [(False, 'helloA:tcp -h %s -p 12010' % fqdn),
- (False, 'helloB:tcp -h %s -p 12010' % hostname),
- (False, 'helloC:tcp -h 127.0.0.1 -p 12010'),
- (True, 'bar @ foo')], []),
- ('testing loopback only rule',
- ('127.0.0.1 localhost', '', '', '', '', ''),
- [(False, 'hello:tcp -h %s -p 12010' % fqdn),
- (False, 'hello:tcp -h %s -p 12010' % hostname),
- (False, '127.0.0.1:tcp -h %s -p 12010' % hostname),
- (False, 'localhost:tcp -h %s -p 12010' % hostname),
- (False, 'localhost/127.0.0.1:tcp -h %s -p 12010' % hostname),
- (True, 'localhost:tcp -h 127.0.0.1 -p 12010'),
- (True, 'localhost/127.0.0.1:tcp -h localhost -p 12010'),
- (True, 'hello:tcp -h 127.0.0.1 -p 12010'),
- (True, 'hello/somecat:tcp -h localhost -p 12010')], []),
- ('testing port filter rule',
- ('127.0.0.1:12010 localhost:12010', '', '', '', '', ''),
- [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'),
- (False, 'hello2:tcp -h localhost -p 12011'),
- (False, 'hello5:tcp -h %s -p 12010' % hostname),
- (True, 'hello3:tcp -h 127.0.0.1 -p 12010'),
- (True, 'hello4:tcp -h localhost -p 12010')], []),
- ('testing reject port filter rule',
- ('', '127.0.0.1:[0-12009,12011-65535] localhost:[0-12009,12011-65535]', '', '', '', ''),
- [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'),
- (False, 'hello2:tcp -h localhost -p 12011'),
- (True, 'hello5:tcp -h %s -p 12010' % hostname),
- (True, 'hello3:tcp -h 127.0.0.1 -p 12010'),
- (True, 'hello4:tcp -h localhost -p 12010')], []),
- ('testing port filter rule with wildcard address rule',
- ('*:12010', '', '', '', '', ''),
- [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'),
- (False, 'hello2:tcp -h localhost -p 12011'),
- (True, 'hello5:tcp -h %s -p 12010' % hostname),
- (True, 'hello3:tcp -h 127.0.0.1 -p 12010'),
- (True, 'hello4:tcp -h localhost -p 12010')], []),
- ('testing domain filter rule (accept)',
- ("*" + domainname, '', '', '', '', ''),
- [(True, 'hello:tcp -h %s -p 12010' % fqdn),
- (False, 'hello:tcp -h %s -p 12010' % hostname)], []),
- ('testing domain filter rule (reject)',
- ('', "*" + domainname, '', '', '', ''),
- [(False, 'hello:tcp -h %s -p 12010' % fqdn),
- (True, 'hello:tcp -h %s -p 12010' % hostname),
- (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []),
- ('testing domain filter rule (mixed)',
- ("127.0.0.1", fqdn, '', '', '', ''),
- [(False, 'hello:tcp -h %s -p 12010:tcp -h 127.0.0.1 -p 12010' % fqdn),
- (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []),
- ('testing maximum proxy length rule',
- ('', '', '53', '', '', ''),
- [(True, 'hello:tcp -h 127.0.0.1 -p 12010 -t infinite'),
- (False, '012345678901234567890123456789012345678901234567890123456789:tcp -h 127.0.0.1 -p 12010')], []),
- ])
-
-if len(testcases) == 0:
- print("WARNING: You are running this test with SSL disabled and the network ")
- print(" configuration for this host does not permit the other tests ")
- print(" to run correctly.")
- sys.exit(0)
-elif len(testcases) < 6:
- print("WARNING: The network configuration for this host does not permit all ")
- print(" tests to run correctly, some tests have been disabled.")
-
-def pingProgress():
- sys.stdout.write('.')
- sys.stdout.flush()
-
-for testcase in testcases:
- description, args, attacks, xtraConfig = testcase
- acceptFilter, rejectFilter, maxEndpoints, categoryFilter, idFilter, adapterFilter = args
- #
- # The test client performs multiple tests during one 'run'. We could
- # use command line arguments to pass the test cases in, but a
- # configuration file is easier.
- #
- attackcfg = open(os.path.join(os.getcwd(), 'attack.cfg'), 'w')
- accepts=0
- rejects=0
- sys.stdout.write(description)
-
- for expect, proxy in attacks:
- if expect:
- attackcfg.write('Accept.Proxy.' + str(accepts) + '=')
- accepts +=1
- else:
- attackcfg.write('Reject.Proxy.' + str(rejects) + '=')
- rejects +=1
- attackcfg.write(proxy + '\n')
-
- attackcfg.close()
- pingProgress()
-
- hostArg = ""
- if limitedTests:
- hostArg = " --Ice.Default.Host=127.0.0.1"
- #
- # This test causes connections to be terminated which will cause
- # warnings if we use the default test flags. So we need to define
- # our own.
- #
- commonClientOptions = " --Ice.NullHandleAbort=1 --Ice.Warn.Connections=0 " + hostArg
- commonServerOptions = ' --Ice.PrintAdapterReady --Ice.NullHandleAbort=1' + \
- ' --Ice.ServerIdleTime=600 --Ice.ThreadPool.Server.Size=2 --Ice.ThreadPool.Server.SizeMax=10' + \
- ' --Glacier2.RoutingTable.MaxSize=10 --Ice.Warn.Connections=0 ' + hostArg
-
- #
- # We cannot use the TestUtil options because they use localhost as the default host which doesn't really work for
- # these tests.
- #
-
- routerArgs = ' --Ice.Config="' + os.path.join(os.getcwd(), "router.cfg") + '"' + \
- ' --Glacier2.Client.Endpoints="default -p 12347"' + \
- ' --Ice.Admin.Endpoints="tcp -h 127.0.0.1 -p 12348"' + \
- ' --Ice.Admin.InstanceName=Glacier2' + \
- ' --Glacier2.CryptPasswords="' + os.path.join(os.getcwd(), "passwords") + '"'
-
- routerConfig = open(os.path.join(os.getcwd(), "router.cfg"), "w")
-
- routerConfig.write("Ice.Default.Locator=locator:tcp -h %s -p 12010\n" % hostname)
- routerConfig.write("Glacier2.Client.Trace.Reject=0\n")
- routerConfig.write("#\n")
-
- for l in xtraConfig:
- routerConfig.write(l)
- routerConfig.write("\n")
-
- #
- # We configure the AddProxy constraints as a configuration file.
- # Regular expression syntax can easily confuse the command line.
- #
- if not len(acceptFilter) == 0:
- routerConfig.write("Glacier2.Filter.Address.Accept=%s\n" % acceptFilter)
- if not len(rejectFilter) == 0:
- routerConfig.write("Glacier2.Filter.Address.Reject=%s\n" % rejectFilter)
- if not len(maxEndpoints) == 0:
- routerConfig.write("Glacier2.Filter.ProxySizeMax=%s\n" % maxEndpoints)
- if not len(categoryFilter) == 0:
- routerConfig.write("Glacier2.Filter.Category.Accept=%s\n" % categoryFilter)
- if not len(idFilter) == 0:
- routerConfig.write("Glacier2.Filter.Identity.Accept=%s\n" % idFilter)
- if not len(adapterFilter) == 0:
- routerConfig.write("Glacier2.Filter.AdapterId.Accept=%s\n" % adapterFilter)
-
- routerConfig.close()
-
- #
- # We need to override the test driver defaults for the Ice.Default.Host if
- # it is set to loopback.
- #
- routerDriver = TestUtil.DriverConfig("server")
- if routerDriver.host == None:
- routerDriver.host = ""
- routerDriver.overrides = commonServerOptions + routerArgs
-
- starterProc = TestUtil.startServer(router, config=routerDriver, count=2)
- pingProgress()
-
- if TestUtil.protocol != "ssl":
- serverConfig = open(os.path.join(os.getcwd(), "server.cfg"), "w")
- serverOptions = ' --Ice.Config="' + os.path.join(os.getcwd(), "server.cfg") + '" '
- serverConfig.write("BackendAdapter.Endpoints=tcp -p 12010\n")
- serverConfig.close()
- else:
- serverOptions = ""
-
- serverDriver = TestUtil.DriverConfig("server")
- if serverDriver.host == None:
- serverDriver.host = ""
- serverDriver.overrides = commonServerOptions
- serverProc = TestUtil.startServer(serverCmd, serverOptions, serverDriver)
- pingProgress()
-
- sys.stdout.write(' ')
- sys.stdout.flush()
-
- #
- # The client is responsible for reporting success or failure. A test
- # failure will result in an assertion and the test will abort.
- #
- clientDriver = TestUtil.DriverConfig("client")
- if clientDriver.host == None:
- clientDriver.host = ""
- clientDriver.host = commonClientOptions
- clientArgs = ' --Ice.Config="%s"' % os.path.join(os.getcwd(), 'attack.cfg')
- clientProc = TestUtil.startClient(clientCmd, clientArgs, clientDriver)
- clientProc.waitTestSuccess()
- serverProc.waitTestSuccess()
- starterProc.waitTestSuccess()
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets)
diff --git a/cpp/test/Glacier2/staticFiltering/test.py b/cpp/test/Glacier2/staticFiltering/test.py
new file mode 100644
index 00000000000..710ba3faabc
--- /dev/null
+++ b/cpp/test/Glacier2/staticFiltering/test.py
@@ -0,0 +1,294 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class Glacier2StaticFilteringTestCase(ClientServerTestCase):
+
+ def __init__(self, testcase, hostname):
+ self.hostname = hostname
+ description, self.tcArgs, self.attacks, self.xtraConfig = testcase
+
+ clientProps = { "Ice.Config" : "{testdir}/client.cfg", "Ice.Warn.Connections" : 0 }
+ serverProps = { "Ice.Config" : "{testdir}/server.cfg", "Ice.Warn.Connections" : 0 }
+ routerProps = { "Ice.Config" : "{testdir}/router.cfg", "Glacier2.RoutingTable.MaxSize" : 10 }
+
+ ClientServerTestCase.__init__(self,
+ description,
+ desc=description,
+ servers=[Glacier2Router(props=routerProps), Server(props=serverProps)],
+ client=Client(props=clientProps))
+
+ def setupClientSide(self, current):
+ current.write("testing {0}... ".format(self))
+
+ def setupServerSide(self, current):
+ acceptFilter, rejectFilter, maxEndpoints, categoryFilter, idFilter, adapterFilter = self.tcArgs
+
+ #
+ # The test client performs multiple tests during one 'run'. We could
+ # use command line arguments to pass the test cases in, but a
+ # configuration file is easier.
+ #
+ with open(os.path.join(self.getTestSuite().getPath(), 'client.cfg'), 'w') as clientConfig:
+ accepts=0
+ rejects=0
+ for expect, proxy in self.attacks:
+ if expect:
+ clientConfig.write('Accept.Proxy.' + str(accepts) + '=')
+ accepts +=1
+ else:
+ clientConfig.write('Reject.Proxy.' + str(rejects) + '=')
+ rejects +=1
+ clientConfig.write(proxy + '\n')
+
+ with open(os.path.join(self.getTestSuite().getPath(), 'server.cfg'), 'w') as serverConfig:
+ if current.config.protocol != "ssl":
+ serverConfig.write("BackendAdapter.Endpoints=tcp -p 12010\n")
+
+ with open(os.path.join(self.getTestSuite().getPath(), "router.cfg"), "w") as routerConfig:
+ routerConfig.write("Ice.Default.Locator=locator:tcp -h %s -p 12010\n" % self.hostname)
+ routerConfig.write("Glacier2.Client.Trace.Reject=0\n")
+ routerConfig.write("#\n")
+
+ for l in self.xtraConfig:
+ routerConfig.write(l)
+ routerConfig.write("\n")
+
+ #
+ # We configure the AddProxy constraints as a configuration file.
+ # Regular expression syntax can easily confuse the command line.
+ #
+ if not len(acceptFilter) == 0:
+ routerConfig.write("Glacier2.Filter.Address.Accept=%s\n" % acceptFilter)
+ if not len(rejectFilter) == 0:
+ routerConfig.write("Glacier2.Filter.Address.Reject=%s\n" % rejectFilter)
+ if not len(maxEndpoints) == 0:
+ routerConfig.write("Glacier2.Filter.ProxySizeMax=%s\n" % maxEndpoints)
+ if not len(categoryFilter) == 0:
+ routerConfig.write("Glacier2.Filter.Category.Accept=%s\n" % categoryFilter)
+ if not len(idFilter) == 0:
+ routerConfig.write("Glacier2.Filter.Identity.Accept=%s\n" % idFilter)
+ if not len(adapterFilter) == 0:
+ routerConfig.write("Glacier2.Filter.AdapterId.Accept=%s\n" % adapterFilter)
+
+class Glacier2StaticFilteringTestSuite(Glacier2TestSuite):
+
+ def setup(self, current):
+
+ Glacier2TestSuite.setup(self, current)
+
+ import socket
+
+ hostname = socket.gethostname().lower()
+ fqdn = socket.getfqdn().lower()
+
+ limitedTests = False
+
+ #
+ # Try and figure out what tests are reasonable with this host's
+ # configuration.
+ #
+ if fqdn.endswith("localdomain") or fqdn.endswith("local") or fqdn.endswith("domain"):
+ #
+ # No real configured domain name, this means that anything that
+ # requires a domain name isn't likely going to work. Furthermore, it
+ # might be the case that the hostname contains this suffix, so we
+ # should just toss it and pretend that there is no 'hostname'
+ # configured for this box.
+ #
+ hostname = "127.0.0.1"
+ fqdn = ""
+ domainname = ""
+ limitedTests = True
+ elif hostname.startswith("localhost"):
+ #
+ # No configured host name (and possibly no domain name), minimal
+ # tests.
+ #
+ hostname = "127.0.0.1"
+ fqdn = ""
+ domainname = ""
+ limitedTests = True
+ elif fqdn.find(".") == -1:
+ #
+ # No real configured domain.
+ #
+ hostname = "127.0.0.1"
+ fqdn = ""
+ domainname = ""
+ limitedTests = True
+ else:
+ dot = fqdn.find(".")
+ domainname = fqdn[dot+1:]
+ #
+ # Some Python installs are going to return a FQDN for gethostname().
+ # This invalidates the tests that need to differentiate between the
+ # hostname and the FQDN. If these tests fail because of a DNS error,
+ # it may be that an alias is not present for the host partition of
+ # the FQDN.
+ #
+ if fqdn == hostname:
+ hostname = hostname[:dot]
+ if domainname == "":
+ limitedTests = True
+ try:
+ testaddr1 = socket.gethostbyname(fqdn)
+ testaddr2 = socket.gethostbyname(hostname)
+
+ # On SuSE distributions, 127.0.0.2 is sometime used in /etc/hosts
+ # for the hostname (apparently if no network interface was found
+ # when the OS was installed). However, connecting to this IP addr
+ # doesn't work (even if can be "ping").
+ if testaddr1 == "127.0.0.2" or testaddr2 == "127.0.0.2":
+ limitedTests = True
+ hostname = "127.0.0.1"
+ fqdn = ""
+ domainname = ""
+ except:
+ limitedTests = True
+ hostname = "127.0.0.1"
+ fqdn = ""
+ domainname = ""
+
+ testcases = [
+ ('testing category filter',
+ ('', '', '', 'foo "a cat with spaces"', '', ''),
+ [(True, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010')], []),
+ ('testing adapter id filter',
+ ('', '*', '', '', '', 'foo "an adapter with spaces"'),
+ [(False, 'foo/helloA:tcp -h 127.0.0.1 -p 12010'),
+ (False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'helloE @ bar'),
+ (True, 'helloF1 @ "an adapter with spaces"'),
+ (True, 'helloF @ foo')], []),
+ ('test identity filters',
+ ('', '', '', '', 'myident cata/fooa "a funny id/that might mess it up"', ''),
+ [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'myident:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
+ ('test mixing filters',
+ ('', '', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up" "a\\"nother"',
+ 'myadapter'),
+ [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'),
+ (True, 'mycat/foo @ jimbo'),
+ (False, 'hiscatA @ jimbo'),
+ (True, 'hiscat @ myadapter'),
+ (True, 'a\"nother @ jimbo'),
+ (True, 'myident:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
+ ('test mixing filters (indirect only)',
+ ('', '*', '', 'mycat "a sec cat"', 'myident cata/fooa "a funny id/that might mess it up"', 'myadapter'),
+ [(False, '"a cat with spaces/helloB":tcp -h 127.0.0.1 -p 12010'),
+ (False, 'nocat/helloC:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/helloD:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'baz/myident:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cata/foo:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'mycat/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (False, '"a sec cat/fooa":tcp -h 127.0.0.1 -p 12010'),
+ (True, 'mycat/foo @ jimbo'),
+ (False, 'hiscatA @ jimbo'),
+ (True, 'hiscat @ myadapter'),
+ (False, 'myident:tcp -h 127.0.0.1 -p 12010'),
+ (False, 'cata/fooa:tcp -h 127.0.0.1 -p 12010'),
+ (True, '"a funny id/that might mess it up" @ myadapter'),
+ (False, '"a funny id/that might mess it up":tcp -h 127.0.0.1 -p 12010')], []),
+ ]
+
+ if not limitedTests:
+ testcases.extend([
+ ('testing reject all',
+ ('', '*', '', '', '', ''),
+ [(False, 'helloA:tcp -h %s -p 12010' % fqdn),
+ (False, 'helloB:tcp -h %s -p 12010' % hostname),
+ (False, 'helloC:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'bar @ foo')], []),
+ ('testing loopback only rule',
+ ('127.0.0.1 localhost', '', '', '', '', ''),
+ [(False, 'hello:tcp -h %s -p 12010' % fqdn),
+ (False, 'hello:tcp -h %s -p 12010' % hostname),
+ (False, '127.0.0.1:tcp -h %s -p 12010' % hostname),
+ (False, 'localhost:tcp -h %s -p 12010' % hostname),
+ (False, 'localhost/127.0.0.1:tcp -h %s -p 12010' % hostname),
+ (True, 'localhost:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'localhost/127.0.0.1:tcp -h localhost -p 12010'),
+ (True, 'hello:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'hello/somecat:tcp -h localhost -p 12010')], []),
+ ('testing port filter rule',
+ ('127.0.0.1:12010 localhost:12010', '', '', '', '', ''),
+ [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'),
+ (False, 'hello2:tcp -h localhost -p 12011'),
+ (False, 'hello5:tcp -h %s -p 12010' % hostname),
+ (True, 'hello3:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'hello4:tcp -h localhost -p 12010')], []),
+ ('testing reject port filter rule',
+ ('', '127.0.0.1:[0-12009,12011-65535] localhost:[0-12009,12011-65535]', '', '', '', ''),
+ [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'),
+ (False, 'hello2:tcp -h localhost -p 12011'),
+ (True, 'hello5:tcp -h %s -p 12010' % hostname),
+ (True, 'hello3:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'hello4:tcp -h localhost -p 12010')], []),
+ ('testing port filter rule with wildcard address rule',
+ ('*:12010', '', '', '', '', ''),
+ [(False, 'hello1:tcp -h 127.0.0.1 -p 12011'),
+ (False, 'hello2:tcp -h localhost -p 12011'),
+ (True, 'hello5:tcp -h %s -p 12010' % hostname),
+ (True, 'hello3:tcp -h 127.0.0.1 -p 12010'),
+ (True, 'hello4:tcp -h localhost -p 12010')], []),
+ ('testing domain filter rule (accept)',
+ ("*" + domainname, '', '', '', '', ''),
+ [(True, 'hello:tcp -h %s -p 12010' % fqdn),
+ (False, 'hello:tcp -h %s -p 12010' % hostname)], []),
+ ('testing domain filter rule (reject)',
+ ('', "*" + domainname, '', '', '', ''),
+ [(False, 'hello:tcp -h %s -p 12010' % fqdn),
+ (True, 'hello:tcp -h %s -p 12010' % hostname),
+ (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []),
+ ('testing domain filter rule (mixed)',
+ ("127.0.0.1", fqdn, '', '', '', ''),
+ [(False, 'hello:tcp -h %s -p 12010:tcp -h 127.0.0.1 -p 12010' % fqdn),
+ (True, 'bar:tcp -h 127.0.0.1 -p 12010')], []),
+ ('testing maximum proxy length rule',
+ ('', '', '53', '', '', ''),
+ [(True, 'hello:tcp -h 127.0.0.1 -p 12010 -t infinite'),
+ (False, '012345678901234567890123456789012345678901234567890123456789:tcp -h 127.0.0.1 -p 12010')], []),
+ ])
+
+ if len(testcases) == 0:
+ current.writeln("WARNING: You are running this test with SSL disabled and the network ")
+ current.writeln(" configuration for this host does not permit the other tests ")
+ current.writeln(" to run correctly.")
+ elif len(testcases) < 6:
+ current.writeln("WARNING: The network configuration for this host does not permit all ")
+ current.writeln(" tests to run correctly, some tests have been disabled.")
+
+ self.testcases = {}
+ for testcase in testcases:
+ self.addTestCase(Glacier2StaticFilteringTestCase(testcase, hostname))
+
+Glacier2StaticFilteringTestSuite(__name__, testcases=[], runOnMainThread=True, options={ "ipv6" : [False] }, multihost=False)
diff --git a/cpp/test/Ice/acm/Client.cpp b/cpp/test/Ice/acm/Client.cpp
index 55f24fafec1..50ff5687f93 100644
--- a/cpp/test/Ice/acm/Client.cpp
+++ b/cpp/test/Ice/acm/Client.cpp
@@ -35,8 +35,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/acm/Server.cpp b/cpp/test/Ice/acm/Server.cpp
index d2af92e45f8..068441bada3 100644
--- a/cpp/test/Ice/acm/Server.cpp
+++ b/cpp/test/Ice/acm/Server.cpp
@@ -42,8 +42,7 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.ACM.Timeout", "1");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/acm/run.py b/cpp/test/Ice/acm/run.py
deleted file mode 100755
index eb60390efe1..00000000000
--- a/cpp/test/Ice/acm/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/adapterDeactivation/AllTests.cpp b/cpp/test/Ice/adapterDeactivation/AllTests.cpp
index c1aa649be20..558c939d5ef 100644
--- a/cpp/test/Ice/adapterDeactivation/AllTests.cpp
+++ b/cpp/test/Ice/adapterDeactivation/AllTests.cpp
@@ -42,26 +42,20 @@ allTests(const CommunicatorPtr& communicator)
if(!winrt || (communicator->getProperties()->getProperty("Ice.Default.Protocol") != "ssl" &&
communicator->getProperties()->getProperty("Ice.Default.Protocol") != "wss"))
{
- string host = communicator->getProperties()->getPropertyAsIntWithDefault("Ice.IPv6", 0) == 0 ?
- "127.0.0.1" : "\"0:0:0:0:0:0:0:1\"";
cout << "creating/destroying/recreating object adapter... " << flush;
- ObjectAdapterPtr adapter =
- communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -h " + host);
+ ObjectAdapterPtr adpt = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
try
{
- communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -h " + host);
+ communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
test(false);
}
catch(const AlreadyRegisteredException&)
{
}
- adapter->destroy();
+ adpt->destroy();
- //
- // Use a different port than the first adapter to avoid an "address already in use" error.
- //
- adapter = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -h " + host);
- adapter->destroy();
+ adpt = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default");
+ adpt->destroy();
cout << "ok" << endl;
}
}
diff --git a/cpp/test/Ice/adapterDeactivation/Client.cpp b/cpp/test/Ice/adapterDeactivation/Client.cpp
index 57d213db18c..10bb6c1ddc8 100644
--- a/cpp/test/Ice/adapterDeactivation/Client.cpp
+++ b/cpp/test/Ice/adapterDeactivation/Client.cpp
@@ -36,7 +36,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/adapterDeactivation/Collocated.cpp b/cpp/test/Ice/adapterDeactivation/Collocated.cpp
index 1314d809f42..2be431c8db5 100644
--- a/cpp/test/Ice/adapterDeactivation/Collocated.cpp
+++ b/cpp/test/Ice/adapterDeactivation/Collocated.cpp
@@ -48,7 +48,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp
index 02ae90f5771..b73ef715829 100644
--- a/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp
+++ b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp
@@ -44,11 +44,9 @@ ServantLocatorI::locate(const Ice::Current& current, Ice::LocalObjectPtr& cookie
void
#ifdef ICE_CPP11_MAPPING
-ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&,
- const std::shared_ptr<void>& cookie)
+ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&, const std::shared_ptr<void>& cookie)
#else
-ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&,
- const Ice::LocalObjectPtr& cookie)
+ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr& cookie)
#endif
{
test(!_deactivated);
diff --git a/cpp/test/Ice/adapterDeactivation/Server.cpp b/cpp/test/Ice/adapterDeactivation/Server.cpp
index 622787f1676..b737e236f68 100644
--- a/cpp/test/Ice/adapterDeactivation/Server.cpp
+++ b/cpp/test/Ice/adapterDeactivation/Server.cpp
@@ -38,7 +38,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/adapterDeactivation/TestI.cpp b/cpp/test/Ice/adapterDeactivation/TestI.cpp
index 2f8f2e29e77..f318420ab1d 100644
--- a/cpp/test/Ice/adapterDeactivation/TestI.cpp
+++ b/cpp/test/Ice/adapterDeactivation/TestI.cpp
@@ -10,6 +10,7 @@
#include <IceUtil/IceUtil.h>
#include <Ice/Ice.h>
#include <TestI.h>
+#include <TestCommon.h>
using namespace std;
using namespace Ice;
@@ -18,9 +19,8 @@ void
TestI::transient(const Current& current)
{
CommunicatorPtr communicator = current.adapter->getCommunicator();
-
- ObjectAdapterPtr adapter =
- communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
+ ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("TransientTestAdapter",
+ getTestEndpoint(communicator, 1));
adapter->activate();
adapter->destroy();
}
diff --git a/cpp/test/Ice/adapterDeactivation/run.py b/cpp/test/Ice/adapterDeactivation/run.py
deleted file mode 100755
index 2d96b653cfa..00000000000
--- a/cpp/test/Ice/adapterDeactivation/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/admin/Client.cpp b/cpp/test/Ice/admin/Client.cpp
index 2b954f4ac2a..1fcfc0a05ad 100644
--- a/cpp/test/Ice/admin/Client.cpp
+++ b/cpp/test/Ice/admin/Client.cpp
@@ -32,7 +32,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/admin/Server.cpp b/cpp/test/Ice/admin/Server.cpp
index c18d954e2ef..729f9bd73ea 100644
--- a/cpp/test/Ice/admin/Server.cpp
+++ b/cpp/test/Ice/admin/Server.cpp
@@ -37,7 +37,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/admin/run.py b/cpp/test/Ice/admin/run.py
deleted file mode 100755
index eb60390efe1..00000000000
--- a/cpp/test/Ice/admin/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/ami/Client.cpp b/cpp/test/Ice/ami/Client.cpp
index 9e4c0e234c7..660157236f5 100644
--- a/cpp/test/Ice/ami/Client.cpp
+++ b/cpp/test/Ice/ami/Client.cpp
@@ -35,8 +35,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.AMICallback", "0");
//
diff --git a/cpp/test/Ice/ami/Collocated.cpp b/cpp/test/Ice/ami/Collocated.cpp
index 0f9abd96355..46d1aec0736 100644
--- a/cpp/test/Ice/ami/Collocated.cpp
+++ b/cpp/test/Ice/ami/Collocated.cpp
@@ -48,8 +48,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.AMICallback", "0");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/ami/Server.cpp b/cpp/test/Ice/ami/Server.cpp
index 7c0ebd03b42..b021aa221eb 100644
--- a/cpp/test/Ice/ami/Server.cpp
+++ b/cpp/test/Ice/ami/Server.cpp
@@ -48,8 +48,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// This test kills connections, so we don't want warnings.
diff --git a/cpp/test/Ice/ami/run.py b/cpp/test/Ice/ami/run.py
deleted file mode 100755
index 2d96b653cfa..00000000000
--- a/cpp/test/Ice/ami/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/background/Client.cpp b/cpp/test/Ice/background/Client.cpp
index f0c60ee8128..c4b2e4fe416 100644
--- a/cpp/test/Ice/background/Client.cpp
+++ b/cpp/test/Ice/background/Client.cpp
@@ -32,8 +32,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// For this test, we want to disable retries.
@@ -46,7 +45,7 @@ main(int argc, char* argv[])
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.MessageSizeMax", "50000");
-
+
// This test relies on filling the TCP send/recv buffer, so
// we rely on a fixed value for these buffers.
initData.properties->setProperty("Ice.TCP.SndSize", "50000");
diff --git a/cpp/test/Ice/background/Server.cpp b/cpp/test/Ice/background/Server.cpp
index 3f13ca8fbb3..84545c8a271 100644
--- a/cpp/test/Ice/background/Server.cpp
+++ b/cpp/test/Ice/background/Server.cpp
@@ -149,8 +149,7 @@ main(int argc, char* argv[])
{
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// This test kills connections, so we don't want warnings.
diff --git a/cpp/test/Ice/background/run.py b/cpp/test/Ice/background/run.py
deleted file mode 100755
index b53b591197e..00000000000
--- a/cpp/test/Ice/background/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testtransport"))])
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp
index 8754af1bd28..cc6bc02cdd6 100644
--- a/cpp/test/Ice/binding/AllTests.cpp
+++ b/cpp/test/Ice/binding/AllTests.cpp
@@ -916,19 +916,26 @@ allTests(const Ice::CommunicatorPtr& communicator)
clientProps.push_back(bothPreferIPv4);
clientProps.push_back(bothPreferIPv6);
+ string endpoint;
+ {
+ ostringstream str;
+ str << "tcp -p " << getTestPort(communicator->getProperties(), 2);
+ endpoint = str.str();
+ }
+
Ice::PropertiesPtr anyipv4 = ipv4->clone();
- anyipv4->setProperty("Adapter.Endpoints", "tcp -p 12012");
- anyipv4->setProperty("Adapter.PublishedEndpoints", "tcp -h 127.0.0.1 -p 12012");
+ anyipv4->setProperty("Adapter.Endpoints", endpoint);
+ anyipv4->setProperty("Adapter.PublishedEndpoints", endpoint + " -h 127.0.0.1");
Ice::PropertiesPtr anyipv6 = ipv6->clone();
- anyipv6->setProperty("Adapter.Endpoints", "tcp -p 12012");
- anyipv6->setProperty("Adapter.PublishedEndpoints", "tcp -h \"::1\" -p 12012");
+ anyipv6->setProperty("Adapter.Endpoints", endpoint);
+ anyipv6->setProperty("Adapter.PublishedEndpoints", endpoint + " -h \"::1\"");
Ice::PropertiesPtr anyboth = Ice::createProperties();
anyboth->setProperty("Ice.IPv4", "1");
anyboth->setProperty("Ice.IPv6", "1");
- anyboth->setProperty("Adapter.Endpoints", "tcp -p 12012");
- anyboth->setProperty("Adapter.PublishedEndpoints", "tcp -h \"::1\" -p 12012:tcp -h 127.0.0.1 -p 12012");
+ anyboth->setProperty("Adapter.Endpoints", endpoint);
+ anyboth->setProperty("Adapter.PublishedEndpoints", endpoint + " -p 12012:" + endpoint + " -p 12012");
Ice::PropertiesPtr localipv4 = ipv4->clone();
localipv4->setProperty("Adapter.Endpoints", "tcp -h 127.0.0.1");
diff --git a/cpp/test/Ice/binding/Client.cpp b/cpp/test/Ice/binding/Client.cpp
index 9bc4acff3a4..c9ea03062c5 100644
--- a/cpp/test/Ice/binding/Client.cpp
+++ b/cpp/test/Ice/binding/Client.cpp
@@ -35,7 +35,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/binding", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
rc.finished(status);
diff --git a/cpp/test/Ice/binding/Server.cpp b/cpp/test/Ice/binding/Server.cpp
index 431e7dfe3f2..a7fae8974a7 100644
--- a/cpp/test/Ice/binding/Server.cpp
+++ b/cpp/test/Ice/binding/Server.cpp
@@ -41,7 +41,8 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/binding/TestI.cpp b/cpp/test/Ice/binding/TestI.cpp
index 38c1b92e2e9..f191b1c176a 100644
--- a/cpp/test/Ice/binding/TestI.cpp
+++ b/cpp/test/Ice/binding/TestI.cpp
@@ -9,12 +9,13 @@
#include <Ice/Ice.h>
#include <TestI.h>
+#include <TestCommon.h>
using namespace std;
using namespace Ice;
using namespace Test;
-RemoteCommunicatorI::RemoteCommunicatorI() : _nextPort(10001)
+RemoteCommunicatorI::RemoteCommunicatorI() : _nextPort(1)
{
}
@@ -34,18 +35,14 @@ RemoteCommunicatorI::createObjectAdapter(const string& name, const string& endpt
{
if(endpoints.find("-p") == string::npos)
{
- // Use a fixed port if none is specified (bug 2896)
- ostringstream os;
- os << endpoints << " -h \""
- << (com->getProperties()->getPropertyWithDefault("Ice.Default.Host", "127.0.0.1"))
- << "\" -p " << _nextPort++;
- endpoints = os.str();
+ endpoints = getTestEndpoint(com, _nextPort++, endpoints);
}
}
-
+
com->getProperties()->setProperty(name + ".ThreadPool.Size", "1");
ObjectAdapterPtr adapter = com->createObjectAdapterWithEndpoints(name, endpoints);
- return ICE_UNCHECKED_CAST(RemoteObjectAdapterPrx, current.adapter->addWithUUID(ICE_MAKE_SHARED(RemoteObjectAdapterI, adapter)));
+ return ICE_UNCHECKED_CAST(RemoteObjectAdapterPrx,
+ current.adapter->addWithUUID(ICE_MAKE_SHARED(RemoteObjectAdapterI, adapter)));
}
#ifdef ICE_CPP11_MAPPING
@@ -65,10 +62,10 @@ RemoteCommunicatorI::shutdown(const Ice::Current& current)
current.adapter->getCommunicator()->shutdown();
}
-RemoteObjectAdapterI::RemoteObjectAdapterI(const Ice::ObjectAdapterPtr& adapter) :
- _adapter(adapter),
- _testIntf(ICE_UNCHECKED_CAST(TestIntfPrx,
- _adapter->add(ICE_MAKE_SHARED(TestI),
+RemoteObjectAdapterI::RemoteObjectAdapterI(const Ice::ObjectAdapterPtr& adapter) :
+ _adapter(adapter),
+ _testIntf(ICE_UNCHECKED_CAST(TestIntfPrx,
+ _adapter->add(ICE_MAKE_SHARED(TestI),
stringToIdentity("test"))))
{
_adapter->activate();
diff --git a/cpp/test/Ice/binding/run.py b/cpp/test/Ice/binding/run.py
deleted file mode 100755
index eb60390efe1..00000000000
--- a/cpp/test/Ice/binding/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/checksum/Client.cpp b/cpp/test/Ice/checksum/Client.cpp
index 03a6010177e..e2b795b39bf 100644
--- a/cpp/test/Ice/checksum/Client.cpp
+++ b/cpp/test/Ice/checksum/Client.cpp
@@ -31,8 +31,9 @@ main(int argc, char* argv[])
Ice::registerIceSSL();
#endif
try
- {
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ {
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/checksum/Server.cpp b/cpp/test/Ice/checksum/Server.cpp
index 42d986b2dbf..8e11a544e0e 100644
--- a/cpp/test/Ice/checksum/Server.cpp
+++ b/cpp/test/Ice/checksum/Server.cpp
@@ -35,7 +35,8 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/checksum/run.py b/cpp/test/Ice/checksum/run.py
deleted file mode 100755
index eb60390efe1..00000000000
--- a/cpp/test/Ice/checksum/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/custom/Client.cpp b/cpp/test/Ice/custom/Client.cpp
index 0ab1c20d832..b7880e9021f 100644
--- a/cpp/test/Ice/custom/Client.cpp
+++ b/cpp/test/Ice/custom/Client.cpp
@@ -40,7 +40,8 @@ main(int argc, char** argv)
setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI));
setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI));
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/custom/Collocated.cpp b/cpp/test/Ice/custom/Collocated.cpp
index 6eda30c718a..0d5e50e9aff 100644
--- a/cpp/test/Ice/custom/Collocated.cpp
+++ b/cpp/test/Ice/custom/Collocated.cpp
@@ -46,7 +46,8 @@ main(int argc, char** argv)
setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI));
setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI));
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/custom/Server.cpp b/cpp/test/Ice/custom/Server.cpp
index c6361f7c0c5..c3b8a90e21a 100644
--- a/cpp/test/Ice/custom/Server.cpp
+++ b/cpp/test/Ice/custom/Server.cpp
@@ -47,7 +47,8 @@ main(int argc, char** argv)
setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI));
setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI));
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/custom/ServerAMD.cpp b/cpp/test/Ice/custom/ServerAMD.cpp
index c64aca0aac4..275c7147158 100644
--- a/cpp/test/Ice/custom/ServerAMD.cpp
+++ b/cpp/test/Ice/custom/ServerAMD.cpp
@@ -47,7 +47,8 @@ main(int argc, char** argv)
setProcessStringConverter(ICE_MAKE_SHARED(Test::StringConverterI));
setProcessWstringConverter(ICE_MAKE_SHARED(Test::WstringConverterI));
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/custom/run.py b/cpp/test/Ice/custom/run.py
deleted file mode 100755
index 7921ce9e9ff..00000000000
--- a/cpp/test/Ice/custom/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server = TestUtil.getTestExecutable("serveramd"))
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/custom/test.py b/cpp/test/Ice/custom/test.py
new file mode 100644
index 00000000000..0e56af0590d
--- /dev/null
+++ b/cpp/test/Ice/custom/test.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+# Don't run this test with SSL, it doesn't work on Windows, see ICE-4588
+TestSuite(__name__, options = { "protocol" : ["tcp", "ws"] })
diff --git a/cpp/test/Ice/defaultServant/Client.cpp b/cpp/test/Ice/defaultServant/Client.cpp
index d6600fdce36..c8c6f178e64 100644
--- a/cpp/test/Ice/defaultServant/Client.cpp
+++ b/cpp/test/Ice/defaultServant/Client.cpp
@@ -32,7 +32,8 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/defaultServant/run.py b/cpp/test/Ice/defaultServant/run.py
deleted file mode 100755
index 874ef6a5125..00000000000
--- a/cpp/test/Ice/defaultServant/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice-E is licensed to you under the terms described in the
-# ICEE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-TestUtil.simpleTest(client)
diff --git a/cpp/test/Ice/defaultValue/run.py b/cpp/test/Ice/defaultValue/run.py
deleted file mode 100755
index 1a758d84c41..00000000000
--- a/cpp/test/Ice/defaultValue/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client)
diff --git a/cpp/test/Ice/dispatcher/Client.cpp b/cpp/test/Ice/dispatcher/Client.cpp
index 6440ce065f3..6bb5c265977 100644
--- a/cpp/test/Ice/dispatcher/Client.cpp
+++ b/cpp/test/Ice/dispatcher/Client.cpp
@@ -33,8 +33,7 @@ main(int argc, char* argv[])
int status;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// Limit the send buffer size, this test relies on the socket
diff --git a/cpp/test/Ice/dispatcher/Collocated.cpp b/cpp/test/Ice/dispatcher/Collocated.cpp
index 05592f5a8ed..6d91c93a3c4 100644
--- a/cpp/test/Ice/dispatcher/Collocated.cpp
+++ b/cpp/test/Ice/dispatcher/Collocated.cpp
@@ -48,8 +48,7 @@ main(int argc, char* argv[])
int status;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
#ifdef ICE_CPP11_MAPPING
IceUtil::Handle<Dispatcher> dispatcher = new Dispatcher;
initData.dispatcher = [=](function<void()> call, const shared_ptr<Ice::Connection>& conn)
diff --git a/cpp/test/Ice/dispatcher/Server.cpp b/cpp/test/Ice/dispatcher/Server.cpp
index 08dc9b75e17..fa8cf0a1323 100644
--- a/cpp/test/Ice/dispatcher/Server.cpp
+++ b/cpp/test/Ice/dispatcher/Server.cpp
@@ -49,8 +49,7 @@ main(int argc, char* argv[])
int status;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// Limit the recv buffer size, this test relies on the socket
diff --git a/cpp/test/Ice/dispatcher/run.py b/cpp/test/Ice/dispatcher/run.py
deleted file mode 100755
index 2d96b653cfa..00000000000
--- a/cpp/test/Ice/dispatcher/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/echo/Server.cpp b/cpp/test/Ice/echo/Server.cpp
index 9d80f8833a9..397509df120 100644
--- a/cpp/test/Ice/echo/Server.cpp
+++ b/cpp/test/Ice/echo/Server.cpp
@@ -69,8 +69,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/Ice/echo/run.py b/cpp/test/Ice/echo/run.py
deleted file mode 100755
index 2f0c3b6439d..00000000000
--- a/cpp/test/Ice/echo/run.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-sys.stdout.write("starting server... ")
-sys.stdout.flush()
-server = server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server"))
-p = TestUtil.startServer(server)
-print("ok")
-sys.stdout.flush()
-p.waitTestSuccess()
diff --git a/cpp/test/Ice/echo/test.py b/cpp/test/Ice/echo/test.py
new file mode 100644
index 00000000000..27ced12e84c
--- /dev/null
+++ b/cpp/test/Ice/echo/test.py
@@ -0,0 +1,15 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class EchoServerTestCase(ClientServerTestCase):
+
+ def runClientSide(self, current):
+ pass
+
+TestSuite(__name__, [EchoServerTestCase(name="server", server=Server(waitForShutdown=False))])
diff --git a/cpp/test/Ice/enums/Client.cpp b/cpp/test/Ice/enums/Client.cpp
index 14156675eb7..981c32ec106 100644
--- a/cpp/test/Ice/enums/Client.cpp
+++ b/cpp/test/Ice/enums/Client.cpp
@@ -37,7 +37,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/enums", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
rc.finished(status);
diff --git a/cpp/test/Ice/enums/Server.cpp b/cpp/test/Ice/enums/Server.cpp
index 45dec2632e4..f73bd41e86a 100644
--- a/cpp/test/Ice/enums/Server.cpp
+++ b/cpp/test/Ice/enums/Server.cpp
@@ -38,7 +38,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/enums/run.py b/cpp/test/Ice/enums/run.py
deleted file mode 100755
index 22809a25c68..00000000000
--- a/cpp/test/Ice/enums/run.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueClientServerTest(configName = "1.1", message = "Running test with 1.1 encoding.")
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/exceptions/Client.cpp b/cpp/test/Ice/exceptions/Client.cpp
index 650503900ba..ea868afb18a 100644
--- a/cpp/test/Ice/exceptions/Client.cpp
+++ b/cpp/test/Ice/exceptions/Client.cpp
@@ -37,8 +37,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max
diff --git a/cpp/test/Ice/exceptions/Collocated.cpp b/cpp/test/Ice/exceptions/Collocated.cpp
index 063bbd25e1a..6a2e5ad8f2b 100644
--- a/cpp/test/Ice/exceptions/Collocated.cpp
+++ b/cpp/test/Ice/exceptions/Collocated.cpp
@@ -39,8 +39,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
diff --git a/cpp/test/Ice/exceptions/Server.cpp b/cpp/test/Ice/exceptions/Server.cpp
index 2a95948c06a..51ad11f564f 100644
--- a/cpp/test/Ice/exceptions/Server.cpp
+++ b/cpp/test/Ice/exceptions/Server.cpp
@@ -47,8 +47,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max
diff --git a/cpp/test/Ice/exceptions/ServerAMD.cpp b/cpp/test/Ice/exceptions/ServerAMD.cpp
index 528b0e7ee03..c6d87272714 100644
--- a/cpp/test/Ice/exceptions/ServerAMD.cpp
+++ b/cpp/test/Ice/exceptions/ServerAMD.cpp
@@ -47,8 +47,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.MessageSizeMax", "10"); // 10KB max
diff --git a/cpp/test/Ice/exceptions/run.py b/cpp/test/Ice/exceptions/run.py
deleted file mode 100755
index 00f2bf56951..00000000000
--- a/cpp/test/Ice/exceptions/run.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.")
-
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.",
- additionalClientOptions="--Ice.Default.SlicedFormat",
- additionalServerOptions="--Ice.Default.SlicedFormat")
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueClientServerTest(configName = "compactAMD", localOnly = True,
- message = "Running test with compact (default) format and AMD server.",
- server=TestUtil.getTestExecutable("serveramd"))
-
-TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True,
- message = "Running test with sliced format and AMD server.",
- server=TestUtil.getTestExecutable("serveramd"),
- additionalClientOptions="--Ice.Default.SlicedFormat",
- additionalServerOptions="--Ice.Default.SlicedFormat")
-
-TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True,
- message = "Running test with 1.0 encoding and AMD server.",
- server=TestUtil.getTestExecutable("serveramd"),
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/facets/Client.cpp b/cpp/test/Ice/facets/Client.cpp
index 9e970a20bc8..94f9d76a1e0 100644
--- a/cpp/test/Ice/facets/Client.cpp
+++ b/cpp/test/Ice/facets/Client.cpp
@@ -37,7 +37,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/facets", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
rc.finished(status);
diff --git a/cpp/test/Ice/facets/Collocated.cpp b/cpp/test/Ice/facets/Collocated.cpp
index 21460a5806c..f5c372212f1 100644
--- a/cpp/test/Ice/facets/Collocated.cpp
+++ b/cpp/test/Ice/facets/Collocated.cpp
@@ -44,7 +44,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/facets/Server.cpp b/cpp/test/Ice/facets/Server.cpp
index 92d0b838bd5..12230ed64e4 100644
--- a/cpp/test/Ice/facets/Server.cpp
+++ b/cpp/test/Ice/facets/Server.cpp
@@ -43,7 +43,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/facets/run.py b/cpp/test/Ice/facets/run.py
deleted file mode 100755
index 2d96b653cfa..00000000000
--- a/cpp/test/Ice/facets/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/faultTolerance/AllTests.cpp b/cpp/test/Ice/faultTolerance/AllTests.cpp
index 5a861677c08..2bb1fbd862b 100644
--- a/cpp/test/Ice/faultTolerance/AllTests.cpp
+++ b/cpp/test/Ice/faultTolerance/AllTests.cpp
@@ -116,7 +116,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
ref << "test";
for(vector<int>::const_iterator p = ports.begin(); p != ports.end(); ++p)
{
- ref << ":default -p " << *p;
+ ref << ":" << getTestEndpoint(communicator, *p);
}
Ice::ObjectPrxPtr base = communicator->stringToProxy(ref.str());
test(base);
@@ -282,7 +282,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
#else
cout << "aborting server #" << i << " and #" << i + 1 << " with idempotent AMI call... " << flush;
CallbackPtr cb = new Callback;
- obj->begin_idempotentAbort(newCallback_TestIntf_idempotentAbort(cb, &Callback::response,
+ obj->begin_idempotentAbort(newCallback_TestIntf_idempotentAbort(cb, &Callback::response,
&Callback::exceptAbortI));
cb->check();
cout << "ok" << endl;
diff --git a/cpp/test/Ice/faultTolerance/Client.cpp b/cpp/test/Ice/faultTolerance/Client.cpp
index 5636653ac06..ef39a9be5b6 100644
--- a/cpp/test/Ice/faultTolerance/Client.cpp
+++ b/cpp/test/Ice/faultTolerance/Client.cpp
@@ -65,8 +65,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0"); // test aborts
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/faultTolerance/Server.cpp b/cpp/test/Ice/faultTolerance/Server.cpp
index c731d007786..9a6b0e63e75 100644
--- a/cpp/test/Ice/faultTolerance/Server.cpp
+++ b/cpp/test/Ice/faultTolerance/Server.cpp
@@ -9,6 +9,7 @@
#include <Ice/Ice.h>
#include <TestI.h>
+#include <TestCommon.h>
using namespace std;
@@ -49,7 +50,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
ostringstream endpts;
- endpts << "default -p " << port << ":udp";
+ endpts << getTestEndpoint(communicator, port) << ":udp";
communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpts.str());
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::ObjectPtr object = ICE_MAKE_SHARED(TestI);
@@ -73,8 +74,7 @@ main(int argc, char* argv[])
// our test servers may time out before they are used in the
// test.
//
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.ServerIdleTime", "120"); // Two minutes.
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/faultTolerance/run.py b/cpp/test/Ice/faultTolerance/run.py
deleted file mode 100755
index a581594fbbb..00000000000
--- a/cpp/test/Ice/faultTolerance/run.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server"))
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-num = 12
-base = 12340
-
-serverProc = []
-for i in range(0, num):
- sys.stdout.write("starting server #%d... " % (i + 1))
- sys.stdout.flush()
- serverProc.append(TestUtil.startServer(server, "%d" % (base + i)))
- print("ok")
-
-ports = ""
-for i in range(0, num):
- ports = "%s %d" % (ports, base + i)
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, ports, startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
-for p in serverProc:
- p.waitTestSuccess()
diff --git a/cpp/test/Ice/gc/run.py b/cpp/test/Ice/gc/run.py
deleted file mode 100755
index 6423deb32a1..00000000000
--- a/cpp/test/Ice/gc/run.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.simpleTest(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")))
diff --git a/cpp/test/Ice/gc/test.py b/cpp/test/Ice/gc/test.py
new file mode 100644
index 00000000000..f371bb23ced
--- /dev/null
+++ b/cpp/test/Ice/gc/test.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+TestSuite(__name__, options = { "cpp11" : [False] })
diff --git a/cpp/test/Ice/hash/run.py b/cpp/test/Ice/hash/run.py
deleted file mode 100755
index 4ca27f9e829..00000000000
--- a/cpp/test/Ice/hash/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-TestUtil.simpleTest(client)
diff --git a/cpp/test/Ice/hold/Client.cpp b/cpp/test/Ice/hold/Client.cpp
index f69c263d682..3a74970a720 100644
--- a/cpp/test/Ice/hold/Client.cpp
+++ b/cpp/test/Ice/hold/Client.cpp
@@ -36,7 +36,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/hold", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
rc.finished(status);
diff --git a/cpp/test/Ice/hold/Server.cpp b/cpp/test/Ice/hold/Server.cpp
index 261d83d4660..3ed04c280ac 100644
--- a/cpp/test/Ice/hold/Server.cpp
+++ b/cpp/test/Ice/hold/Server.cpp
@@ -56,7 +56,8 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/hold/run.py b/cpp/test/Ice/hold/run.py
deleted file mode 100755
index eb60390efe1..00000000000
--- a/cpp/test/Ice/hold/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/impl/Server.cpp b/cpp/test/Ice/impl/Server.cpp
index 91cb3580b0d..dab7a8f6c7b 100644
--- a/cpp/test/Ice/impl/Server.cpp
+++ b/cpp/test/Ice/impl/Server.cpp
@@ -38,8 +38,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// Its possible to have batch oneway requests dispatched after
// the adapter is deactivated due to thread scheduling so we
diff --git a/cpp/test/Ice/impl/ServerAMD.cpp b/cpp/test/Ice/impl/ServerAMD.cpp
index 88a22188406..35c7123fce8 100644
--- a/cpp/test/Ice/impl/ServerAMD.cpp
+++ b/cpp/test/Ice/impl/ServerAMD.cpp
@@ -38,8 +38,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// Its possible to have batch oneway requests dispatched after
// the adapter is deactivated due to thread scheduling so we
diff --git a/cpp/test/Ice/info/AllTests.cpp b/cpp/test/Ice/info/AllTests.cpp
index 18fb252424c..542d3194e59 100644
--- a/cpp/test/Ice/info/AllTests.cpp
+++ b/cpp/test/Ice/info/AllTests.cpp
@@ -116,7 +116,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
cout << "test object adapter endpoint information... " << flush;
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -h 127.0.0.1 -t 15000:udp -h 127.0.0.1");
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints",
+ "default -h 127.0.0.1 -t 15000:udp -h 127.0.0.1");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::EndpointSeq endpoints = adapter->getEndpoints();
@@ -140,8 +141,11 @@ allTests(const Ice::CommunicatorPtr& communicator)
adapter->destroy();
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -h * -p 12020");
- communicator->getProperties()->setProperty("TestAdapter.PublishedEndpoints", "default -h 127.0.0.1 -p 12020");
+ int port = getTestPort(communicator->getProperties(), 1);
+ ostringstream portStr;
+ portStr << port;
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -h * -p " + portStr.str());
+ communicator->getProperties()->setProperty("TestAdapter.PublishedEndpoints", getTestEndpoint(communicator, 1));
adapter = communicator->createObjectAdapter("TestAdapter");
endpoints = adapter->getEndpoints();
@@ -152,26 +156,28 @@ allTests(const Ice::CommunicatorPtr& communicator)
for(Ice::EndpointSeq::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
ipEndpoint = getTCPEndpointInfo((*p)->getInfo());
- test(ipEndpoint->port == 12020);
+ test(ipEndpoint->port == port);
}
ipEndpoint = getTCPEndpointInfo(publishedEndpoints[0]->getInfo());
test(ipEndpoint->host == "127.0.0.1");
- test(ipEndpoint->port == 12020);
+ test(ipEndpoint->port == port);
adapter->destroy();
}
cout << "ok" << endl;
}
-
- Ice::ObjectPrxPtr base = communicator->stringToProxy("test:default -p 12010:udp -p 12010 -c");
+
+ string endpoints = getTestEndpoint(communicator, 0) + ":" + getTestEndpoint(communicator, 0, "udp") + " -c";
+ int port = getTestPort(communicator->getProperties(), 0);
+ Ice::ObjectPrxPtr base = communicator->stringToProxy("test:" + endpoints);
TestIntfPrxPtr testIntf = ICE_CHECKED_CAST(TestIntfPrx, base);
cout << "test connection endpoint information... " << flush;
{
Ice::EndpointInfoPtr info = base->ice_getConnection()->getEndpoint()->getInfo();
Ice::TCPEndpointInfoPtr tcpinfo = getTCPEndpointInfo(info);
- test(tcpinfo->port == 12010);
+ test(tcpinfo->port == port);
test(!tcpinfo->compress);
test(tcpinfo->host == defaultHost);
@@ -188,7 +194,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
info = base->ice_datagram()->ice_getConnection()->getEndpoint()->getInfo();
Ice::UDPEndpointInfoPtr udp = ICE_DYNAMIC_CAST(Ice::UDPEndpointInfo, info);
test(udp);
- test(udp->port == 12010);
+ test(udp->port == port);
test(udp->host == defaultHost);
}
cout << "ok" << endl;
@@ -203,7 +209,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(!info->incoming);
test(info->adapterName.empty());
test(info->localPort > 0);
- test(info->remotePort == 12010);
+ test(info->remotePort == port);
if(defaultHost == "127.0.0.1")
{
test(info->remoteAddress == defaultHost);
@@ -264,7 +270,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(!udpinfo->incoming);
test(udpinfo->adapterName.empty());
test(udpinfo->localPort > 0);
- test(udpinfo->remotePort == 12010);
+ test(udpinfo->remotePort == port);
if(defaultHost == "127.0.0.1")
{
test(udpinfo->remoteAddress == defaultHost);
diff --git a/cpp/test/Ice/info/Client.cpp b/cpp/test/Ice/info/Client.cpp
index 6aa30209e92..2029090b95f 100644
--- a/cpp/test/Ice/info/Client.cpp
+++ b/cpp/test/Ice/info/Client.cpp
@@ -32,7 +32,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/info/Server.cpp b/cpp/test/Ice/info/Server.cpp
index 47c8bbb3332..78765c87b94 100644
--- a/cpp/test/Ice/info/Server.cpp
+++ b/cpp/test/Ice/info/Server.cpp
@@ -18,7 +18,8 @@ using namespace std;
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp -p 12010");
+ string endpoints = getTestEndpoint(communicator, 0) + ":" + getTestEndpoint(communicator, 0, "udp");
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpoints);
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(TestI), Ice::stringToIdentity("test"));
adapter->activate();
@@ -36,7 +37,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/info/run.py b/cpp/test/Ice/info/run.py
deleted file mode 100755
index eb60390efe1..00000000000
--- a/cpp/test/Ice/info/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/inheritance/Client.cpp b/cpp/test/Ice/inheritance/Client.cpp
index c64080f96ab..6e44696210a 100644
--- a/cpp/test/Ice/inheritance/Client.cpp
+++ b/cpp/test/Ice/inheritance/Client.cpp
@@ -37,7 +37,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/inheritance", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
rc.finished(status);
diff --git a/cpp/test/Ice/inheritance/Collocated.cpp b/cpp/test/Ice/inheritance/Collocated.cpp
index 0f640de9b8b..13bd1b564d6 100644
--- a/cpp/test/Ice/inheritance/Collocated.cpp
+++ b/cpp/test/Ice/inheritance/Collocated.cpp
@@ -39,7 +39,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/inheritance/Server.cpp b/cpp/test/Ice/inheritance/Server.cpp
index 8ec0c761076..69c5a2ba868 100644
--- a/cpp/test/Ice/inheritance/Server.cpp
+++ b/cpp/test/Ice/inheritance/Server.cpp
@@ -37,7 +37,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/inheritance/run.py b/cpp/test/Ice/inheritance/run.py
deleted file mode 100755
index 2d96b653cfa..00000000000
--- a/cpp/test/Ice/inheritance/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/interceptor/Client.cpp b/cpp/test/Ice/interceptor/Client.cpp
index d77b076c157..4776dd942b8 100644
--- a/cpp/test/Ice/interceptor/Client.cpp
+++ b/cpp/test/Ice/interceptor/Client.cpp
@@ -57,8 +57,7 @@ public:
virtual int _main(int argc, char** argv)
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
_communicator = Ice::initialize(initData);
return run(argc, argv);
diff --git a/cpp/test/Ice/interceptor/run.py b/cpp/test/Ice/interceptor/run.py
deleted file mode 100755
index dc73f0e0506..00000000000
--- a/cpp/test/Ice/interceptor/run.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("interceptortest"))])
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-TestUtil.simpleTest(client, " --Ice.Warn.Dispatch=0")
diff --git a/cpp/test/Ice/invoke/Client.cpp b/cpp/test/Ice/invoke/Client.cpp
index f2d45cb2990..120d3555a98 100644
--- a/cpp/test/Ice/invoke/Client.cpp
+++ b/cpp/test/Ice/invoke/Client.cpp
@@ -40,8 +40,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator, initData);
}
diff --git a/cpp/test/Ice/invoke/Server.cpp b/cpp/test/Ice/invoke/Server.cpp
index c25e72fddf4..7bbd28e143b 100644
--- a/cpp/test/Ice/invoke/Server.cpp
+++ b/cpp/test/Ice/invoke/Server.cpp
@@ -123,8 +123,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/Ice/invoke/run.py b/cpp/test/Ice/invoke/run.py
deleted file mode 100755
index a9b2d78339f..00000000000
--- a/cpp/test/Ice/invoke/run.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "blobject", message = "Running test with Blobject server.")
-TestUtil.queueClientServerTest(configName = "blobjectArray", message = "Running test with BlobjectArray server.",
- additionalServerOptions = "--array")
-TestUtil.queueClientServerTest(configName = "blobjectAsync", message = "Running test with BlobjectAsync server.",
- additionalServerOptions = "--async")
-TestUtil.queueClientServerTest(configName = "blobjectAsyncArray",
- message = "Running test with BlobjectAsyncArray server.",
- additionalServerOptions = "--array --async")
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/library/Client.cpp b/cpp/test/Ice/library/Client.cpp
index bc8371e95a2..109efc1c4e6 100644
--- a/cpp/test/Ice/library/Client.cpp
+++ b/cpp/test/Ice/library/Client.cpp
@@ -26,7 +26,8 @@ main(int argc, char* argv[])
{
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
// Collocated-only OA
Ice::ObjectAdapterPtr oa = ich->createObjectAdapter("");
diff --git a/cpp/test/Ice/library/run.py b/cpp/test/Ice/library/run.py
deleted file mode 100644
index da3317138ad..00000000000
--- a/cpp/test/Ice/library/run.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("gencode"))])
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("consumer"))])
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("alltests"))])
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-TestUtil.simpleTest(client)
diff --git a/cpp/test/Ice/library/test.py b/cpp/test/Ice/library/test.py
new file mode 100644
index 00000000000..6184d25b675
--- /dev/null
+++ b/cpp/test/Ice/library/test.py
@@ -0,0 +1,10 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+TestSuite(__file__, libDirs=["gencode", "consumer", "alltests"])
diff --git a/cpp/test/Ice/location/Client.cpp b/cpp/test/Ice/location/Client.cpp
index 44fe67ee19a..cd586168359 100644
--- a/cpp/test/Ice/location/Client.cpp
+++ b/cpp/test/Ice/location/Client.cpp
@@ -31,9 +31,8 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
- initData.properties->setProperty("Ice.Default.Locator", "locator:default -p 12010");
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ initData.properties->setProperty("Ice.Default.Locator", "locator:" + getTestEndpoint(initData.properties, 0));
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
diff --git a/cpp/test/Ice/location/Server.cpp b/cpp/test/Ice/location/Server.cpp
index fb2f29a2226..79c0a9abf0c 100644
--- a/cpp/test/Ice/location/Server.cpp
+++ b/cpp/test/Ice/location/Server.cpp
@@ -17,8 +17,7 @@ DEFINE_TEST("server")
using namespace std;
int
-run(int, char**, const Ice::CommunicatorPtr& communicator,
- const Ice::InitializationData& initData)
+run(int, char**, const Ice::CommunicatorPtr& communicator, const Ice::InitializationData& initData)
{
//
// Register the server manager. The server manager creates a new
@@ -63,8 +62,7 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
assert(initData.properties != ich->getProperties());
return run(argc, argv, ich.communicator(), initData);
diff --git a/cpp/test/Ice/location/TestI.cpp b/cpp/test/Ice/location/TestI.cpp
index 80e391b2a8d..fb55391c3b0 100644
--- a/cpp/test/Ice/location/TestI.cpp
+++ b/cpp/test/Ice/location/TestI.cpp
@@ -10,6 +10,7 @@
#include <Ice/Ice.h>
#include <Ice/Locator.h>
#include <TestI.h>
+#include <TestCommon.h>
using namespace Test;
@@ -17,10 +18,10 @@ ServerManagerI::ServerManagerI(const ServerLocatorRegistryPtr& registry,
const Ice::InitializationData& initData) :
_registry(registry),
_initData(initData),
- _nextPort(12011)
+ _nextPort(1)
{
_initData.properties->setProperty("TestAdapter.AdapterId", "TestAdapter");
- _initData.properties->setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter");
+ _initData.properties->setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter");
_initData.properties->setProperty("TestAdapter2.AdapterId", "TestAdapter2");
_initData.properties->setProperty("Ice.PrintAdapterReady", "0");
}
@@ -50,21 +51,14 @@ ServerManagerI::startServer(const Ice::Current&)
// Use fixed port to ensure that OA re-activation doesn't re-use previous port from
// another OA (e.g.: TestAdapter2 is re-activated using port of TestAdapter).
//
- {
- std::ostringstream os;
- os << "default -p " << _nextPort++;
- serverCommunicator->getProperties()->setProperty("TestAdapter.Endpoints", os.str());
- }
- {
- std::ostringstream os;
- os << "default -p " << _nextPort++;
- serverCommunicator->getProperties()->setProperty("TestAdapter2.Endpoints", os.str());
- }
+ Ice::PropertiesPtr props = _initData.properties;
+ serverCommunicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(props, _nextPort++));
+ serverCommunicator->getProperties()->setProperty("TestAdapter2.Endpoints", getTestEndpoint(props, _nextPort++));
Ice::ObjectAdapterPtr adapter = serverCommunicator->createObjectAdapter("TestAdapter");
Ice::ObjectAdapterPtr adapter2 = serverCommunicator->createObjectAdapter("TestAdapter2");
- Ice::ObjectPrxPtr locator = serverCommunicator->stringToProxy("locator:default -p 12010");
+ Ice::ObjectPrxPtr locator = serverCommunicator->stringToProxy("locator:" + getTestEndpoint(props, 0));
adapter->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator));
adapter2->setLocator(ICE_UNCHECKED_CAST(Ice::LocatorPrx, locator));
@@ -88,8 +82,8 @@ ServerManagerI::shutdown(const Ice::Current& current)
}
-TestI::TestI(const Ice::ObjectAdapterPtr& adapter,
- const Ice::ObjectAdapterPtr& adapter2,
+TestI::TestI(const Ice::ObjectAdapterPtr& adapter,
+ const Ice::ObjectAdapterPtr& adapter2,
const ServerLocatorRegistryPtr& registry) :
_adapter1(adapter), _adapter2(adapter2), _registry(registry)
{
diff --git a/cpp/test/Ice/location/run.py b/cpp/test/Ice/location/run.py
deleted file mode 100755
index eb60390efe1..00000000000
--- a/cpp/test/Ice/location/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/logger/run.py b/cpp/test/Ice/logger/run.py
deleted file mode 100755
index 4744ede4eb4..00000000000
--- a/cpp/test/Ice/logger/run.py
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, subprocess, glob, atexit, shutil
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-def test(cmd, match, enc):
- p = subprocess.Popen([cmd], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
- out, err = p.communicate()
- ret = p.poll()
- if ret != 0:
- print("%s failed! status %s " % (cmd, ret))
- if out.decode(enc).find(match.decode(enc)) == -1:
- raise RuntimeError("test failed")
-
-TestUtil.simpleTest(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client1")))
-env = TestUtil.getTestEnv("cpp", os.getcwd())
-
-sys.stdout.write("testing logger ISO-8859-15 output... ")
-test(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client2")), b'aplicaci\xf3n', "ISO-8859-15")
-print("ok")
-
-sys.stdout.write("testing logger UTF8 output without string converter... ")
-test(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client3")), b'aplicaci\xc3\xb3n', "UTF8")
-print("ok")
-
-sys.stdout.write("testing logger UTF8 output with ISO-8859-15 narrow string converter... ")
-#
-# In Windows expected output is UTF8, because the console output code page is set to UTF-8
-# in Linux and OS X, the expected output is ISO-8859-15 because that is the narrow string
-# encoding used by the application.
-#
-if TestUtil.isWin32():
- test(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client4")), b'aplicaci\xc3\xb3n', "UTF8")
-else:
- test(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client4")), b'aplicaci\xf3n', "ISO-8859-15")
-print("ok")
-
-sys.stdout.write("testing logger file rotation... ")
-
-def cleanup():
- for f in glob.glob("client5-*.log"):
- os.remove(f)
- if os.path.exists("log/client5-4.log"):
- os.remove("log/client5-4.log")
-
-cleanup()
-
-atexit.register(cleanup)
-
-if not os.path.exists("log"):
- os.makedirs("log")
-
-open("log/client5-4.log", 'a').close()
-
-if TestUtil.isWin32():
- os.system("echo Y|cacls log /P \"%USERNAME%\":R 1> nul")
-else:
- os.system("chmod -w log")
-
-p = subprocess.Popen(os.path.join(os.getcwd(), TestUtil.getTestExecutable("client5")), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env)
-out, err = p.communicate()
-ret = p.poll()
-if ret != 0:
- print("failed! status %s " % ret)
- sys.exit(1)
-
-if TestUtil.isWin32():
- os.system("echo Y|cacls log /P \"%USERNAME%\":F 1> nul")
-else:
- os.system("chmod +w log")
-
-if (not os.path.isfile("client5-0.log") or
- not os.stat("client5-0.log").st_size == 512 or
- len(glob.glob("client5-0-*.log")) != 19):
- print("failed!")
- sys.exit(1)
-
-for f in glob.glob("client5-0-*.log"):
- if not os.stat(f).st_size == 512:
- print("failed! file {0} size: {1} unexpected".format(f, os.stat(f).st_size))
- sys.exit(1)
-
-if (not os.path.isfile("client5-1.log") or
- not os.stat("client5-1.log").st_size == 1024 or
- len(glob.glob("client5-1-*.log")) != 0):
- print("failed!")
- sys.exit(1)
-
-if (not os.path.isfile("client5-2.log") or
- not os.stat("client5-2.log").st_size == 128 or
- len(glob.glob("client5-2-*.log")) != 7):
- print("failed!")
- sys.exit(1)
-
-for f in glob.glob("client5-2-*.log"):
- if not os.stat(f).st_size == 128:
- print("failed! file {0} size: {1} unexpected".format(f, os.stat(f).st_size))
- sys.exit(1)
-
-if (not os.path.isfile("client5-3.log") or
- not os.stat("client5-2.log").st_size == 128 or
- len(glob.glob("client5-2-*.log")) != 7):
- print("failed!")
- sys.exit(1)
-
-for f in glob.glob("client5-3-*.log"):
- if not os.stat(f).st_size == 128:
- print("failed! file {0} size: {1} unexpected".format(f, os.stat(f).st_size))
- sys.exit(1)
-
-#
-# When running as root log rotation will not fail as
-# root always has write access.
-#
-if TestUtil.isWin32() or os.getuid() != 0:
- if (not os.path.isfile("log/client5-4.log") or
- os.stat("log/client5-4.log").st_size < 1024 or
- len(glob.glob("log/client5-4-*.log")) > 0):
- print("failed!")
- sys.exit(1)
-
- with open("log/client5-4.log", 'r') as f:
- if f.read().count("error: FileLogger: cannot rename `log/client5-4.log'") != 1:
- print("failed!")
- sys.exit(1)
-
-shutil.rmtree("log")
-
-print("ok")
diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp
index c5d692fd2d7..3faea063c8d 100644
--- a/cpp/test/Ice/metrics/AllTests.cpp
+++ b/cpp/test/Ice/metrics/AllTests.cpp
@@ -55,10 +55,18 @@ private:
};
typedef IceUtil::Handle<Callback> CallbackPtr;
+string
+getPort(const Ice::PropertiesAdminPrxPtr& p)
+{
+ ostringstream os;
+ os << getTestPort(p->ice_getCommunicator()->getProperties(), 0);
+ return os.str();
+}
+
Ice::PropertyDict
-getClientProps(const Ice::PropertiesAdminPrxPtr& p, const Ice::PropertyDict& orig, const string& m = string())
+getClientProps(const Ice::PropertiesAdminPrxPtr& pa, const Ice::PropertyDict& orig, const string& m = string())
{
- Ice::PropertyDict props = p->getPropertiesForPrefix("IceMX.Metrics");
+ Ice::PropertyDict props = pa->getPropertiesForPrefix("IceMX.Metrics");
for(Ice::PropertyDict::iterator p = props.begin(); p != props.end(); ++p)
{
p->second = "";
@@ -73,15 +81,15 @@ getClientProps(const Ice::PropertiesAdminPrxPtr& p, const Ice::PropertyDict& ori
map += "Map." + m + '.';
}
props["IceMX.Metrics.View." + map + "Reject.parent"] = "Ice\\.Admin";
- props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = "12010";
+ props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = getPort(pa);
props["IceMX.Metrics.View." + map + "Reject.identity"] = ".*/admin|controller";
return props;
}
Ice::PropertyDict
-getServerProps(const Ice::PropertiesAdminPrxPtr& p, const Ice::PropertyDict& orig, const string& m = string())
+getServerProps(const Ice::PropertiesAdminPrxPtr& pa, const Ice::PropertyDict& orig, const string& m = string())
{
- Ice::PropertyDict props = p->getPropertiesForPrefix("IceMX.Metrics");
+ Ice::PropertyDict props = pa->getPropertiesForPrefix("IceMX.Metrics");
for(Ice::PropertyDict::iterator p = props.begin(); p != props.end(); ++p)
{
p->second = "";
@@ -96,7 +104,7 @@ getServerProps(const Ice::PropertiesAdminPrxPtr& p, const Ice::PropertyDict& ori
map += "Map." + m + '.';
}
props["IceMX.Metrics.View." + map + "Reject.parent"] = "Ice\\.Admin|Controller";
- props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = "12010";
+ props["IceMX.Metrics.View." + map + "Accept.endpointPort"] = getPort(pa);
return props;
}
@@ -408,7 +416,24 @@ toMap(const IceMX::MetricsMap& mmap)
MetricsPrxPtr
allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPtr& obsv)
{
- MetricsPrxPtr metrics = ICE_CHECKED_CAST(MetricsPrx, communicator->stringToProxy("metrics:default -p 12010"));
+ Ice::PropertiesPtr properties = communicator->getProperties();
+ string host = getTestHost(properties);
+ string port;
+ {
+ ostringstream os;
+ os << getTestPort(properties, 0);
+ port = os.str();
+ }
+ string hostAndPort = host + ":" + port;
+ string protocol = getTestProtocol(properties);
+ string endpoint;
+ {
+ ostringstream os;
+ os << protocol << " -h " << host << " -p " << port;
+ endpoint = os.str();
+ }
+
+ MetricsPrxPtr metrics = ICE_CHECKED_CAST(MetricsPrx, communicator->stringToProxy("metrics:" + endpoint));
bool collocated = !metrics->ice_getConnection();
cout << "testing metrics admin facet checkedCast... " << flush;
@@ -522,12 +547,6 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
map<string, IceMX::MetricsPtr> map;
- string endpoint;
- {
- ostringstream os;
- os << communicator->getProperties()->getPropertyWithDefault("Ice.Default.Protocol", "tcp") << " -h 127.0.0.1 -p 12010";
- endpoint = os.str();
- }
string type;
string isSecure;
if(!collocated)
@@ -617,7 +636,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]);
test(map["active"]->current == 1);
- ControllerPrxPtr controller = ICE_CHECKED_CAST(ControllerPrx, communicator->stringToProxy("controller:default -p 12011"));
+ Ice::ObjectPrxPtr cprx = communicator->stringToProxy("controller:" + getTestEndpoint(communicator, 1));
+ ControllerPrxPtr controller = ICE_CHECKED_CAST(ControllerPrx, cprx);
controller->hold();
map = toMap(clientMetrics->getMetricsView("View", timestamp)["Connection"]);
@@ -684,16 +704,16 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointIsSecure", isSecure);
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointTimeout", "500");
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointCompress", "false");
- testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointHost", "127.0.0.1");
- testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointPort", "12010");
+ testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointHost", host);
+ testAttribute(clientMetrics, clientProps, update.get(), "Connection", "endpointPort", port);
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "incoming", "false");
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "adapterName", "");
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "connectionId", "Con1");
- testAttribute(clientMetrics, clientProps, update.get(), "Connection", "localHost", "127.0.0.1");
+ testAttribute(clientMetrics, clientProps, update.get(), "Connection", "localHost", host);
//testAttribute(clientMetrics, clientProps, update.get(), "Connection", "localPort", "");
- testAttribute(clientMetrics, clientProps, update.get(), "Connection", "remoteHost", "127.0.0.1");
- testAttribute(clientMetrics, clientProps, update.get(), "Connection", "remotePort", "12010");
+ testAttribute(clientMetrics, clientProps, update.get(), "Connection", "remoteHost", host);
+ testAttribute(clientMetrics, clientProps, update.get(), "Connection", "remotePort", port);
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "mcastHost", "");
testAttribute(clientMetrics, clientProps, update.get(), "Connection", "mcastPort", "");
@@ -714,13 +734,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].size() == 1);
IceMX::MetricsPtr m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0];
- test(m1->current == 0 && m1->total == 1 && m1->id == "127.0.0.1:12010");
+ test(m1->current == 0 && m1->total == 1 && m1->id == hostAndPort);
metrics->ice_getConnection()->close(false);
controller->hold();
try
{
- communicator->stringToProxy("test:tcp -p 12010 -h 127.0.0.1")->ice_timeout(10)->ice_ping();
+ communicator->stringToProxy("test:" + endpoint)->ice_timeout(10)->ice_ping();
test(false);
}
catch(const Ice::ConnectTimeoutException&)
@@ -733,13 +753,13 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
controller->resume();
test(clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"].size() == 1);
m1 = clientMetrics->getMetricsView("View", timestamp)["ConnectionEstablishment"][0];
- test(m1->id == "127.0.0.1:12010" && m1->total == 3 && m1->failures == 2);
+ test(m1->id == hostAndPort && m1->total == 3 && m1->failures == 2);
checkFailure(clientMetrics, "ConnectionEstablishment", m1->id, "::Ice::ConnectTimeoutException", 2);
Connect c(metrics);
testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "parent", "Communicator", c);
- testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "id", "127.0.0.1:12010", c);
+ testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "id", hostAndPort, c);
testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpoint",
endpoint + " -t 60000", c);
@@ -748,8 +768,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointIsSecure", isSecure, c);
testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointTimeout", "60000", c);
testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointCompress", "false", c);
- testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointHost", "127.0.0.1", c);
- testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointPort", "12010", c);
+ testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointHost", host, c);
+ testAttribute(clientMetrics, clientProps, update.get(), "ConnectionEstablishment", "endpointPort", port, c);
cout << "ok" << endl;
@@ -760,24 +780,28 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
#if !defined(ICE_OS_WINRT) && TARGET_OS_IPHONE==0
cout << "testing endpoint lookup metrics... " << flush;
- props["IceMX.Metrics.View.Map.ConnectionEstablishment.GroupBy"] = "id";
+ props["IceMX.Metrics.View.Map.EndpointLookup.GroupBy"] = "id";
updateProps(clientProps, serverProps, update.get(), props, "EndpointLookup");
test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].empty());
- Ice::ObjectPrxPtr prx = communicator->stringToProxy("metrics:default -p 12010 -h localhost -t infinite");
- prx->ice_ping();
+ Ice::ObjectPrxPtr prx = communicator->stringToProxy("metrics:" + protocol + " -h localhost -t 500 -p " + port);
+ try
+ {
+ prx->ice_ping();
+ prx->ice_getConnection()->close(false);
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 1);
m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][0];
-
- test(m1->current <= 1 && m1->total == 1 && m1->id == prx->ice_getConnection()->getEndpoint()->toString());
-
- prx->ice_getConnection()->close(false);
+ test(m1->current <= 1 && (m1->total == 1 || m1->total == 2));
bool dnsException = false;
try
{
- communicator->stringToProxy("test:tcp -t 500 -p 12010 -h unknownfoo.zeroc.com")->ice_ping();
+ communicator->stringToProxy("test:tcp -t 500 -h unknownfoo.zeroc.com -p " + port)->ice_ping();
test(false);
}
catch(const Ice::DNSException&)
@@ -790,7 +814,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
}
test(clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"].size() == 2);
m1 = clientMetrics->getMetricsView("View", timestamp)["EndpointLookup"][1];
- test(m1->id == "tcp -h unknownfoo.zeroc.com -p 12010 -t 500" && m1->total == 2 &&
+ test(m1->id == "tcp -h unknownfoo.zeroc.com -p " + port + " -t 500" && m1->total == 2 &&
(!dnsException || m1->failures == 2));
if(dnsException)
{
@@ -808,10 +832,10 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointType", type, c);
testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointIsDatagram", "false", c);
testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointIsSecure", isSecure, c);
- testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointTimeout", "-1", c);
+ testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointTimeout", "500", c);
testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointCompress", "false", c);
testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointHost", "localhost", c);
- testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointPort", "12010", c);
+ testAttribute(clientMetrics, clientProps, update.get(), "EndpointLookup", "endpointPort", port, c);
cout << "ok" << endl;
#endif
@@ -915,16 +939,16 @@ allTests(const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPt
testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointIsSecure", isSecure, op);
testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointTimeout", "60000", op);
testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointCompress", "false", op);
- testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointHost", "127.0.0.1", op);
- testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointPort", "12010", op);
+ testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointHost", host, op);
+ testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "endpointPort", port, op);
testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "incoming", "true", op);
testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "adapterName", "TestAdapter", op);
testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "connectionId", "", op);
- testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "localHost", "127.0.0.1", op);
- testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "localPort", "12010", op);
- testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "remoteHost", "127.0.0.1", op);
- //testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "remotePort", "12010", op);
+ testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "localHost", host, op);
+ testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "localPort", port, op);
+ testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "remoteHost", host, op);
+ //testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "remotePort", port, op);
testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "mcastHost", "", op);
testAttribute(serverMetrics, serverProps, update.get(), "Dispatch", "mcastPort", "", op);
}
diff --git a/cpp/test/Ice/metrics/Client.cpp b/cpp/test/Ice/metrics/Client.cpp
index 65611a7de95..0e2c3e95b95 100644
--- a/cpp/test/Ice/metrics/Client.cpp
+++ b/cpp/test/Ice/metrics/Client.cpp
@@ -34,14 +34,12 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Admin.Endpoints", "default");
initData.properties->setProperty("Ice.Admin.InstanceName", "client");
initData.properties->setProperty("Ice.Admin.DelayCreation", "1");
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.MessageSizeMax", "50000");
- initData.properties->setProperty("Ice.Default.Host", "127.0.0.1");
CommunicatorObserverIPtr observer = ICE_MAKE_SHARED(CommunicatorObserverI);
initData.observer = observer;
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/metrics/Collocated.cpp b/cpp/test/Ice/metrics/Collocated.cpp
index dd314954612..f79a4ca8d6e 100644
--- a/cpp/test/Ice/metrics/Collocated.cpp
+++ b/cpp/test/Ice/metrics/Collocated.cpp
@@ -20,12 +20,12 @@ using namespace Test;
int
run(int, char**, const Ice::CommunicatorPtr& communicator, const CommunicatorObserverIPtr& observer)
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics"));
//adapter->activate(); // Don't activate OA to ensure collocation is used.
- communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1));
Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
//controllerAdapter->activate(); // Don't activate OA to ensure collocation is used.
@@ -44,15 +44,13 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Admin.Endpoints", "tcp");
initData.properties->setProperty("Ice.Admin.InstanceName", "client");
initData.properties->setProperty("Ice.Admin.DelayCreation", "1");
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
initData.properties->setProperty("Ice.MessageSizeMax", "50000");
- initData.properties->setProperty("Ice.Default.Host", "127.0.0.1");
CommunicatorObserverIPtr observer = ICE_MAKE_SHARED(CommunicatorObserverI);
initData.observer = observer;
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/metrics/Server.cpp b/cpp/test/Ice/metrics/Server.cpp
index e5daf413204..970739640f8 100644
--- a/cpp/test/Ice/metrics/Server.cpp
+++ b/cpp/test/Ice/metrics/Server.cpp
@@ -18,12 +18,12 @@ using namespace std;
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics"));
adapter->activate();
- communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1));
Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
controllerAdapter->activate();
@@ -42,8 +42,7 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//initData.properties->setProperty("Ice.ThreadPool.Server.Size", "1");
//initData.properties->setProperty("Ice.ThreadPool.Server.SizeMax", "1");
initData.properties->setProperty("Ice.Admin.Endpoints", "tcp");
@@ -51,7 +50,6 @@ main(int argc, char* argv[])
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
initData.properties->setProperty("Ice.MessageSizeMax", "50000");
- initData.properties->setProperty("Ice.Default.Host", "127.0.0.1");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
diff --git a/cpp/test/Ice/metrics/ServerAMD.cpp b/cpp/test/Ice/metrics/ServerAMD.cpp
index 40aee438374..ec6e9fcbf38 100644
--- a/cpp/test/Ice/metrics/ServerAMD.cpp
+++ b/cpp/test/Ice/metrics/ServerAMD.cpp
@@ -18,12 +18,12 @@ using namespace std;
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010");
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(MetricsI), Ice::stringToIdentity("metrics"));
adapter->activate();
- communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", "default -p 12011");
+ communicator->getProperties()->setProperty("ControllerAdapter.Endpoints", getTestEndpoint(communicator, 1));
Ice::ObjectAdapterPtr controllerAdapter = communicator->createObjectAdapter("ControllerAdapter");
controllerAdapter->add(ICE_MAKE_SHARED(ControllerI, adapter), Ice::stringToIdentity("controller"));
controllerAdapter->activate();
@@ -40,11 +40,9 @@ main(int argc, char* argv[])
#ifdef ICE_STATIC_LIBS
Ice::registerIceSSL();
#endif
- Ice::CommunicatorPtr communicator;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//initData.properties->setProperty("Ice.ThreadPool.Server.Size", "1");
//initData.properties->setProperty("Ice.ThreadPool.Server.SizeMax", "1");
initData.properties->setProperty("Ice.Admin.Endpoints", "tcp");
@@ -52,9 +50,8 @@ main(int argc, char* argv[])
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
initData.properties->setProperty("Ice.MessageSizeMax", "50000");
- initData.properties->setProperty("Ice.Default.Host", "127.0.0.1");
- communicator = Ice::initialize(argc, argv, initData);
- return run(argc, argv, communicator);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
+ return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
{
diff --git a/cpp/test/Ice/metrics/run.py b/cpp/test/Ice/metrics/run.py
deleted file mode 100755
index 7921ce9e9ff..00000000000
--- a/cpp/test/Ice/metrics/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server = TestUtil.getTestExecutable("serveramd"))
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/networkProxy/AllTests.cpp b/cpp/test/Ice/networkProxy/AllTests.cpp
index f1d2fa1fe71..49cd8789232 100644
--- a/cpp/test/Ice/networkProxy/AllTests.cpp
+++ b/cpp/test/Ice/networkProxy/AllTests.cpp
@@ -36,10 +36,16 @@ getIPConnectionInfo(const Ice::ConnectionInfoPtr& info)
void
allTests(const Ice::CommunicatorPtr& communicator)
{
- string sref = "test:default -p 12010";
+ string sref = "test:" + getTestEndpoint(communicator, 0);
Ice::ObjectPrxPtr obj = communicator->stringToProxy(sref);
test(obj);
+ int proxyPort = communicator->getProperties()->getPropertyAsInt("Ice.HTTPProxyPort");
+ if(proxyPort == 0)
+ {
+ proxyPort = communicator->getProperties()->getPropertyAsInt("Ice.SOCKSProxyPort");
+ }
+
TestIntfPrxPtr test = ICE_CHECKED_CAST(TestIntfPrx, obj);
test(test);
@@ -52,7 +58,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
cout << "testing connection information... " << flush;
{
Ice::IPConnectionInfoPtr info = getIPConnectionInfo(test->ice_getConnection()->getInfo());
- test(info->remotePort == 12030 || info->remotePort == 12031); // make sure we are connected to the proxy port.
+ test(info->remotePort == proxyPort); // make sure we are connected to the proxy port.
}
cout << "ok" << endl;
diff --git a/cpp/test/Ice/networkProxy/Client.cpp b/cpp/test/Ice/networkProxy/Client.cpp
index ca8c629df93..d8b93814226 100644
--- a/cpp/test/Ice/networkProxy/Client.cpp
+++ b/cpp/test/Ice/networkProxy/Client.cpp
@@ -17,8 +17,7 @@ using namespace std;
using namespace Test;
int
-run(int, char**, const Ice::CommunicatorPtr& communicator)
-{
+run(int, char**, const Ice::CommunicatorPtr& communicator){
void allTests(const Ice::CommunicatorPtr&);
allTests(communicator);
return EXIT_SUCCESS;
@@ -33,7 +32,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/networkProxy/Server.cpp b/cpp/test/Ice/networkProxy/Server.cpp
index 07dac51360a..02ca25d574b 100644
--- a/cpp/test/Ice/networkProxy/Server.cpp
+++ b/cpp/test/Ice/networkProxy/Server.cpp
@@ -34,7 +34,7 @@ public:
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0) + ":udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::ObjectPtr object = ICE_MAKE_SHARED(TestI);
adapter->add(object, Ice::stringToIdentity("test"));
@@ -53,7 +53,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/networkProxy/run.py b/cpp/test/Ice/networkProxy/run.py
deleted file mode 100755
index 8a5a87c9f42..00000000000
--- a/cpp/test/Ice/networkProxy/run.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, NetworkProxy
-
-sys.stdout.write("starting SOCKS proxy... ")
-sys.stdout.flush()
-socksProxy = NetworkProxy.SocksProxy(12030)
-print("ok")
-
-TestUtil.clientServerTest(additionalClientOptions="--Ice.SOCKSProxyHost=localhost --Ice.SOCKSProxyPort=12030")
-
-sys.stdout.write("terminating SOCKS proxy... ")
-sys.stdout.flush()
-socksProxy.terminate()
-print("ok")
-
-sys.stdout.write("starting HTTP proxy... ")
-sys.stdout.flush()
-httpProxy = NetworkProxy.HttpProxy(12031)
-print("ok")
-
-TestUtil.clientServerTest(additionalClientOptions="--Ice.HTTPProxyHost=localhost --Ice.HTTPProxyPort=12031")
-
-sys.stdout.write("terminating HTTP proxy... ")
-sys.stdout.flush()
-httpProxy.terminate()
-print("ok")
diff --git a/cpp/test/Ice/objects/Client.cpp b/cpp/test/Ice/objects/Client.cpp
index bceb4001e3a..5b93e93fddd 100644
--- a/cpp/test/Ice/objects/Client.cpp
+++ b/cpp/test/Ice/objects/Client.cpp
@@ -14,7 +14,7 @@
//
// Required to trigger initialization of Derived object factory.
//
-#include <Derived.h>
+#include <Derived.h>
//
// Required to trigger initialization of DerivedEx exception factory.
@@ -161,7 +161,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/objects", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
rc.finished(status);
diff --git a/cpp/test/Ice/objects/Collocated.cpp b/cpp/test/Ice/objects/Collocated.cpp
index 6443ed13252..e0df2f04303 100644
--- a/cpp/test/Ice/objects/Collocated.cpp
+++ b/cpp/test/Ice/objects/Collocated.cpp
@@ -153,7 +153,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/objects/Server.cpp b/cpp/test/Ice/objects/Server.cpp
index c63b2d7c415..8bffdbfdc00 100644
--- a/cpp/test/Ice/objects/Server.cpp
+++ b/cpp/test/Ice/objects/Server.cpp
@@ -87,7 +87,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/objects/run.py b/cpp/test/Ice/objects/run.py
deleted file mode 100755
index bd13835d1c7..00000000000
--- a/cpp/test/Ice/objects/run.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.")
-
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.",
- additionalClientOptions="--Ice.Default.SlicedFormat",
- additionalServerOptions="--Ice.Default.SlicedFormat")
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/operations/Client.cpp b/cpp/test/Ice/operations/Client.cpp
index 65d65d35701..a3d6e76cb4b 100644
--- a/cpp/test/Ice/operations/Client.cpp
+++ b/cpp/test/Ice/operations/Client.cpp
@@ -63,8 +63,7 @@ main(int argc, char* argv[])
// In this test, we need at least two threads in the
// client side thread pool for nested AMI.
//
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.ThreadPool.Client.Size", "2");
initData.properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
initData.properties->setProperty("Ice.BatchAutoFlushSize", "100");
diff --git a/cpp/test/Ice/operations/Collocated.cpp b/cpp/test/Ice/operations/Collocated.cpp
index cfce947446d..3cff4ccfb74 100644
--- a/cpp/test/Ice/operations/Collocated.cpp
+++ b/cpp/test/Ice/operations/Collocated.cpp
@@ -41,8 +41,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.BatchAutoFlushSize", "100");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/operations/Server.cpp b/cpp/test/Ice/operations/Server.cpp
index 80f89467fe7..e7082f75486 100644
--- a/cpp/test/Ice/operations/Server.cpp
+++ b/cpp/test/Ice/operations/Server.cpp
@@ -37,8 +37,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// Its possible to have batch oneway requests dispatched after
// the adapter is deactivated due to thread scheduling so we
diff --git a/cpp/test/Ice/operations/ServerAMD.cpp b/cpp/test/Ice/operations/ServerAMD.cpp
index f291f11a5a4..3b77a048c19 100644
--- a/cpp/test/Ice/operations/ServerAMD.cpp
+++ b/cpp/test/Ice/operations/ServerAMD.cpp
@@ -37,8 +37,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// Its possible to have batch oneway requests dispatched after
// the adapter is deactivated due to thread scheduling so we
diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp
index 1e96c80cae4..4731ece4dce 100644
--- a/cpp/test/Ice/operations/TwowaysAMI.cpp
+++ b/cpp/test/Ice/operations/TwowaysAMI.cpp
@@ -177,7 +177,7 @@ public:
//
// We can't do the callbacks below in connection serialization mode.
//
- if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize"))
+ if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
{
r->opVoid();
c1->opVoid();
@@ -204,7 +204,7 @@ public:
//
// We can't do the callbacks below in connection serialization mode.
//
- if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize"))
+ if(_communicator->getProperties()->getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0)
{
so.p->opVoid();
}
diff --git a/cpp/test/Ice/operations/run.py b/cpp/test/Ice/operations/run.py
deleted file mode 100755
index e4c188e8960..00000000000
--- a/cpp/test/Ice/operations/run.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(additionalClientOptions = "--Ice.Warn.AMICallback=0")
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- additionalClientOptions = "--Ice.Warn.AMICallback=0",
- server = TestUtil.getTestExecutable("serveramd"))
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/optional/Client.cpp b/cpp/test/Ice/optional/Client.cpp
index 4983ad69a88..7dc9b1c3ae7 100644
--- a/cpp/test/Ice/optional/Client.cpp
+++ b/cpp/test/Ice/optional/Client.cpp
@@ -37,7 +37,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/optional", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
rc.finished(status);
diff --git a/cpp/test/Ice/optional/Server.cpp b/cpp/test/Ice/optional/Server.cpp
index aacddd084ed..3d75a924ca6 100644
--- a/cpp/test/Ice/optional/Server.cpp
+++ b/cpp/test/Ice/optional/Server.cpp
@@ -40,7 +40,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/optional/ServerAMD.cpp b/cpp/test/Ice/optional/ServerAMD.cpp
index c47b19721b5..ddbc1a2eb28 100644
--- a/cpp/test/Ice/optional/ServerAMD.cpp
+++ b/cpp/test/Ice/optional/ServerAMD.cpp
@@ -39,7 +39,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/Ice/optional/run.py b/cpp/test/Ice/optional/run.py
deleted file mode 100755
index a3ccc80fc2e..00000000000
--- a/cpp/test/Ice/optional/run.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "compact", message = "Running test with compact (default) format.")
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.",
- additionalClientOptions="--Ice.Default.SlicedFormat",
- additionalServerOptions="--Ice.Default.SlicedFormat")
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server = TestUtil.getTestExecutable("serveramd"))
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/plugin/Client.cpp b/cpp/test/Ice/plugin/Client.cpp
index 85a060f89f7..2a677456bbe 100644
--- a/cpp/test/Ice/plugin/Client.cpp
+++ b/cpp/test/Ice/plugin/Client.cpp
@@ -87,6 +87,7 @@ main(int argc, char* argv[])
if(argc < 2)
{
cerr << "usage: " << argv[0] << " <plugindir>";
+ return 1;
}
//
@@ -105,7 +106,8 @@ main(int argc, char* argv[])
cout << "testing static plugin factory... " << flush;
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
MyPluginPtr plugin = ICE_DYNAMIC_CAST(MyPlugin, communicator->getPluginManager()->getPlugin("Static1"));
test(plugin && plugin->isInitialized());
try
@@ -124,8 +126,7 @@ main(int argc, char* argv[])
}
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.Static2", "1");
communicator = Ice::initialize(argc, argv, initData);
MyPluginPtr plugin = ICE_DYNAMIC_CAST(MyPlugin, communicator->getPluginManager()->getPlugin("Static1"));
@@ -144,8 +145,7 @@ main(int argc, char* argv[])
cout << "testing a simple plug-in... " << flush;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.Test", pluginDir + "TestPlugin:createPlugin");
communicator = Ice::initialize(argc, argv, initData);
communicator->destroy();
@@ -172,8 +172,7 @@ main(int argc, char* argv[])
os << 'a' << (patchVersion - 50);
}
os << ":createPlugin";
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.Test", os.str());
communicator = Ice::initialize(argc, argv, initData);
communicator->destroy();
@@ -185,8 +184,7 @@ main(int argc, char* argv[])
}
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.Test", pluginDir + "TestPlugin,10:createPlugin");
communicator = Ice::initialize(argc, argv, initData);
test(false);
@@ -196,8 +194,7 @@ main(int argc, char* argv[])
}
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.Test", "TestPlugin,1.0.0:createPlugin");
communicator = Ice::initialize(argc, argv, initData);
test(false);
@@ -207,8 +204,7 @@ main(int argc, char* argv[])
}
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.Test",
pluginDir + "TestPlugin:createPluginWithArgs 'C:\\Program Files\\' --DatabasePath "
"'C:\\Program Files\\Application\\db'" );
@@ -226,8 +222,7 @@ main(int argc, char* argv[])
communicator = 0;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.Test", pluginDir + "TestPlugin:createPluginInitializeFail");
communicator = Ice::initialize(argc, argv, initData);
test(false);
@@ -242,8 +237,7 @@ main(int argc, char* argv[])
cout << "testing plug-in load order... " << flush;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.PluginOne", pluginDir + "TestPlugin:createPluginOne");
initData.properties->setProperty("Ice.Plugin.PluginTwo", pluginDir + "TestPlugin:createPluginTwo");
initData.properties->setProperty("Ice.Plugin.PluginThree", pluginDir + "TestPlugin:createPluginThree");
@@ -261,8 +255,7 @@ main(int argc, char* argv[])
cout << "testing plug-in manager... " << flush;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.PluginOne", pluginDir + "TestPlugin:createPluginOne");
initData.properties->setProperty("Ice.Plugin.PluginTwo", pluginDir + "TestPlugin:createPluginTwo");
initData.properties->setProperty("Ice.Plugin.PluginThree", pluginDir + "TestPlugin:createPluginThree");
@@ -298,8 +291,7 @@ main(int argc, char* argv[])
communicator = 0;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Plugin.PluginOneFail", pluginDir + "TestPlugin:createPluginOneFail");
initData.properties->setProperty("Ice.Plugin.PluginTwoFail", pluginDir + "TestPlugin:createPluginTwoFail");
initData.properties->setProperty("Ice.Plugin.PluginThreeFail", pluginDir + "TestPlugin:createPluginThreeFail");
diff --git a/cpp/test/Ice/plugin/run.py b/cpp/test/Ice/plugin/run.py
deleted file mode 100755
index 604c9cec295..00000000000
--- a/cpp/test/Ice/plugin/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testplugin"))])
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client, options=TestUtil.getTestDirectory("testplugin"))
diff --git a/cpp/test/Ice/plugin/test.py b/cpp/test/Ice/plugin/test.py
new file mode 100644
index 00000000000..407e36f05c8
--- /dev/null
+++ b/cpp/test/Ice/plugin/test.py
@@ -0,0 +1,12 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+TestSuite(__file__,
+ [ClientTestCase(client=SimpleClient(args=lambda process, current: [current.getBuildDir("testplugin")]))],
+ libDirs=["testplugin"])
diff --git a/cpp/test/Ice/properties/run.py b/cpp/test/Ice/properties/run.py
deleted file mode 100755
index c31a553ab06..00000000000
--- a/cpp/test/Ice/properties/run.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, locale
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-if TestUtil.isAIX():
- encoding = locale.getdefaultlocale()[1]
- if encoding != "UTF-8":
- print("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8")
- print("Skipping test")
- sys.exit(0)
-
-#
-# Write config
-#
-if sys.version_info[0] == 2:
- configPath = "./config/\xe4\xb8\xad\xe5\x9b\xbd_client.config"
- decodedPath = configPath.decode("utf-8")
-else:
- configPath = "./config/\u4e2d\u56fd_client.config"
- decodedPath = configPath # No need to decode with Python3, strings are already Unicode
-
-
-TestUtil.createFile(decodedPath,
- ["# Automatically generated by Ice test driver.",
- "Ice.Trace.Protocol=1",
- "Ice.Trace.Network=1",
- "Ice.ProgramName=PropertiesClient",
- "Config.Path=" + configPath],
- "utf-8")
-
-TestUtil.simpleTest(client)
-
-if os.path.exists(decodedPath):
- os.remove(decodedPath)
diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp
index 03f6d87b367..25ce9ac8ffb 100644
--- a/cpp/test/Ice/proxy/AllTests.cpp
+++ b/cpp/test/Ice/proxy/AllTests.cpp
@@ -1260,10 +1260,6 @@ allTests(const Ice::CommunicatorPtr& communicator)
}
const bool tcp = communicator->getProperties()->getProperty("Ice.Default.Protocol") == "tcp";
- if(tcp)
- {
- p1->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping();
- }
// Two legal TCP endpoints expressed as opaque endpoints
p1 = communicator->stringToProxy("test -e 1.0:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA==:opaque -e 1.0 -t 1 -v CTEyNy4wLjAuMusuAAAQJwAAAA==");
@@ -1288,23 +1284,6 @@ allTests(const Ice::CommunicatorPtr& communicator)
}
//
- // Try to invoke on the endpoint to verify that we get a
- // NoEndpointException (or ConnectionRefusedException when
- // running with SSL).
- //
- if(ssl)
- {
- try
- {
- p1->ice_encodingVersion(Ice::Encoding_1_0)->ice_ping();
- test(false);
- }
- catch(const Ice::ConnectFailedException&)
- {
- }
- }
-
- //
// Test that the proxy with an SSL endpoint and a nonsense
// endpoint (which the server doesn't understand either) can be
// sent over the wire and returned by the server without losing
diff --git a/cpp/test/Ice/proxy/Client.cpp b/cpp/test/Ice/proxy/Client.cpp
index dfd2ae3820f..9ba427230dd 100644
--- a/cpp/test/Ice/proxy/Client.cpp
+++ b/cpp/test/Ice/proxy/Client.cpp
@@ -38,7 +38,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/proxy", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
rc.finished(status);
diff --git a/cpp/test/Ice/proxy/Collocated.cpp b/cpp/test/Ice/proxy/Collocated.cpp
index 2c7e91d3106..4979865f18b 100644
--- a/cpp/test/Ice/proxy/Collocated.cpp
+++ b/cpp/test/Ice/proxy/Collocated.cpp
@@ -38,8 +38,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/proxy/Server.cpp b/cpp/test/Ice/proxy/Server.cpp
index ac9b496ae68..793fb95f7a6 100644
--- a/cpp/test/Ice/proxy/Server.cpp
+++ b/cpp/test/Ice/proxy/Server.cpp
@@ -36,10 +36,8 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
-
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
diff --git a/cpp/test/Ice/proxy/ServerAMD.cpp b/cpp/test/Ice/proxy/ServerAMD.cpp
index db603a4570a..ee5d4556be9 100644
--- a/cpp/test/Ice/proxy/ServerAMD.cpp
+++ b/cpp/test/Ice/proxy/ServerAMD.cpp
@@ -36,8 +36,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
diff --git a/cpp/test/Ice/proxy/run.py b/cpp/test/Ice/proxy/run.py
deleted file mode 100755
index 38e60970744..00000000000
--- a/cpp/test/Ice/proxy/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server = TestUtil.getTestExecutable("serveramd"))
-TestUtil.queueCollocatedTest(additionalOptions = "--Ice.ToStringMode=Compat")
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/retry/Client.cpp b/cpp/test/Ice/retry/Client.cpp
index 176071a2f71..082d50c3290 100644
--- a/cpp/test/Ice/retry/Client.cpp
+++ b/cpp/test/Ice/retry/Client.cpp
@@ -36,8 +36,7 @@ main(int argc, char* argv[])
{
initCounts();
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.observer = getObserver();
//
// This test kills connections, so we don't want warnings.
diff --git a/cpp/test/Ice/retry/Collocated.cpp b/cpp/test/Ice/retry/Collocated.cpp
index 1c83cb7c996..8802c73bf0f 100644
--- a/cpp/test/Ice/retry/Collocated.cpp
+++ b/cpp/test/Ice/retry/Collocated.cpp
@@ -46,8 +46,7 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.observer = getObserver();
initData.properties->setProperty("Ice.RetryIntervals", "0 1 10 1");
diff --git a/cpp/test/Ice/retry/Server.cpp b/cpp/test/Ice/retry/Server.cpp
index a0e37557fbf..ae448e377a7 100644
--- a/cpp/test/Ice/retry/Server.cpp
+++ b/cpp/test/Ice/retry/Server.cpp
@@ -36,8 +36,7 @@ main(int argc, char* argv[])
int status = EXIT_FAILURE;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
initData.properties->setProperty("Ice.PrintStackTraces", "0");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
diff --git a/cpp/test/Ice/retry/run.py b/cpp/test/Ice/retry/run.py
deleted file mode 100755
index 2d96b653cfa..00000000000
--- a/cpp/test/Ice/retry/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/servantLocator/Client.cpp b/cpp/test/Ice/servantLocator/Client.cpp
index 2f36a63a9d0..a3805686f23 100644
--- a/cpp/test/Ice/servantLocator/Client.cpp
+++ b/cpp/test/Ice/servantLocator/Client.cpp
@@ -37,8 +37,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/servantLocator", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
diff --git a/cpp/test/Ice/servantLocator/Collocated.cpp b/cpp/test/Ice/servantLocator/Collocated.cpp
index aeb02c0e36d..abc9c70b24d 100644
--- a/cpp/test/Ice/servantLocator/Collocated.cpp
+++ b/cpp/test/Ice/servantLocator/Collocated.cpp
@@ -113,8 +113,7 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
diff --git a/cpp/test/Ice/servantLocator/Server.cpp b/cpp/test/Ice/servantLocator/Server.cpp
index c5c78e23881..5215bb762c0 100644
--- a/cpp/test/Ice/servantLocator/Server.cpp
+++ b/cpp/test/Ice/servantLocator/Server.cpp
@@ -113,8 +113,7 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
diff --git a/cpp/test/Ice/servantLocator/ServerAMD.cpp b/cpp/test/Ice/servantLocator/ServerAMD.cpp
index 740d6072b33..d2b3b82568d 100644
--- a/cpp/test/Ice/servantLocator/ServerAMD.cpp
+++ b/cpp/test/Ice/servantLocator/ServerAMD.cpp
@@ -112,8 +112,7 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
diff --git a/cpp/test/Ice/servantLocator/run.py b/cpp/test/Ice/servantLocator/run.py
deleted file mode 100755
index 7921ce9e9ff..00000000000
--- a/cpp/test/Ice/servantLocator/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.queueClientServerTest(configName = "amd", localOnly = True, message = "Running test with AMD server.",
- server = TestUtil.getTestExecutable("serveramd"))
-TestUtil.queueCollocatedTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/services/AllTests.cpp b/cpp/test/Ice/services/AllTests.cpp
index 7720dfaab94..3696729a06b 100644
--- a/cpp/test/Ice/services/AllTests.cpp
+++ b/cpp/test/Ice/services/AllTests.cpp
@@ -143,7 +143,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
cout << "Testing IceGrid stub... " << flush;
- Ice::ObjectPrxPtr base = communicator->stringToProxy("test:default -p 12010");
+ Ice::ObjectPrxPtr base = communicator->stringToProxy("test:" + getTestEndpoint(communicator, 0));
IceGrid::RegistryPrxPtr registry = ICE_UNCHECKED_CAST(IceGrid::RegistryPrx, base);
IceGrid::AdminSessionPrxPtr session;
IceGrid::AdminPrxPtr admin;
diff --git a/cpp/test/Ice/services/Client.cpp b/cpp/test/Ice/services/Client.cpp
index c8268911231..b54125cf926 100644
--- a/cpp/test/Ice/services/Client.cpp
+++ b/cpp/test/Ice/services/Client.cpp
@@ -33,8 +33,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.NullHandleAbort", "0");
Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator(), initData);
diff --git a/cpp/test/Ice/services/run.py b/cpp/test/Ice/services/run.py
deleted file mode 100755
index 1a758d84c41..00000000000
--- a/cpp/test/Ice/services/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client)
diff --git a/cpp/test/Ice/slicing/exceptions/Client.cpp b/cpp/test/Ice/slicing/exceptions/Client.cpp
index 76bbf7f7f8f..270e4e3e6b2 100644
--- a/cpp/test/Ice/slicing/exceptions/Client.cpp
+++ b/cpp/test/Ice/slicing/exceptions/Client.cpp
@@ -37,7 +37,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
RemoteConfig rc("Ice/slicing/exceptions", argc, argv, ich.communicator());
int status = run(argc, argv, ich.communicator());
rc.finished(status);
diff --git a/cpp/test/Ice/slicing/exceptions/Server.cpp b/cpp/test/Ice/slicing/exceptions/Server.cpp
index 909b87b7fc0..c69fcfdb43e 100644
--- a/cpp/test/Ice/slicing/exceptions/Server.cpp
+++ b/cpp/test/Ice/slicing/exceptions/Server.cpp
@@ -37,7 +37,8 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp b/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp
index c5534dcc207..831bb423f9c 100644
--- a/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp
+++ b/cpp/test/Ice/slicing/exceptions/ServerAMD.cpp
@@ -37,7 +37,8 @@ main(int argc, char* argv[])
#endif
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/slicing/exceptions/run.py b/cpp/test/Ice/slicing/exceptions/run.py
deleted file mode 100755
index cbec6614fa6..00000000000
--- a/cpp/test/Ice/slicing/exceptions/run.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../.."]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.")
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True,
- message = "Running test with sliced format and AMD server.", server=TestUtil.getTestExecutable("serveramd"))
-
-TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True,
- message = "Running test with 1.0 encoding and AMD server.",
- server=TestUtil.getTestExecutable("serveramd"),
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/slicing/objects/Client.cpp b/cpp/test/Ice/slicing/objects/Client.cpp
index d4c9018909b..0b0b9cce780 100644
--- a/cpp/test/Ice/slicing/objects/Client.cpp
+++ b/cpp/test/Ice/slicing/objects/Client.cpp
@@ -37,8 +37,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// For this test, we enable object collection.
//
diff --git a/cpp/test/Ice/slicing/objects/Server.cpp b/cpp/test/Ice/slicing/objects/Server.cpp
index 093997a59ef..50685cf1384 100644
--- a/cpp/test/Ice/slicing/objects/Server.cpp
+++ b/cpp/test/Ice/slicing/objects/Server.cpp
@@ -39,7 +39,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/slicing/objects/ServerAMD.cpp b/cpp/test/Ice/slicing/objects/ServerAMD.cpp
index 28e3b390606..92c679ec31b 100644
--- a/cpp/test/Ice/slicing/objects/ServerAMD.cpp
+++ b/cpp/test/Ice/slicing/objects/ServerAMD.cpp
@@ -39,7 +39,8 @@ main(int argc, char* argv[])
try
{
- Ice::CommunicatorHolder ich = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData);
return run(argc, argv, ich.communicator());
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/slicing/objects/run.py b/cpp/test/Ice/slicing/objects/run.py
deleted file mode 100755
index 6fe120a056c..00000000000
--- a/cpp/test/Ice/slicing/objects/run.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../..", "../../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(configName = "sliced", message = "Running test with sliced format.")
-
-TestUtil.queueClientServerTest(configName = "1.0", message = "Running test with 1.0 encoding.",
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-
-TestUtil.queueClientServerTest(configName = "slicedAMD", localOnly = True,
- message = "Running test with sliced format and AMD server.", server=TestUtil.getTestExecutable("serveramd"))
-
-TestUtil.queueClientServerTest(configName = "1.0AMD", localOnly = True,
- message = "Running test with 1.0 encoding and AMD server.",
- server=TestUtil.getTestExecutable("serveramd"),
- additionalClientOptions="--Ice.Default.EncodingVersion=1.0",
- additionalServerOptions="--Ice.Default.EncodingVersion=1.0")
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp
index eb3fb613280..c7455d7c012 100644
--- a/cpp/test/Ice/stream/Client.cpp
+++ b/cpp/test/Ice/stream/Client.cpp
@@ -1306,7 +1306,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/stream/run.py b/cpp/test/Ice/stream/run.py
deleted file mode 100755
index 06bc2ab56a0..00000000000
--- a/cpp/test/Ice/stream/run.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-print("Running test with default encoding...")
-TestUtil.simpleTest(client)
-
-print("Running test with 1.0 encoding...")
-TestUtil.simpleTest(client, "--Ice.Default.EncodingVersion=1.0")
diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp
index f0d7f4df1cd..f4e0101897e 100644
--- a/cpp/test/Ice/stringConverter/Client.cpp
+++ b/cpp/test/Ice/stringConverter/Client.cpp
@@ -27,8 +27,7 @@ main(int argc, char* argv[])
Ice::registerIceStringConverter();
#endif
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
string narrowEncoding;
string wideEncoding;
diff --git a/cpp/test/Ice/stringConverter/Server.cpp b/cpp/test/Ice/stringConverter/Server.cpp
index e82f6caf0ab..63248a612ce 100644
--- a/cpp/test/Ice/stringConverter/Server.cpp
+++ b/cpp/test/Ice/stringConverter/Server.cpp
@@ -65,8 +65,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/Ice/stringConverter/run.py b/cpp/test/Ice/stringConverter/run.py
deleted file mode 100755
index eb60390efe1..00000000000
--- a/cpp/test/Ice/stringConverter/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/threadPoolPriority/Client.cpp b/cpp/test/Ice/threadPoolPriority/Client.cpp
index b3797d00feb..5ca601e09d8 100644
--- a/cpp/test/Ice/threadPoolPriority/Client.cpp
+++ b/cpp/test/Ice/threadPoolPriority/Client.cpp
@@ -36,7 +36,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/threadPoolPriority/Server.cpp b/cpp/test/Ice/threadPoolPriority/Server.cpp
index b1957badf2f..1eed7ce28c4 100644
--- a/cpp/test/Ice/threadPoolPriority/Server.cpp
+++ b/cpp/test/Ice/threadPoolPriority/Server.cpp
@@ -67,7 +67,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/threadPoolPriority/ServerCustomThreadPool.cpp b/cpp/test/Ice/threadPoolPriority/ServerCustomThreadPool.cpp
index 3d67cc16c3f..559752de5f9 100644
--- a/cpp/test/Ice/threadPoolPriority/ServerCustomThreadPool.cpp
+++ b/cpp/test/Ice/threadPoolPriority/ServerCustomThreadPool.cpp
@@ -71,7 +71,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/Ice/threadPoolPriority/run.py b/cpp/test/Ice/threadPoolPriority/run.py
deleted file mode 100755
index bc73b82596f..00000000000
--- a/cpp/test/Ice/threadPoolPriority/run.py
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest(message = "Running test with default server thread pool.")
-TestUtil.queueClientServerTest(configName = "custom", message = "Running test with custom server thread pool.",
- server = TestUtil.getTestExecutable("servercustom"))
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/threadPoolPriority/test.py b/cpp/test/Ice/threadPoolPriority/test.py
new file mode 100644
index 00000000000..350997731e9
--- /dev/null
+++ b/cpp/test/Ice/threadPoolPriority/test.py
@@ -0,0 +1,14 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+if not isinstance(platform, Darwin) and (isinstance(platform, Windows) or os.getuid() == 0):
+ TestSuite(__file__, [
+ ClientServerTestCase(),
+ ClientServerTestCase(name="client/custom server", server="servercustom")
+ ], options={ "mx" : [False] })
diff --git a/cpp/test/Ice/timeout/Client.cpp b/cpp/test/Ice/timeout/Client.cpp
index fa78aa30002..86325621840 100644
--- a/cpp/test/Ice/timeout/Client.cpp
+++ b/cpp/test/Ice/timeout/Client.cpp
@@ -34,8 +34,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
//
// For this test, we want to disable retries.
diff --git a/cpp/test/Ice/timeout/Server.cpp b/cpp/test/Ice/timeout/Server.cpp
index f355ce381fa..67294383853 100644
--- a/cpp/test/Ice/timeout/Server.cpp
+++ b/cpp/test/Ice/timeout/Server.cpp
@@ -38,8 +38,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
#if TARGET_OS_IPHONE != 0
//
diff --git a/cpp/test/Ice/timeout/run.py b/cpp/test/Ice/timeout/run.py
deleted file mode 100755
index eb60390efe1..00000000000
--- a/cpp/test/Ice/timeout/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-TestUtil.queueClientServerTest()
-TestUtil.runQueuedTests()
diff --git a/cpp/test/Ice/udp/AllTests.cpp b/cpp/test/Ice/udp/AllTests.cpp
index 5c63a380442..b9945f8d724 100644
--- a/cpp/test/Ice/udp/AllTests.cpp
+++ b/cpp/test/Ice/udp/AllTests.cpp
@@ -62,14 +62,14 @@ ICE_DEFINE_PTR(PingReplyIPtr, PingReplyI);
void
allTests(const CommunicatorPtr& communicator)
{
- communicator->getProperties()->setProperty("ReplyAdapter.Endpoints", "udp -p 12030");
+ communicator->getProperties()->setProperty("ReplyAdapter.Endpoints", "udp");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ReplyAdapter");
PingReplyIPtr replyI = ICE_MAKE_SHARED(PingReplyI);
PingReplyPrxPtr reply = ICE_UNCHECKED_CAST(PingReplyPrx, adapter->addWithUUID(replyI))->ice_datagram();
adapter->activate();
cout << "testing udp... " << flush;
- ObjectPrxPtr base = communicator->stringToProxy("test -d:udp -p 12010");
+ ObjectPrxPtr base = communicator->stringToProxy("test -d:" + getTestEndpoint(communicator, 0, "udp"));
TestIntfPrxPtr obj = ICE_UNCHECKED_CAST(TestIntfPrx, base);
int nRetry = 5;
@@ -87,7 +87,7 @@ allTests(const CommunicatorPtr& communicator)
}
// If the 3 datagrams were not received within the 2 seconds, we try again to
- // receive 3 new datagrams using a new object. We give up after 5 retries.
+ // receive 3 new datagrams using a new object. We give up after 5 retries.
replyI = ICE_MAKE_SHARED(PingReplyI);
reply = ICE_UNCHECKED_CAST(PingReplyPrx, adapter->addWithUUID(replyI))->ice_datagram();
}
@@ -175,7 +175,7 @@ allTests(const CommunicatorPtr& communicator)
}
#endif
- cout << "testing udp bi-dir connection... " << flush;
+ cout << "testing udp bi-dir connection... " << flush;
obj->ice_getConnection()->setAdapter(adapter);
objMcast->ice_getConnection()->setAdapter(adapter);
nRetry = 5;
@@ -192,7 +192,7 @@ allTests(const CommunicatorPtr& communicator)
}
// If the 3 datagrams were not received within the 2 seconds, we try again to
- // receive 3 new datagrams using a new object. We give up after 5 retries.
+ // receive 3 new datagrams using a new object. We give up after 5 retries.
replyI = ICE_MAKE_SHARED(PingReplyI);
reply = ICE_UNCHECKED_CAST(PingReplyPrx, adapter->addWithUUID(replyI))->ice_datagram();
}
@@ -204,8 +204,8 @@ allTests(const CommunicatorPtr& communicator)
// platform (it works for OS X Leopard but not Snow Leopard, doesn't work on SLES,
// Windows...). For Windows, see UdpTransceiver constructor for the details. So
// we don't run this test.
- //
-// cout << "testing udp bi-dir connection... " << flush;
+ //
+// cout << "testing udp bi-dir connection... " << flush;
// nRetry = 5;
// while(nRetry-- > 0)
// {
@@ -215,7 +215,7 @@ allTests(const CommunicatorPtr& communicator)
// if(ret)
// {
// break; // Success
-// }
+// }
// replyI = new PingReplyI;
// reply = PingReplyPrx::uncheckedCast(adapter->addWithUUID(replyI))->ice_datagram();
// }
diff --git a/cpp/test/Ice/udp/Client.cpp b/cpp/test/Ice/udp/Client.cpp
index b52a9cbbccd..596f7adca6d 100644
--- a/cpp/test/Ice/udp/Client.cpp
+++ b/cpp/test/Ice/udp/Client.cpp
@@ -26,7 +26,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
for(int i = 0; i < num; i++)
{
ostringstream os;
- os << "control:tcp -p " << (12010 + i);
+ os << "control:" << getTestEndpoint(communicator, i, "tcp");
ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy(os.str()))->shutdown();
}
return EXIT_SUCCESS;
@@ -41,8 +41,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.UDP.RcvSize", "16384");
initData.properties->setProperty("Ice.UDP.SndSize", "16384");
diff --git a/cpp/test/Ice/udp/Server.cpp b/cpp/test/Ice/udp/Server.cpp
index 9574f504ed7..0203728919a 100644
--- a/cpp/test/Ice/udp/Server.cpp
+++ b/cpp/test/Ice/udp/Server.cpp
@@ -22,16 +22,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
int num = argc == 2 ? atoi(argv[1]) : 0;
- ostringstream os;
- os << "tcp -p " << (12010 + num);
- properties->setProperty("ControlAdapter.Endpoints", os.str());
+ properties->setProperty("ControlAdapter.Endpoints", getTestEndpoint(communicator, num, "tcp"));
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("ControlAdapter");
adapter->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("control"));
adapter->activate();
if(num == 0)
{
- properties->setProperty("TestAdapter.Endpoints", "udp -p 12010");
+ properties->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, num, "udp"));
Ice::ObjectAdapterPtr adapter2 = communicator->createObjectAdapter("TestAdapter");
adapter2->add(ICE_MAKE_SHARED(TestIntfI), Ice::stringToIdentity("test"));
adapter2->activate();
@@ -70,8 +68,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
initData.properties->setProperty("Ice.UDP.SndSize", "16384");
initData.properties->setProperty("Ice.UDP.RcvSize", "16384");
diff --git a/cpp/test/Ice/udp/run.py b/cpp/test/Ice/udp/run.py
deleted file mode 100755
index b4bb1cde735..00000000000
--- a/cpp/test/Ice/udp/run.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-#
-# COMPILERFIX: The server fails to start on Solaris when IPv6 is
-# enabled. It's apparently not possible to use multicast on a
-# linked-local configured link.
-#
-if TestUtil.isSolaris() and TestUtil.ipv6:
- print("test not supported on Solaris with IPv6")
- sys.exit(0)
-
-server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server"))
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-num = 5
-
-serverProc = []
-for i in range(0, num):
- sys.stdout.write("starting server #%d... " % (i + 1))
- sys.stdout.flush()
- serverProc.append(TestUtil.startServer(server, "%d" % i , adapter="McastTestAdapter"))
- print("ok")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, "%d" % num, startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
-for p in serverProc:
- p.waitTestSuccess()
diff --git a/cpp/test/IceBox/admin/Client.cpp b/cpp/test/IceBox/admin/Client.cpp
index ed265a9da1a..07b6c88b0c2 100644
--- a/cpp/test/IceBox/admin/Client.cpp
+++ b/cpp/test/IceBox/admin/Client.cpp
@@ -38,8 +38,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Default.Host", "127.0.0.1");
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
diff --git a/cpp/test/IceBox/admin/run.py b/cpp/test/IceBox/admin/run.py
deleted file mode 100755
index 29ced943cfb..00000000000
--- a/cpp/test/IceBox/admin/run.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-icebox = TestUtil.getIceBox()
-
-config = os.path.join(os.getcwd(), "config.icebox")
-
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testservice"))])
-TestUtil.clientServerTest(additionalServerOptions= '--Ice.Config=\"%s\"' % config, server = icebox)
-
-sys.stdout.write("testing iceboxadmin... ")
-sys.stdout.flush()
-
-admin = TestUtil.getIceBoxAdmin()
-adminconfig = os.path.join(os.getcwd(), "config.admin")
-
-ib = TestUtil.startServer(icebox, args = '--Ice.Config=\"%s\"' % config)
-iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" stop TestService' % adminconfig)
-iba.waitTestSuccess()
-iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" start TestService' % adminconfig)
-iba.waitTestSuccess()
-iba = TestUtil.startClient(admin, args = '--Ice.Config=\"%s\" shutdown' % adminconfig)
-iba.waitTestSuccess()
-ib.waitTestSuccess()
-
-print("ok")
diff --git a/cpp/test/IceBox/configuration/AllTests.cpp b/cpp/test/IceBox/configuration/AllTests.cpp
index 6f45cee8e6d..e17fd2fe0a3 100644
--- a/cpp/test/IceBox/configuration/AllTests.cpp
+++ b/cpp/test/IceBox/configuration/AllTests.cpp
@@ -15,12 +15,12 @@ using namespace std;
using namespace Test;
void
-allTests(const Ice::CommunicatorPtr& communicator)
+allTests(const Ice::CommunicatorPtr& com)
{
- TestIntfPrxPtr service1 = ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy("test:tcp -p 12010"));
- TestIntfPrxPtr service2 = ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy("test:tcp -p 12011"));
- TestIntfPrxPtr service3 = ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy("test:tcp -p 12012"));
- TestIntfPrxPtr service4 = ICE_UNCHECKED_CAST(TestIntfPrx, communicator->stringToProxy("test:tcp -p 12013"));
+ TestIntfPrxPtr service1 = ICE_UNCHECKED_CAST(TestIntfPrx, com->stringToProxy("test:" + getTestEndpoint(com, 0)));
+ TestIntfPrxPtr service2 = ICE_UNCHECKED_CAST(TestIntfPrx, com->stringToProxy("test:" + getTestEndpoint(com, 1)));
+ TestIntfPrxPtr service3 = ICE_UNCHECKED_CAST(TestIntfPrx, com->stringToProxy("test:" + getTestEndpoint(com, 2)));
+ TestIntfPrxPtr service4 = ICE_UNCHECKED_CAST(TestIntfPrx, com->stringToProxy("test:" + getTestEndpoint(com, 3)));
if(service1->getProperty("IceBox.InheritProperties") == "")
{
diff --git a/cpp/test/IceBox/configuration/Client.cpp b/cpp/test/IceBox/configuration/Client.cpp
index ed265a9da1a..07b6c88b0c2 100644
--- a/cpp/test/IceBox/configuration/Client.cpp
+++ b/cpp/test/IceBox/configuration/Client.cpp
@@ -38,8 +38,7 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Default.Host", "127.0.0.1");
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
diff --git a/cpp/test/IceBox/configuration/config.service1 b/cpp/test/IceBox/configuration/config.service1
index 6028e615ff5..3e38245a5d0 100644
--- a/cpp/test/IceBox/configuration/config.service1
+++ b/cpp/test/IceBox/configuration/config.service1
@@ -1,4 +1,4 @@
-Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1
+Service1OA.Endpoints=default -p 12010 -h 127.0.0.1
#Ice.ProgramName
Service=1
diff --git a/cpp/test/IceBox/configuration/config.service1-2 b/cpp/test/IceBox/configuration/config.service1-2
index c173914db2a..835acbadfc9 100644
--- a/cpp/test/IceBox/configuration/config.service1-2
+++ b/cpp/test/IceBox/configuration/config.service1-2
@@ -1,4 +1,4 @@
-Service1OA.Endpoints=tcp -p 12010 -h 127.0.0.1
+Service1OA.Endpoints=default -p 12010 -h 127.0.0.1
#Ice.ProgramName
Service1.Prop=1
diff --git a/cpp/test/IceBox/configuration/config.service2 b/cpp/test/IceBox/configuration/config.service2
index 78e08aadba6..95d33831a14 100644
--- a/cpp/test/IceBox/configuration/config.service2
+++ b/cpp/test/IceBox/configuration/config.service2
@@ -1,4 +1,4 @@
-Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1
+Service2OA.Endpoints=default -p 12011 -h 127.0.0.1
Ice.ProgramName=Test
Service=2
diff --git a/cpp/test/IceBox/configuration/config.service2-2 b/cpp/test/IceBox/configuration/config.service2-2
index 36c8d0812cb..6ed8dc9df49 100644
--- a/cpp/test/IceBox/configuration/config.service2-2
+++ b/cpp/test/IceBox/configuration/config.service2-2
@@ -1,4 +1,4 @@
-Service2OA.Endpoints=tcp -p 12011 -h 127.0.0.1
+Service2OA.Endpoints=default -p 12011 -h 127.0.0.1
#Ice.ProgramName
Service2.Prop=1
diff --git a/cpp/test/IceBox/configuration/config.service3 b/cpp/test/IceBox/configuration/config.service3
index c93ed144701..6cba4b351b0 100644
--- a/cpp/test/IceBox/configuration/config.service3
+++ b/cpp/test/IceBox/configuration/config.service3
@@ -1,4 +1,4 @@
-Service3OA.Endpoints=tcp -p 12012 -h 127.0.0.1
+Service3OA.Endpoints=default -p 12012 -h 127.0.0.1
#Ice.ProgramName
Service=3
diff --git a/cpp/test/IceBox/configuration/config.service4 b/cpp/test/IceBox/configuration/config.service4
index 182fb3a7289..a70120dd192 100644
--- a/cpp/test/IceBox/configuration/config.service4
+++ b/cpp/test/IceBox/configuration/config.service4
@@ -1,4 +1,4 @@
-Service4OA.Endpoints=tcp -p 12013 -h 127.0.0.1
+Service4OA.Endpoints=default -p 12013 -h 127.0.0.1
#Ice.ProgramName
Service=4
diff --git a/cpp/test/IceBox/configuration/run.py b/cpp/test/IceBox/configuration/run.py
deleted file mode 100755
index d76fa51b96f..00000000000
--- a/cpp/test/IceBox/configuration/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-icebox = TestUtil.getIceBox()
-
-config = os.path.join(os.getcwd(), "config.icebox")
-config2 = os.path.join(os.getcwd(), "config.icebox2")
-
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testservice"))])
-TestUtil.clientServerTest(additionalServerOptions= '--Ice.Config="%s"' % config, server = icebox)
-TestUtil.clientServerTest(additionalServerOptions= '--Ice.Config="%s"' % config2, server = icebox)
diff --git a/cpp/test/IceDiscovery/simple/AllTests.cpp b/cpp/test/IceDiscovery/simple/AllTests.cpp
index e373f443cdd..558207c8c4e 100644
--- a/cpp/test/IceDiscovery/simple/AllTests.cpp
+++ b/cpp/test/IceDiscovery/simple/AllTests.cpp
@@ -83,7 +83,7 @@ allTests(const CommunicatorPtr& communicator, int num)
}
}
cout << "ok" << endl;
-
+
cout << "testing object adapter migration..." << flush;
{
proxies[0]->activateObjectAdapter("oa", "oa1", "");
diff --git a/cpp/test/IceDiscovery/simple/Client.cpp b/cpp/test/IceDiscovery/simple/Client.cpp
index 4c26f7679b0..5a7ceb63473 100644
--- a/cpp/test/IceDiscovery/simple/Client.cpp
+++ b/cpp/test/IceDiscovery/simple/Client.cpp
@@ -42,7 +42,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/IceDiscovery/simple/Server.cpp b/cpp/test/IceDiscovery/simple/Server.cpp
index ef543fa090e..dd694fd3778 100644
--- a/cpp/test/IceDiscovery/simple/Server.cpp
+++ b/cpp/test/IceDiscovery/simple/Server.cpp
@@ -24,7 +24,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
ostringstream os;
- os << "default -p " << (12010 + num);
+ os << getTestEndpoint(communicator, num);
+ cerr << os.str() << endl;
properties->setProperty("ControlAdapter.Endpoints", os.str());
}
{
@@ -60,7 +61,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/IceDiscovery/simple/run.py b/cpp/test/IceDiscovery/simple/run.py
deleted file mode 100755
index 01400997d04..00000000000
--- a/cpp/test/IceDiscovery/simple/run.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-server = os.path.join(os.getcwd(), TestUtil.getTestExecutable("server"))
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-num = 3
-
-args = " --IceDiscovery.Timeout=50"
-args += " --IceDiscovery.RetryCount=5"
-if not TestUtil.ipv6:
- args += " --IceDiscovery.Interface=127.0.0.1"
-elif TestUtil.isDarwin():
- args += " --IceDiscovery.Interface=\"::1\""
-
-# Set the plugin property only for the server, the client uses Ice::registerIceDiscovery()
-serverArgs = " --Ice.Plugin.IceDiscovery=IceDiscovery:createIceDiscovery" + args
-serverProc = []
-for i in range(0, num):
- sys.stdout.write("starting server #%d... " % (i + 1))
- sys.stdout.flush()
- serverProc.append(TestUtil.startServer(server, "%d %s " % (i, serverArgs), count = 4))
- print("ok")
-
-sys.stdout.write("starting client... ")
-sys.stdout.flush()
-clientProc = TestUtil.startClient(client, "%d %s" % (num, args), startReader = False)
-print("ok")
-clientProc.startReader()
-
-clientProc.waitTestSuccess()
-for p in serverProc:
- p.waitTestSuccess()
diff --git a/cpp/test/IceGrid/activation/Client.cpp b/cpp/test/IceGrid/activation/Client.cpp
index d1f1cacf8d0..f95f7d0e44c 100644
--- a/cpp/test/IceGrid/activation/Client.cpp
+++ b/cpp/test/IceGrid/activation/Client.cpp
@@ -30,7 +30,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/IceGrid/activation/run.py b/cpp/test/IceGrid/activation/run.py
deleted file mode 100755
index a63c91df643..00000000000
--- a/cpp/test/IceGrid/activation/run.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-IceGridAdmin.iceGridTest("application.xml",
- applicationOptions = ("properties-override='%s' icegridnode.exe='%s' server.dir='%s'" %
- (IceGridAdmin.iceGridNodePropertiesOverride(),
- TestUtil.getIceGridNode(),
- TestUtil.getTestDirectory("server"))))
diff --git a/cpp/test/IceGrid/activation/test.py b/cpp/test/IceGrid/activation/test.py
new file mode 100644
index 00000000000..46d8a9bba8b
--- /dev/null
+++ b/cpp/test/IceGrid/activation/test.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+TestSuite(__file__, [IceGridTestCase()], multihost=False) \ No newline at end of file
diff --git a/cpp/test/IceGrid/admin/run.py b/cpp/test/IceGrid/admin/run.py
deleted file mode 100755
index 5a97714f410..00000000000
--- a/cpp/test/IceGrid/admin/run.py
+++ /dev/null
@@ -1,262 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import sys, os, signal
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-if not TestUtil.isWin32() and os.getuid() == 0:
- sys.stdout.write("\n")
- sys.stdout.write("*** can't run test as root ***\n")
- sys.stdout.write("\n")
- sys.exit(0)
-
-testdir = os.getcwd();
-
-router = TestUtil.getGlacier2Router()
-targets = []
-if TestUtil.appverifier:
- targets = [ TestUtil.getIceGridNode(), TestUtil.getIceGridRegistry(), router]
- TestUtil.setAppVerifierSettings(targets)
-
-registryProcs = IceGridAdmin.startIceGridRegistry(testdir)
-nodeProc = IceGridAdmin.startIceGridNode(testdir)
-
-sys.stdout.write("starting glacier2... ")
-sys.stdout.flush()
-
-args = ' --Glacier2.SessionTimeout=5' + \
- ' --Glacier2.Client.Endpoints="default -p 12347"' + \
- ' --Glacier2.Server.Endpoints="tcp -h 127.0.0.1"' \
- ' --Glacier2.SessionManager=TestIceGrid/AdminSessionManager' + \
- ' --Glacier2.PermissionsVerifier=Glacier2/NullPermissionsVerifier' + \
- ' --Glacier2.SSLSessionManager=TestIceGrid/AdminSSLSessionManager' + \
- ' --Glacier2.SSLPermissionsVerifier=Glacier2/NullSSLPermissionsVerifier' + \
- ' --Ice.Default.Locator="TestIceGrid/Locator:default -p 12010"' + \
- ' --IceSSL.VerifyPeer=1'
-routerProc = TestUtil.startServer(router, args, count=2)
-print("ok")
-
-sys.stdout.write("testing login with username/password... ")
-sys.stdout.flush()
-
-# Direct registry connection with username/password
-icegridadmin = TestUtil.getIceGridAdmin()
-args = ' --Ice.Default.Locator="TestIceGrid/Locator:default -p 12010"' + \
- ' --IceGridAdmin.Username=demo' + \
- ' --IceGridAdmin.Password=dummy'
-admin = TestUtil.startClient(icegridadmin, args, None, None, False)
-admin.expect('>>> ')
-admin.sendline("server list")
-admin.expect('>>> ')
-admin.sendline('exit')
-admin.waitTestSuccess(timeout=120)
-
-# Glacier2 connection with username/password
-args = ' --Ice.Default.Router="Glacier2/router:default -p 12347"' + \
- ' --IceGridAdmin.Username=demo' + \
- ' --IceGridAdmin.Password=dummy'
-admin = TestUtil.startClient(icegridadmin, args, None, None, False)
-admin.expect('>>> ')
-admin.sendline("server list")
-admin.expect('>>> ')
-admin.sendline('exit')
-admin.waitTestSuccess(timeout=120)
-print("ok")
-
-if TestUtil.protocol == "ssl":
-
- sys.stdout.write("testing login with ssl... ")
- sys.stdout.flush()
-
- # Direct registry connection with SSL
- icegridadmin = TestUtil.getIceGridAdmin()
- args = ' --Ice.Default.Locator="TestIceGrid/Locator:default -p 12010" --ssl'
- admin = TestUtil.startClient(icegridadmin, args, None, None, False)
- admin.expect('>>> ')
- admin.sendline("server list")
- admin.expect('>>> ')
- admin.sendline('exit')
- admin.waitTestSuccess(timeout=120)
-
- # Glacier2 connection with username/password
- args = ' --Ice.Default.Router="Glacier2/router:default -p 12347" --ssl'
- admin = TestUtil.startClient(icegridadmin, args, None, None, False)
- admin.expect('>>> ')
- admin.sendline("server list")
- admin.expect('>>> ')
- admin.sendline('exit')
- admin.waitTestSuccess(timeout=120)
-
- print("ok")
-
-sys.stdout.write("testing commands... ")
-sys.stdout.flush()
-icegridadmin = TestUtil.getIceGridAdmin()
-args = ' --Ice.Default.Locator="TestIceGrid/Locator:default -p 12010"' + \
- ' --IceGridAdmin.Username=demo' + \
- ' --IceGridAdmin.Password=dummy'
-admin = TestUtil.startClient(icegridadmin, args, None, None, False)
-try:
- admin.expect('>>> ')
- admin.sendline('application add application.xml server.dir=%s' % TestUtil.getTestDirectory("server"))
- admin.expect('>>> ')
- admin.sendline('application list')
- admin.expect('Test')
- admin.sendline('application describe Test')
- admin.expect('application `Test\'')
- admin.expect('\{.*\}')
- admin.expect('>>> ')
- admin.sendline('application diff application.xml server.dir=%s' % TestUtil.getTestDirectory("server"))
- admin.expect('application `Test\'\n\{.*\}')
- admin.expect('>>> ')
- admin.sendline('application update application.xml server.dir=%s' % TestUtil.getTestDirectory("server"))
- admin.expect('>>> ')
- admin.sendline('application patch Test')
- admin.expect('>>> ')
- admin.sendline('server list')
- admin.expect('server')
- admin.expect('>>> ')
- admin.sendline('server describe server')
- admin.expect('server `server\'\n\{.*\}')
- admin.expect('>>> ')
- admin.sendline('server start server')
- admin.expect('>>> ')
- admin.sendline('server state server')
- admin.expect('^active \(.*\)')
- admin.expect('>>> ')
- admin.sendline('server pid server')
- admin.expect('[0-9]+')
- admin.expect('>>> ')
- admin.sendline('server properties server')
- admin.expect('>>> ')
- admin.sendline('server property server Ice.Admin.ServerId')
- admin.expect("^server")
- admin.expect('>>> ')
- admin.sendline('server patch server')
- admin.expect('>>> ')
- admin.sendline('server disable server')
- admin.expect('>>> ')
- admin.sendline('server enable server')
- admin.expect('>>> ')
- admin.sendline('adapter list')
- admin.expect('TestAdapter')
- admin.expect('>>> ')
- admin.sendline('adapter endpoints TestAdapter')
- admin.expect(['tcp', 'ssl'])
- admin.expect('>>> ')
- admin.sendline('object list')
- admin.expect('test')
- admin.expect('>>> ')
- admin.sendline('object describe')
- admin.expect('proxy = `.*\' type = `.*\'')
- admin.expect('>>> ')
- admin.sendline('object find Test')
- admin.expect('test')
- admin.expect('>>> ')
- admin.sendline('server stop server')
- admin.expect('>>> ')
- admin.sendline('application remove Test')
- admin.expect('>>> ')
- admin.sendline('registry list')
- admin.expect('Master')
- admin.expect('>>> ')
- admin.sendline('registry ping Master')
- admin.expect('registry is up')
- admin.expect('>>> ')
- admin.sendline('registry describe Master')
- admin.expect('registry `Master\'\n{.*}')
- admin.expect('>>> ')
- admin.sendline('node list')
- admin.expect('localnode')
- admin.expect('>>> ')
- admin.sendline('node describe localnode')
- admin.expect('node `localnode\'\n{.*}')
- admin.expect('>>> ')
- admin.sendline('node load localnode')
- admin.expect('load average.*\n')
- admin.expect('>>> ')
- admin.sendline('node ping localnode')
- admin.expect('node is up')
- admin.expect('>>> ')
- admin.sendline('exit')
- admin.waitTestSuccess(timeout=120)
- print("ok")
-except Exception as e:
- admin.terminate()
- print("error: " + str(e))
- print("failed!")
-
-# sys.stdout.write("testing icegridadmin... ")
-# sys.stdout.flush()
-
-# admin = Util.spawn('icegridadmin --Ice.Config=config.admin --Ice.Default.Router="DemoGlacier2/router:ssl -p 4064"')
-# admin.expect('>>> ')
-# admin.sendline("server list")
-# admin.expect('SimpleServer')
-# admin.expect('>>> ')
-# admin.sendline('exit')
-# admin.waitTestSuccess(timeout=120)
-
-# admin = Util.spawn('icegridadmin --Ice.Config=config.admin --ssl')
-# admin.expect('>>> ')
-# admin.sendline("server list")
-# admin.expect('SimpleServer')
-# admin.expect('>>> ')
-# admin.sendline('exit')
-# admin.waitTestSuccess(timeout=120)
-
-# admin = Util.spawn('icegridadmin --Ice.Config=config.admin --ssl --Ice.Default.Router="DemoGlacier2/router:ssl -p 4064"')
-# admin.expect('>>> ')
-# admin.sendline("server list")
-# admin.expect('SimpleServer')
-# admin.expect('>>> ')
-# admin.sendline('exit')
-# admin.waitTestSuccess(timeout=120)
-
-# print("ok")
-
-# sys.stdout.write("completing shutdown... ")
-# sys.stdout.flush()
-
-# admin = Util.spawn('icegridadmin --Ice.Config=config.admin')
-# admin.expect('>>> ')
-
-# admin.sendline('node shutdown Node')
-# admin.expect('>>> ')
-# node.waitTestSuccess(timeout=120)
-
-# admin.sendline('registry shutdown Master')
-# admin.expect('>>> ')
-# registry.waitTestSuccess()
-
-# admin.sendline('exit')
-# admin.waitTestSuccess(timeout=120)
-
-sys.stdout.write("stopping glacier2... ")
-sys.stdout.flush()
-routerProc.kill(signal.SIGINT)
-routerProc.waitTestSuccess()
-print("ok")
-
-IceGridAdmin.iceGridAdmin("node shutdown localnode")
-IceGridAdmin.shutdownIceGridRegistry(registryProcs)
-nodeProc.waitTestSuccess()
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets)
diff --git a/cpp/test/IceGrid/admin/test.py b/cpp/test/IceGrid/admin/test.py
new file mode 100644
index 00000000000..7821d0dfe57
--- /dev/null
+++ b/cpp/test/IceGrid/admin/test.py
@@ -0,0 +1,167 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class IceGridAdminTestCase(IceGridTestCase):
+
+ def __init__(self):
+ self.glacier2router = Glacier2Router(props=routerProps, waitForShutdown=False)
+ IceGridTestCase.__init__(self, application=None, server=self.glacier2router)
+
+ def runClientSide(self, current):
+
+ current.write("testing login with username/password... ")
+
+ admin=IceGridAdmin()
+
+ admin.start(current)
+ admin.expect('>>> ')
+ admin.sendline("server list")
+ admin.expect('>>> ')
+ admin.sendline('exit')
+ admin.stop(current, True)
+
+ defaultRouterProps = { "Ice.Default.Router" : self.glacier2router.getClientProxy(current) }
+
+ admin.start(current, props=defaultRouterProps)
+ admin.expect('>>> ')
+ admin.sendline("server list")
+ admin.expect('>>> ')
+ admin.sendline('exit')
+ admin.stop(current, True)
+
+ current.writeln("ok")
+
+ if current.config.protocol == "ssl":
+
+ current.write("testing login with ssl... ")
+
+ # Direct registry connection with SSL
+ admin.start(current, args=["--ssl"])
+ admin.expect('>>> ')
+ admin.sendline("server list")
+ admin.expect('>>> ')
+ admin.sendline('exit')
+ admin.stop(current, True)
+
+ # Glacier2 connection with username/password
+ admin.start(current, args=["--ssl"], props=defaultRouterProps)
+ admin.expect('>>> ')
+ admin.sendline("server list")
+ admin.expect('>>> ')
+ admin.sendline('exit')
+ admin.stop(current, True)
+
+ current.writeln("ok")
+
+ current.write("testing commands... ")
+ admin.start(current)
+ try:
+ serverDir = current.getBuildDir("server")
+
+ admin.expect('>>> ')
+ admin.sendline('application add application.xml server.dir=%s' % serverDir)
+ admin.expect('>>> ')
+ admin.sendline('application list')
+ admin.expect('Test')
+ admin.sendline('application describe Test')
+ admin.expect('application `Test\'')
+ admin.expect('\{.*\}')
+ admin.expect('>>> ')
+ admin.sendline('application diff application.xml server.dir=%s' % serverDir)
+ admin.expect('application `Test\'\n\{.*\}')
+ admin.expect('>>> ')
+ admin.sendline('application update application.xml server.dir=%s' % serverDir)
+ admin.expect('>>> ')
+ admin.sendline('application patch Test')
+ admin.expect('>>> ')
+ admin.sendline('server list')
+ admin.expect('server')
+ admin.expect('>>> ')
+ admin.sendline('server describe server')
+ admin.expect('server `server\'\n\{.*\}')
+ admin.expect('>>> ')
+ admin.sendline('server start server')
+ admin.expect('>>> ')
+ admin.sendline('server state server')
+ admin.expect('^active \(.*\)')
+ admin.expect('>>> ')
+ admin.sendline('server pid server')
+ admin.expect('[0-9]+')
+ admin.expect('>>> ')
+ admin.sendline('server properties server')
+ admin.expect('>>> ')
+ admin.sendline('server property server Ice.Admin.ServerId')
+ admin.expect("^server")
+ admin.expect('>>> ')
+ admin.sendline('server patch server')
+ admin.expect('>>> ')
+ admin.sendline('server disable server')
+ admin.expect('>>> ')
+ admin.sendline('server enable server')
+ admin.expect('>>> ')
+ admin.sendline('adapter list')
+ admin.expect('TestAdapter')
+ admin.expect('>>> ')
+ admin.sendline('adapter endpoints TestAdapter')
+ admin.expect(['tcp', 'ssl', 'ws', 'wss'])
+ admin.expect('>>> ')
+ admin.sendline('object list')
+ admin.expect('test')
+ admin.expect('>>> ')
+ admin.sendline('object describe')
+ admin.expect('proxy = `.*\' type = `.*\'')
+ admin.expect('>>> ')
+ admin.sendline('object find Test')
+ admin.expect('test')
+ admin.expect('>>> ')
+ admin.sendline('server stop server')
+ admin.expect('>>> ')
+ admin.sendline('application remove Test')
+ admin.expect('>>> ')
+ admin.sendline('registry list')
+ admin.expect('Master')
+ admin.expect('>>> ')
+ admin.sendline('registry ping Master')
+ admin.expect('registry is up')
+ admin.expect('>>> ')
+ admin.sendline('registry describe Master')
+ admin.expect('registry `Master\'\n{.*}')
+ admin.expect('>>> ')
+ admin.sendline('node list')
+ admin.expect('localnode')
+ admin.expect('>>> ')
+ admin.sendline('node describe localnode')
+ admin.expect('node `localnode\'\n{.*}')
+ admin.expect('>>> ')
+ admin.sendline('node load localnode')
+ admin.expect('load average.*\n')
+ admin.expect('>>> ')
+ admin.sendline('node ping localnode')
+ admin.expect('node is up')
+ admin.expect('>>> ')
+ admin.sendline('exit')
+ admin.stop(current, True)
+ current.writeln("ok")
+ except Exception as e:
+ admin.stop(current, False)
+ print("error: " + str(e))
+ print("failed!")
+
+routerProps= lambda process, current: {
+ 'Glacier2.SessionTimeout' : 5,
+ 'Glacier2.SessionManager' : 'TestIceGrid/AdminSessionManager',
+ 'Glacier2.PermissionsVerifier' : 'Glacier2/NullPermissionsVerifier',
+ 'Glacier2.SSLSessionManager' : 'TestIceGrid/AdminSSLSessionManager',
+ 'Glacier2.SSLPermissionsVerifier' : 'Glacier2/NullSSLPermissionsVerifier',
+ 'Ice.Default.Locator' : current.testcase.getLocator(current),
+ 'IceSSL.VerifyPeer' : 1
+}
+
+TestSuite(__file__, [ IceGridAdminTestCase() ], multihost=False) \ No newline at end of file
diff --git a/cpp/test/IceGrid/allocation/Client.cpp b/cpp/test/IceGrid/allocation/Client.cpp
index 9ae4d662dad..f5cbbb67e8f 100644
--- a/cpp/test/IceGrid/allocation/Client.cpp
+++ b/cpp/test/IceGrid/allocation/Client.cpp
@@ -27,8 +27,9 @@ main(int argc, char* argv[])
int status;
Ice::CommunicatorPtr communicator;
try
- {
- communicator = Ice::initialize(argc, argv);
+ {
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/IceGrid/allocation/run.py b/cpp/test/IceGrid/allocation/run.py
deleted file mode 100755
index 1134bcb4756..00000000000
--- a/cpp/test/IceGrid/allocation/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-IceGridAdmin.iceGridTest("application.xml", applicationOptions = "server.dir='%s' verifier.dir='%s'" %
- (TestUtil.getTestDirectory("server"), TestUtil.getTestDirectory("verifier")))
diff --git a/cpp/test/IceGrid/allocation/test.py b/cpp/test/IceGrid/allocation/test.py
new file mode 100644
index 00000000000..5c741aaa38c
--- /dev/null
+++ b/cpp/test/IceGrid/allocation/test.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+TestSuite(__file__, [IceGridTestCase(exevars={ "verifier.dir": "verifier" })], runOnMainThread=True, multihost=False) \ No newline at end of file
diff --git a/cpp/test/IceGrid/deployer/Client.cpp b/cpp/test/IceGrid/deployer/Client.cpp
index b0d3e136eb3..b1afe894a0b 100644
--- a/cpp/test/IceGrid/deployer/Client.cpp
+++ b/cpp/test/IceGrid/deployer/Client.cpp
@@ -57,7 +57,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/IceGrid/deployer/run.py b/cpp/test/IceGrid/deployer/run.py
deleted file mode 100755
index a1ea4e587eb..00000000000
--- a/cpp/test/IceGrid/deployer/run.py
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testservice"))])
-serverDir = os.path.join(os.getcwd(), TestUtil.getTestDirectory("server"))
-os.environ["MY_FOO"] = "12"
-IceGridAdmin.iceGridTest("application.xml", '--TestDir="%s"' % serverDir, ("icebox.exe='%s' server.dir='%s'" %
- (TestUtil.getIceBox(), serverDir)))
-
-# Tests with targets
-IceGridAdmin.iceGridTest("application.xml", '-t --TestDir="%s"' % serverDir,
- ("icebox.exe='%s' server.dir='%s' moreservers moreservices moreproperties" %
- (TestUtil.getIceBox(), serverDir)))
diff --git a/cpp/test/IceGrid/deployer/test.py b/cpp/test/IceGrid/deployer/test.py
new file mode 100644
index 00000000000..d64fbf4b9a4
--- /dev/null
+++ b/cpp/test/IceGrid/deployer/test.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+clientProps=lambda process, current: { "TestDir" : current.getBuildDir("server") }
+
+TestSuite(__file__, [
+ IceGridTestCase("without targets",
+ icegridnode=IceGridNode(envs={ "MY_FOO" : 12 }),
+ client=IceGridClient(props=clientProps)),
+ IceGridTestCase("with targets",
+ icegridnode=IceGridNode(envs={ "MY_FOO" : 12 }),
+ client=IceGridClient(props=clientProps),
+ targets=["moreservers", "moreservices", "moreproperties"])
+], libDirs=["testservice"], multihost=False)
diff --git a/cpp/test/IceGrid/distribution/Client.cpp b/cpp/test/IceGrid/distribution/Client.cpp
index 9ae4d662dad..f5cbbb67e8f 100644
--- a/cpp/test/IceGrid/distribution/Client.cpp
+++ b/cpp/test/IceGrid/distribution/Client.cpp
@@ -27,8 +27,9 @@ main(int argc, char* argv[])
int status;
Ice::CommunicatorPtr communicator;
try
- {
- communicator = Ice::initialize(argc, argv);
+ {
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/IceGrid/distribution/run.py b/cpp/test/IceGrid/distribution/run.py
deleted file mode 100755
index 8e44b30915d..00000000000
--- a/cpp/test/IceGrid/distribution/run.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-def icepatch2Calc(datadir, dirname):
- icePatch2Calc = os.path.join(TestUtil.getCppBinDir(), "icepatch2calc")
- commandProc = TestUtil.spawn('"%s" "%s"' % (icePatch2Calc, os.path.join(datadir, dirname)))
- commandProc.waitTestSuccess()
-
-datadir = os.path.join(os.getcwd(), "data")
-
-files = [
- [ "original/rootfile", "rootfile" ],
- [ "original/dir1/file1", "dummy-file1"],
- [ "original/dir1/file2", "dummy-file2"],
- [ "original/dir2/file3", "dummy-file3"],
- [ "updated/rootfile", "rootfile-updated!" ],
- [ "updated/dir1/file2", "dummy-file2-updated!"],
- [ "updated/dir2/file3", "dummy-file3"],
- [ "updated/dir2/file4", "dummy-file4"],
-]
-
-
-sys.stdout.write("creating IcePatch2 data directory... ")
-sys.stdout.flush()
-if not os.path.exists(datadir):
- os.mkdir(datadir)
-else:
- IceGridAdmin.cleanDbDir(datadir)
-
-for [file, content] in files:
- file = os.path.join(datadir, file)
- if not os.path.exists(os.path.dirname(file)):
- os.makedirs(os.path.dirname(file))
- f = open(file, 'w')
- f.write(content)
- f.close()
-
-icepatch2Calc(datadir, "original")
-icepatch2Calc(datadir, "updated")
-print("ok")
-
-IceGridAdmin.iceGridTest("application.xml", "", "server.dir='%s'" % TestUtil.getTestDirectory("server"))
-
-IceGridAdmin.cleanDbDir(datadir)
-os.rmdir(datadir)
diff --git a/cpp/test/IceGrid/distribution/test.py b/cpp/test/IceGrid/distribution/test.py
new file mode 100644
index 00000000000..1c7d8313781
--- /dev/null
+++ b/cpp/test/IceGrid/distribution/test.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class IceGridDistributionTestCase(IceGridTestCase):
+
+ def setupClientSide(self, current):
+ IceGridTestCase.setupClientSide(self, current)
+
+ datadir = os.path.join(self.getPath(), "data")
+
+ files = [
+ [ "original/rootfile", "rootfile" ],
+ [ "original/dir1/file1", "dummy-file1"],
+ [ "original/dir1/file2", "dummy-file2"],
+ [ "original/dir2/file3", "dummy-file3"],
+ [ "updated/rootfile", "rootfile-updated!" ],
+ [ "updated/dir1/file2", "dummy-file2-updated!"],
+ [ "updated/dir2/file3", "dummy-file3"],
+ [ "updated/dir2/file4", "dummy-file4"],
+ ]
+
+ current.write("creating IcePatch2 data directory... ")
+ self.mkdirs(datadir)
+
+ for [file, content] in files:
+ file = os.path.join(datadir, file)
+ if not os.path.exists(os.path.dirname(file)):
+ os.makedirs(os.path.dirname(file))
+ f = open(file, 'w')
+ f.write(content)
+ f.close()
+
+ IcePatch2Calc(args=[os.path.join(datadir, "original")]).run(current)
+ IcePatch2Calc(args=[os.path.join(datadir, "updated")]).run(current)
+
+ current.writeln("ok")
+
+TestSuite(__file__, [ IceGridDistributionTestCase() ], runOnMainThread=True, multihost=False) \ No newline at end of file
diff --git a/cpp/test/IceGrid/fileLock/run.py b/cpp/test/IceGrid/fileLock/run.py
deleted file mode 100755
index 52358f410f6..00000000000
--- a/cpp/test/IceGrid/fileLock/run.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-testdir = os.getcwd();
-
-# No need to spawn replicas for this test.
-IceGridAdmin.nreplicas = 0
-
-def runIceGridRegistry():
- iceGrid = TestUtil.getIceGridRegistry()
- command = ' --nowarn ' + IceGridAdmin.registryOptions
-
- dataDir = os.path.join(testdir, "db", "registry")
- if not os.path.exists(dataDir):
- os.mkdir(dataDir)
-
- cmd = command + ' ' + \
- r' --Ice.ProgramName=registry' + \
- r' --IceGrid.Registry.Client.Endpoints="default -p ' + str(IceGridAdmin.iceGridPort) + '" ' + \
- r' --IceGrid.Registry.LMDB.MapSize=1 --IceGrid.Registry.LMDB.Path="' + dataDir + '"'
-
- driverConfig = TestUtil.DriverConfig("server")
- driverConfig.lang = "cpp"
-
- cmd = TestUtil.getCommandLine(iceGrid, driverConfig) + ' ' + cmd
- proc = TestUtil.spawn(cmd)
- return proc
-
-registryProcs = IceGridAdmin.startIceGridRegistry(testdir)
-
-sys.stdout.write("testing IceGrid file lock... ")
-IceGridAdmin.iceGridPort = 12011
-iceGrid = runIceGridRegistry()
-iceGrid.expect(".*IceUtil::FileLockException.*")
-iceGrid.wait()
-IceGridAdmin.iceGridPort = 12010
-print("ok")
-
-IceGridAdmin.shutdownIceGridRegistry(registryProcs)
diff --git a/cpp/test/IceGrid/fileLock/test.py b/cpp/test/IceGrid/fileLock/test.py
new file mode 100644
index 00000000000..9a9ee60ece1
--- /dev/null
+++ b/cpp/test/IceGrid/fileLock/test.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class IceGridAdminTestCase(IceGridTestCase):
+
+ def runClientSide(self, current):
+
+ sys.stdout.write("testing IceGrid file lock... ")
+ registry = IceGridRegistryMaster(portnum=25, readyCount=0, quiet=True);
+ registry.start(current)
+ registry.expect(".*IceUtil::FileLockException.*")
+ registry.stop(current, False)
+ print("ok")
+
+
+TestSuite(__file__, [ IceGridAdminTestCase(application=None) ], runOnMainThread=True, multihost=False) \ No newline at end of file
diff --git a/cpp/test/IceGrid/noRestartUpdate/Client.cpp b/cpp/test/IceGrid/noRestartUpdate/Client.cpp
index 9ae4d662dad..f5cbbb67e8f 100644
--- a/cpp/test/IceGrid/noRestartUpdate/Client.cpp
+++ b/cpp/test/IceGrid/noRestartUpdate/Client.cpp
@@ -27,8 +27,9 @@ main(int argc, char* argv[])
int status;
Ice::CommunicatorPtr communicator;
try
- {
- communicator = Ice::initialize(argc, argv);
+ {
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/IceGrid/noRestartUpdate/run.py b/cpp/test/IceGrid/noRestartUpdate/run.py
deleted file mode 100755
index 89cdc8ad8df..00000000000
--- a/cpp/test/IceGrid/noRestartUpdate/run.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-name = os.path.join("IceGrid", "noRestartUpdate")
-
-node1Dir = os.path.join(os.getcwd(), "db", "node-1")
-if not os.path.exists(node1Dir):
- os.mkdir(node1Dir)
-else:
- IceGridAdmin.cleanDbDir(node1Dir)
-
-node2Dir = os.path.join(os.getcwd(), "db", "node-2")
-if not os.path.exists(node2Dir):
- os.mkdir(node2Dir)
-else:
- IceGridAdmin.cleanDbDir(node2Dir)
-
-
-nodeOverrideOptions = '--IceBinDir="%s" --ServerDir="%s" --ServiceDir="%s" --NodePropertiesOverride="%s Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0"' % (
- TestUtil.getCppBinDir("cpp"),
- TestUtil.getTestDirectory("server"),
- TestUtil.getTestDirectory("testservice"),
- TestUtil.getCommandLine("", TestUtil.DriverConfig("server")).replace("--", ""))
-
-IceGridAdmin.iceGridTest("", nodeOverrideOptions)
diff --git a/cpp/test/IceGrid/noRestartUpdate/test.py b/cpp/test/IceGrid/noRestartUpdate/test.py
new file mode 100644
index 00000000000..220ca4ef8b3
--- /dev/null
+++ b/cpp/test/IceGrid/noRestartUpdate/test.py
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class IceGridNoRestartUpdateTestCase(IceGridTestCase):
+
+ def setupClientSide(self, current):
+ IceGridTestCase.setupClientSide(self, current)
+ self.mkdirs("db/node1")
+ self.mkdirs("db/node2")
+
+clientProps = lambda process, current: {
+ "IceBinDir" : current.testcase.getMapping().getBinDir(current),
+ "ServerDir" : current.getBuildDir("server"),
+ "ServiceDir" : current.getBuildDir("testservice")
+}
+
+TestSuite(__file__,
+ [IceGridNoRestartUpdateTestCase(application=None, client=IceGridClient(props=clientProps))],
+ multihost=False) \ No newline at end of file
diff --git a/cpp/test/IceGrid/replicaGroup/Client.cpp b/cpp/test/IceGrid/replicaGroup/Client.cpp
index 63bb6395585..5ca10eeb8c4 100644
--- a/cpp/test/IceGrid/replicaGroup/Client.cpp
+++ b/cpp/test/IceGrid/replicaGroup/Client.cpp
@@ -29,7 +29,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/IceGrid/replicaGroup/run.py b/cpp/test/IceGrid/replicaGroup/run.py
deleted file mode 100755
index 69671e7e188..00000000000
--- a/cpp/test/IceGrid/replicaGroup/run.py
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-#
-# Don't use a slave registry for this test. This can lead to race
-# conditions when resolving endpoints of round-robin replica groups if
-# the slave didn't fully load the servers at the time of the client
-# invocation
-#
-IceGridAdmin.nreplicas=0
-
-IceGridAdmin.registryOptions += " --Ice.Plugin.RegistryPlugin=RegistryPlugin:createRegistryPlugin"
-IceGridAdmin.registryOptions += " --IceGrid.Registry.DynamicRegistration"
-
-
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("registryplugin"))])
-TestUtil.addAdditionalBinDirectories([os.path.join(os.getcwd(), TestUtil.getTestDirectory("testservice"))])
-
-IceGridAdmin.iceGridTest("application.xml",
- "--Ice.RetryIntervals=\"0 50 100 250\"", "icebox.exe='%s' server.dir='%s'" % (TestUtil.getIceBox(), TestUtil.getTestDirectory("server")))
diff --git a/cpp/test/IceGrid/replicaGroup/test.py b/cpp/test/IceGrid/replicaGroup/test.py
new file mode 100644
index 00000000000..3ad7fdbbe9b
--- /dev/null
+++ b/cpp/test/IceGrid/replicaGroup/test.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+registryProps = {
+ "Ice.Plugin.RegistryPlugin" : "RegistryPlugin:createRegistryPlugin",
+ "IceGrid.Registry.DynamicRegistration" : 1
+}
+
+clientProps = {
+ "Ice.RetryIntervals" : "0 50 100 250"
+}
+
+TestSuite(__file__,
+ [IceGridTestCase(icegridregistry=[IceGridRegistryMaster(props=registryProps)],
+ client=IceGridClient(props=clientProps))],
+ libDirs=["registryplugin", "testservice"],
+ multihost=False)
diff --git a/cpp/test/IceGrid/replication/Client.cpp b/cpp/test/IceGrid/replication/Client.cpp
index 09723c6d4a4..9fd0d611644 100644
--- a/cpp/test/IceGrid/replication/Client.cpp
+++ b/cpp/test/IceGrid/replication/Client.cpp
@@ -29,7 +29,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/IceGrid/replication/run.py b/cpp/test/IceGrid/replication/run.py
deleted file mode 100755
index bf8a8b4ef91..00000000000
--- a/cpp/test/IceGrid/replication/run.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-TestUtil.addLdPath(os.getcwd())
-
-serverdir = os.path.join(os.getcwd(), TestUtil.getTestDirectory("server"))
-variables = ("properties-override='%s' icegridnode.exe='%s' icegridregistry.exe='%s' server.dir='%s'" %
- (IceGridAdmin.iceGridNodePropertiesOverride(), TestUtil.getIceGridNode(), TestUtil.getIceGridRegistry(), serverdir))
-
-IceGridAdmin.iceGridTest("application.xml", '--IceDir="%s" --ServerDir="%s"' % (TestUtil.toplevel, serverdir),
- variables)
diff --git a/cpp/test/IceGrid/replication/test.py b/cpp/test/IceGrid/replication/test.py
new file mode 100644
index 00000000000..984b83bc069
--- /dev/null
+++ b/cpp/test/IceGrid/replication/test.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+clientProps = lambda process, current: {
+ "IceDir" : toplevel,
+ "ServerDir" : current.getBuildDir("server"),
+}
+
+TestSuite(__file__, [ IceGridTestCase(client=IceGridClient(props=clientProps)) ], runOnMainThread=True, multihost=False) \ No newline at end of file
diff --git a/cpp/test/IceGrid/session/Client.cpp b/cpp/test/IceGrid/session/Client.cpp
index 4105cbaaaf7..bf5487c553b 100644
--- a/cpp/test/IceGrid/session/Client.cpp
+++ b/cpp/test/IceGrid/session/Client.cpp
@@ -27,8 +27,7 @@ main(int argc, char* argv[])
Ice::CommunicatorPtr communicator;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
initData.properties->setProperty("Ice.Warn.Connections", "0");
communicator = Ice::initialize(argc, argv, initData);
communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
diff --git a/cpp/test/IceGrid/session/PermissionsVerifier.cpp b/cpp/test/IceGrid/session/PermissionsVerifier.cpp
index ec8444d7f00..c7c70a34007 100644
--- a/cpp/test/IceGrid/session/PermissionsVerifier.cpp
+++ b/cpp/test/IceGrid/session/PermissionsVerifier.cpp
@@ -11,6 +11,7 @@
#include <Glacier2/PermissionsVerifier.h>
#include <IceSSL/Plugin.h>
#include <Test.h>
+#include <TestCommon.h>
using namespace std;
@@ -25,11 +26,6 @@ public:
{
throw Test::ExtendedPermissionDeniedException("reason");
}
- if(userId == "shutdown")
- {
- c.adapter->getCommunicator()->shutdown();
- return true;
- }
return (userId == "admin1" && passwd == "test1") || (userId == "admin2" && passwd == "test2") ||
(userId == "admin3" && passwd == "test3");
}
@@ -41,8 +37,7 @@ public:
virtual int run(int, char*[])
{
- Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapterWithEndpoints(
- "PermissionsVerifier", "tcp -p 12002");
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("PermissionsVerifier");
adapter->add(new AdminPermissionsVerifierI, Ice::stringToIdentity("AdminPermissionsVerifier"));
adapter->activate();
communicator()->waitForShutdown();
@@ -54,5 +49,7 @@ int
main(int argc, char* argv[])
{
PermissionsVerifierServer app;
- return app.main(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ initData.properties->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
+ return app.main(argc, argv, initData);
}
diff --git a/cpp/test/IceGrid/session/run.py b/cpp/test/IceGrid/session/run.py
deleted file mode 100755
index 0ff6d646f51..00000000000
--- a/cpp/test/IceGrid/session/run.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-if not TestUtil.isWin32() and os.getuid() == 0:
- sys.stdout.write("\n")
- sys.stdout.write("*** can't run test as root ***\n")
- sys.stdout.write("\n")
- sys.exit(0)
-
-name = os.path.join("IceGrid", "session")
-
-node1Dir = os.path.join(os.getcwd(), "db", "node-1")
-if not os.path.exists(node1Dir):
- os.mkdir(node1Dir)
-else:
- IceGridAdmin.cleanDbDir(node1Dir)
-
-print("Running test with default encoding...")
-
-verifier = os.path.join(os.getcwd(), TestUtil.getTestExecutable("verifier"))
-sys.stdout.write("starting admin permissions verifier... ")
-verifierProc = TestUtil.startServer(verifier, config=TestUtil.DriverConfig("server"))
-print("ok")
-
-IceGridAdmin.registryOptions += \
- r' --Ice.Warn.Dispatch=0' + \
- r' --IceGrid.Registry.DynamicRegistration' + \
- r' --IceGrid.Registry.SessionFilters' + \
- r' --IceGrid.Registry.AdminSessionFilters' + \
- r' --IceGrid.Registry.PermissionsVerifier="ClientPermissionsVerifier"' + \
- r' --IceGrid.Registry.AdminPermissionsVerifier="AdminPermissionsVerifier:tcp -p 12002"'+ \
- r' --IceGrid.Registry.SSLPermissionsVerifier="SSLPermissionsVerifier"' + \
- r' --IceGrid.Registry.AdminSSLPermissionsVerifier="SSLPermissionsVerifier"'
-
-bindir = TestUtil.getCppBinDir()
-testdir = os.getcwd()
-serverdir = TestUtil.getTestDirectory("server")
-
-IceGridAdmin.iceGridTest("application.xml",
- '--IceBinDir="%s" --TestDir="%s" --ServerDir="%s"' % (bindir, testdir, serverdir),
- 'properties-override=\'%s\' server.dir="%s"' % (IceGridAdmin.iceGridNodePropertiesOverride(), serverdir))
-
-verifierProc.waitTestSuccess()
-
-print("Running test with 1.0 encoding...")
-
-sys.stdout.write("starting admin permissions verifier... ")
-verifierProc = TestUtil.startServer(verifier, config=TestUtil.DriverConfig("server"))
-print("ok")
-
-IceGridAdmin.iceGridTest("application.xml",
- '--Ice.Default.EncodingVersion=1.0 --IceBinDir="%s" --TestDir="%s" --ServerDir="%s"' % (bindir, testdir, serverdir),
- 'properties-override=\'%s\' server.dir="%s"' % (IceGridAdmin.iceGridNodePropertiesOverride(), serverdir))
-
-verifierProc.waitTestSuccess()
diff --git a/cpp/test/IceGrid/session/test.py b/cpp/test/IceGrid/session/test.py
new file mode 100644
index 00000000000..c720fcf79de
--- /dev/null
+++ b/cpp/test/IceGrid/session/test.py
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class IceGridSessionTestCase(IceGridTestCase):
+
+ def setupClientSide(self, current):
+ IceGridTestCase.setupClientSide(self, current)
+ self.mkdirs("db/node-1")
+
+ def setupServerSide(self, current):
+ self.verifier = Server(exe="verifier", waitForShutdown=False, props={
+ "PermissionsVerifier.Endpoints" : "tcp -p 12002"
+ })
+ current.write("starting permission verifier... ")
+ self.verifier.start(current)
+ current.writeln("ok")
+
+ def teardownServerSide(self, current, success):
+ self.verifier.stop(current, success)
+ self.verifier = None
+
+registryProps = {
+ 'Ice.Warn.Dispatch' : '0',
+ 'IceGrid.Registry.DynamicRegistration' : True,
+ 'IceGrid.Registry.SessionFilters' : True,
+ 'IceGrid.Registry.AdminSessionFilters' : True,
+ 'IceGrid.Registry.PermissionsVerifier' : 'ClientPermissionsVerifier',
+ 'IceGrid.Registry.AdminPermissionsVerifier' : 'AdminPermissionsVerifier:tcp -p 12002',
+ 'IceGrid.Registry.SSLPermissionsVerifier' : 'SSLPermissionsVerifier',
+ 'IceGrid.Registry.AdminSSLPermissionsVerifier' : 'SSLPermissionsVerifier',
+}
+
+clientProps = lambda process, current: {
+ "IceBinDir" : current.testcase.getMapping().getBinDir(current),
+ "ServerDir" : current.getBuildDir("server"),
+ "TestDir" : "{testdir}",
+}
+
+clientProps10 = lambda process, current: {
+ "IceBinDir" : current.testcase.getMapping().getBinDir(current),
+ "ServerDir" : current.getBuildDir("server"),
+ "TestDir" : "{testdir}",
+ "Ice.Default.EncodingVersion" : "1.0"
+}
+
+icegridregistry = [IceGridRegistryMaster(props=registryProps)]
+
+TestSuite(__file__,
+ [ IceGridSessionTestCase("with default encoding", icegridregistry=icegridregistry,
+ client=IceGridClient(props=clientProps)),
+ IceGridSessionTestCase("with 1.0 encoding", icegridregistry=icegridregistry,
+ client=IceGridClient(props=clientProps10))],
+ runOnMainThread=True, multihost=False)
diff --git a/cpp/test/IceGrid/simple/AllTests.cpp b/cpp/test/IceGrid/simple/AllTests.cpp
index 26ba499de28..30a6cda5cd1 100644
--- a/cpp/test/IceGrid/simple/AllTests.cpp
+++ b/cpp/test/IceGrid/simple/AllTests.cpp
@@ -69,13 +69,19 @@ allTests(const Ice::CommunicatorPtr& communicator)
Ice::InitializationData initData;
initData.properties = communicator->getProperties()->clone();
initData.properties->setProperty("Ice.Default.Locator", "");
- initData.properties->setProperty("Ice.Plugin.IceLocatorDiscovery", "IceLocatorDiscovery:createIceLocatorDiscovery");
+ initData.properties->setProperty("Ice.Plugin.IceLocatorDiscovery",
+ "IceLocatorDiscovery:createIceLocatorDiscovery");
#ifdef __APPLE__
if(initData.properties->getPropertyAsInt("Ice.PreferIPv6Address") > 0)
{
initData.properties->setProperty("IceLocatorDiscovery.Interface", "::1");
}
#endif
+ {
+ ostringstream port;
+ port << getTestPort(initData.properties, 99);
+ initData.properties->setProperty("IceLocatorDiscovery.Port", port.str());
+ }
initData.properties->setProperty("AdapterForDiscoveryTest.AdapterId", "discoveryAdapter");
initData.properties->setProperty("AdapterForDiscoveryTest.Endpoints", "default");
diff --git a/cpp/test/IceGrid/simple/Client.cpp b/cpp/test/IceGrid/simple/Client.cpp
index 0ae43f15ffc..a6a2fe738c0 100644
--- a/cpp/test/IceGrid/simple/Client.cpp
+++ b/cpp/test/IceGrid/simple/Client.cpp
@@ -19,7 +19,7 @@ int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
bool withDeploy = false;
-
+
for(int i = 1; i < argc; ++i)
{
if(strcmp(argv[i], "--with-deploy") == 0)
@@ -52,7 +52,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/IceGrid/simple/simple_server.xml b/cpp/test/IceGrid/simple/application.xml
index 28119c79715..28119c79715 100644
--- a/cpp/test/IceGrid/simple/simple_server.xml
+++ b/cpp/test/IceGrid/simple/application.xml
diff --git a/cpp/test/IceGrid/simple/run.py b/cpp/test/IceGrid/simple/run.py
deleted file mode 100755
index 9116ada5dad..00000000000
--- a/cpp/test/IceGrid/simple/run.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-# Test IceGrid discovery with multiple replicas
-IceGridAdmin.nreplicas=2
-
-testdir = os.path.join(os.getcwd(),)
-#
-# Test client/server without on demand activation.
-#
-IceGridAdmin.iceGridClientServerTest("", "--TestAdapter.Endpoints=default --TestAdapter.AdapterId=TestAdapter")
-
-#
-# Test client/server with on demand activation.
-#
-IceGridAdmin.iceGridTest("simple_server.xml", "--with-deploy",
- "server.dir='%s'" % TestUtil.getTestDirectory("server"))
diff --git a/cpp/test/IceGrid/update/Client.cpp b/cpp/test/IceGrid/update/Client.cpp
index 9ae4d662dad..f5cbbb67e8f 100644
--- a/cpp/test/IceGrid/update/Client.cpp
+++ b/cpp/test/IceGrid/update/Client.cpp
@@ -27,8 +27,9 @@ main(int argc, char* argv[])
int status;
Ice::CommunicatorPtr communicator;
try
- {
- communicator = Ice::initialize(argc, argv);
+ {
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
communicator->getProperties()->parseCommandLineOptions("", Ice::argsToStringSeq(argc, argv));
status = run(argc, argv, communicator);
}
diff --git a/cpp/test/IceGrid/update/run.py b/cpp/test/IceGrid/update/run.py
deleted file mode 100755
index 79f5e8ca202..00000000000
--- a/cpp/test/IceGrid/update/run.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceGridAdmin
-
-name = os.path.join("IceGrid", "update")
-
-node1Dir = os.path.join(os.getcwd(), "db", "node-1")
-if not os.path.exists(node1Dir):
- os.mkdir(node1Dir)
-else:
- IceGridAdmin.cleanDbDir(node1Dir)
-
-node2Dir = os.path.join(os.getcwd(), "db", "node-2")
-if not os.path.exists(node2Dir):
- os.mkdir(node2Dir)
-else:
- IceGridAdmin.cleanDbDir(node2Dir)
-
-bindir = TestUtil.getCppBinDir()
-testdir = os.getcwd()
-serverdir = os.path.join(os.getcwd(), TestUtil.getTestDirectory("server"))
-
-nodeOverrideOptions = '--IceBinDir="%s" --TestDir="%s" --ServerDir="%s" ' % (bindir, testdir, serverdir) + \
- '--NodePropertiesOverride=\"%s Ice.ServerIdleTime=0 Ice.PrintProcessId=0 Ice.PrintAdapterReady=0\"' % \
- IceGridAdmin.iceGridNodePropertiesOverride()
-
-IceGridAdmin.iceGridTest("", nodeOverrideOptions)
diff --git a/cpp/test/IceGrid/update/test.py b/cpp/test/IceGrid/update/test.py
new file mode 100644
index 00000000000..3decb0431e9
--- /dev/null
+++ b/cpp/test/IceGrid/update/test.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class IceGridUpdateTestCase(IceGridTestCase):
+
+ def setupClientSide(self, current):
+ IceGridTestCase.setupClientSide(self, current)
+ self.mkdirs("db/node-1")
+ self.mkdirs("db/node-2")
+
+clientProps = lambda process, current: {
+ "NodePropertiesOverride" : current.testcase.icegridnode[0].getPropertiesOverride(current),
+ "IceBinDir" : current.testcase.getMapping().getBinDir(current),
+ "ServerDir" : current.getBuildDir("server"),
+ "TestDir" : "{testdir}"
+}
+
+TestSuite(__file__, [IceGridUpdateTestCase(application=None, client=IceGridClient(props=clientProps))], multihost=False) \ No newline at end of file
diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp
index 24047abfabf..d8cf659450f 100644
--- a/cpp/test/IceSSL/configuration/AllTests.cpp
+++ b/cpp/test/IceSSL/configuration/AllTests.cpp
@@ -699,7 +699,7 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12)
elCapitanUpdate2OrLower = (majorVersion == 15) && (minorVersion <= 2);
}
#endif
- string factoryRef = "factory:tcp -p 12010";
+ string factoryRef = "factory:" + getTestEndpoint(communicator, 0);
ObjectPrxPtr base = communicator->stringToProxy(factoryRef);
test(base);
Test::ServerFactoryPrxPtr factory = ICE_CHECKED_CAST(Test::ServerFactoryPrx, base);
diff --git a/cpp/test/IceSSL/configuration/Client.cpp b/cpp/test/IceSSL/configuration/Client.cpp
index 44acba98ffb..fb42ae4efe0 100644
--- a/cpp/test/IceSSL/configuration/Client.cpp
+++ b/cpp/test/IceSSL/configuration/Client.cpp
@@ -71,7 +71,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/IceSSL/configuration/Server.cpp b/cpp/test/IceSSL/configuration/Server.cpp
index 44c76dc5cb5..07a6fb6acd0 100644
--- a/cpp/test/IceSSL/configuration/Server.cpp
+++ b/cpp/test/IceSSL/configuration/Server.cpp
@@ -18,7 +18,7 @@ using namespace std;
int
run(int, char**, const Ice::CommunicatorPtr& communicator)
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "tcp -p 12010");
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint(communicator, 0));
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
Ice::Identity id = Ice::stringToIdentity("factory");
adapter->add(ICE_MAKE_SHARED(ServerFactoryI), id);
@@ -36,7 +36,8 @@ main(int argc, char* argv[])
try
{
- communicator = Ice::initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
diff --git a/cpp/test/IceSSL/configuration/run.py b/cpp/test/IceSSL/configuration/run.py
deleted file mode 100755
index 8edf98af0f8..00000000000
--- a/cpp/test/IceSSL/configuration/run.py
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, atexit, re
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-# Filter-out the deprecated property warnings
-TestUtil.clientTraceFilters = [ lambda x: re.sub("-! .* warning: deprecated property: IceSSL.KeyFile\n", "", x) ]
-TestUtil.serverTraceFilters = [ lambda x: re.sub("-! .* warning: deprecated property: IceSSL.KeyFile\n", "", x) ]
-
-certsPath = os.path.abspath(os.path.join(os.getcwd(), "..", "certs"))
-keychainPath = os.path.abspath(os.path.join(certsPath, "Find.keychain"))
-
-def cleanup():
- if TestUtil.isDarwin():
- os.system("rm -rf %s ../certs/keychain" % keychainPath)
- elif TestUtil.isLinux():
- for c in ["cacert1.pem", "cacert2.pem"]:
- pem = os.path.join(certsPath, c)
- os.system("rm -f {dir}/`openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath))
-
-cleanup()
-atexit.register(cleanup)
-
-if TestUtil.isDarwin():
- os.system("mkdir -p ../certs/keychain")
- os.system("security create-keychain -p password %s" % keychainPath)
- for cert in ["s_rsa_ca1.p12", "c_rsa_ca1.p12"]:
- os.system("security import %s -f pkcs12 -A -P password -k %s" % (os.path.join(certsPath, cert), keychainPath))
-elif TestUtil.iceUseOpenSSL():
- #
- # Create copies of the CA certificates named after the subject
- # hash. This is used by the tests to find the CA certificates in
- # the IceSSL.DefaultDir
- #
- for c in ["cacert1.pem", "cacert2.pem"]:
- pem = os.path.join(certsPath, c)
- os.system("cp {pem} {dir}/`openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath))
-
-TestUtil.clientServerTest(additionalClientOptions = '"%s"' % os.getcwd())
diff --git a/cpp/test/IceStorm/federation/0.db/.gitignore b/cpp/test/IceStorm/federation/0.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/federation/0.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/federation/1.db/.gitignore b/cpp/test/IceStorm/federation/1.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/federation/1.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/federation/2.db/.gitignore b/cpp/test/IceStorm/federation/2.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/federation/2.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/federation/Publisher.cpp b/cpp/test/IceStorm/federation/Publisher.cpp
index 4cee72d4da7..befcf51b8dc 100644
--- a/cpp/test/IceStorm/federation/Publisher.cpp
+++ b/cpp/test/IceStorm/federation/Publisher.cpp
@@ -9,6 +9,7 @@
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
+#include <TestCommon.h>
#include <Event.h>
using namespace std;
@@ -45,7 +46,7 @@ run(int, char* argv[], const CommunicatorPtr& communicator)
{
cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
return EXIT_FAILURE;
-
+
}
TopicPrx fed2;
@@ -57,7 +58,7 @@ run(int, char* argv[], const CommunicatorPtr& communicator)
{
cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
return EXIT_FAILURE;
-
+
}
TopicPrx fed3;
@@ -69,7 +70,7 @@ run(int, char* argv[], const CommunicatorPtr& communicator)
{
cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
return EXIT_FAILURE;
-
+
}
EventPrx eventFed1 = EventPrx::uncheckedCast(fed1->getPublisher()->ice_oneway());
@@ -131,10 +132,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/federation/Subscriber.cpp b/cpp/test/IceStorm/federation/Subscriber.cpp
index f99a0722437..20ef6c29bc8 100644
--- a/cpp/test/IceStorm/federation/Subscriber.cpp
+++ b/cpp/test/IceStorm/federation/Subscriber.cpp
@@ -196,10 +196,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/federation/run.py b/cpp/test/IceStorm/federation/run.py
deleted file mode 100755
index 0681ac656db..00000000000
--- a/cpp/test/IceStorm/federation/run.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-import time
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceStormUtil
-
-publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher"))
-subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber"))
-
-targets = []
-if TestUtil.appverifier:
- targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), TestUtil.getIceStormAdmin()]
- TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd())
-
-def doTest(icestorm, batch):
-
- if batch:
- name = "batch subscriber"
- batchOptions = " -b"
- else:
- name = "subscriber"
- batchOptions = ""
-
- subscriberProc = TestUtil.startServer(subscriber, batchOptions + icestorm.reference())
-
- #
- # Start the publisher. This should publish events which eventually
- # causes subscriber to terminate.
- #
- publisherProc = TestUtil.startClient(publisher, icestorm.reference())
- subscriberProc.waitTestSuccess()
- publisherProc.waitTestSuccess()
-
-def runtest(type, **args):
- icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, **args)
-
- icestorm.start()
-
- sys.stdout.write("setting up topics... ")
- sys.stdout.flush()
- icestorm.admin("create fed1 fed2 fed3; link fed1 fed2 10; link fed2 fed3 5")
- print("ok")
-
- #
- # Test oneway subscribers.
- #
- sys.stdout.write("testing oneway subscribers... ")
- sys.stdout.flush()
- doTest(icestorm, 0)
- print("ok")
-
- #
- # Test batch oneway subscribers.
- #
- sys.stdout.write("testing batch subscribers... ")
- sys.stdout.flush()
- doTest(icestorm, 1)
- print("ok")
-
- #
- # Destroy the topics.
- #
- sys.stdout.write("destroying topics... ")
- sys.stdout.flush()
- icestorm.admin("destroy fed1 fed2 fed3")
- print("ok")
-
- #
- # Shutdown icestorm.
- #
- icestorm.stop()
-
-runtest("persistent")
-runtest("transient")
-runtest("replicated", replicatedPublisher = False)
-runtest("replicated", replicatedPublisher = True)
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd())
diff --git a/cpp/test/IceStorm/federation/test.py b/cpp/test/IceStorm/federation/test.py
new file mode 100644
index 00000000000..e38f8d25a8c
--- /dev/null
+++ b/cpp/test/IceStorm/federation/test.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+class IceStormFederationTestCase(IceStormTestCase):
+
+ def setupClientSide(self, current):
+ self.runadmin(current, "create fed1 fed2 fed3; link fed1 fed2 10; link fed2 fed3 5")
+
+ def runClientSide(self, current):
+ current.write("testing oneway subscribers...")
+ ClientServerTestCase(client=Publisher(), server=Subscriber()).run(current)
+ current.writeln("ok")
+
+ current.write("testing batch subscribers...")
+ ClientServerTestCase(client=Publisher(), server=Subscriber(args=["-b"])).run(current)
+ current.writeln("ok")
+
+ def teardownClientSide(self, current, success):
+ self.runadmin(current, "destroy fed1 fed2 fed3")
+ self.shutdown(current)
+
+# Override ReplicatedPublishEndpoints property to empty for testing without replicated publisher
+props = {'IceStorm.ReplicatedPublishEndpoints' : ''}
+
+TestSuite(__file__, [
+ IceStormFederationTestCase("persistent", icestorm=IceStorm()),
+ IceStormFederationTestCase("transient", icestorm=IceStorm(transient=True)),
+ IceStormFederationTestCase("replicated with non-replicated publisher",
+ icestorm=[IceStorm(replica=i, nreplicas=3, props=props) for i in range(0,3)]),
+ IceStormFederationTestCase("replicated with replicated publisher",
+ icestorm=[IceStorm(replica=i, nreplicas=3) for i in range(0,3)]),
+], multihost=False)
diff --git a/cpp/test/IceStorm/federation2/0.db/.gitignore b/cpp/test/IceStorm/federation2/0.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/federation2/0.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/federation2/Publisher.cpp b/cpp/test/IceStorm/federation2/Publisher.cpp
index 8daf34a8297..c07f3df88c5 100644
--- a/cpp/test/IceStorm/federation2/Publisher.cpp
+++ b/cpp/test/IceStorm/federation2/Publisher.cpp
@@ -12,6 +12,7 @@
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
#include <Event.h>
+#include <TestCommon.h>
using namespace std;
using namespace Ice;
@@ -60,7 +61,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
return EXIT_FAILURE;
-
+
}
EventPrx eventFed1 = EventPrx::uncheckedCast(fed1->getPublisher()->ice_oneway());
@@ -71,7 +72,7 @@ run(int argc, char* argv[], const CommunicatorPtr& communicator)
{
count = atoi(arg.c_str());
}
-
+
while(true)
{
for(int i = 0; i < 10; ++i)
@@ -100,10 +101,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/federation2/Subscriber.cpp b/cpp/test/IceStorm/federation2/Subscriber.cpp
index 28e006f7bf9..6bce9c9d84d 100644
--- a/cpp/test/IceStorm/federation2/Subscriber.cpp
+++ b/cpp/test/IceStorm/federation2/Subscriber.cpp
@@ -189,10 +189,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/federation2/run.py b/cpp/test/IceStorm/federation2/run.py
deleted file mode 100755
index f479c7b411c..00000000000
--- a/cpp/test/IceStorm/federation2/run.py
+++ /dev/null
@@ -1,275 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, time, threading, re
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceStormUtil, Expect
-
-iceStormAdmin = os.path.join(TestUtil.getCppBinDir(), "icestormadmin")
-
-publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher"))
-subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber"))
-
-targets = []
-if TestUtil.appverifier:
- targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), TestUtil.getIceStormAdmin()]
- TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd())
-
-def admin(ref, command):
- proc = TestUtil.startClient(iceStormAdmin, ref + ' -e "%s"' % command, echo = False)
- proc.waitTestSuccess()
- return proc.buf
-
-def runPublisher(icestorm1, opt = ""):
- proc = TestUtil.startClient(publisher, opt + icestorm1.reference())
- proc.waitTestSuccess()
-
-def doTest(icestorm1, icestorm2, batch, subscriberRef = None):
- if batch:
- name = "batch subscriber"
- batchOptions = " -b"
- else:
- name = "subscriber"
- batchOptions = ""
-
- if subscriberRef == None:
- subscriberRef = icestorm2.reference()
-
- subscriberProc = TestUtil.startServer(subscriber, batchOptions + subscriberRef)
-
- #
- # Start the publisher. This should publish events which eventually
- # causes subscriber to terminate.
- #
- runPublisher(icestorm1)
-
- subscriberProc.waitTestSuccess()
-
-#
-# Test #1:
-#
-# create a cross service link fed1->fed2 and ensure the events are
-# published between them correctly.
-#
-def runtest(type, **args):
- icestorm1 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, additional = '--IceStorm.Discard.Interval=2',
- dbDir = "db", instanceName = "TestIceStorm1", port = 12000, **args)
- icestorm1.start()
- icestorm2 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, additional = '--IceStorm.Discard.Interval=2',
- dbDir = "db2", instanceName = "TestIceStorm2", port = 12500, **args)
- icestorm2.start()
-
- adminIceStormReference = ' --IceStormAdmin.TopicManager.Proxy="%s" --IceStormAdmin.TopicManager.Proxy2="%s"' % (
- icestorm1.proxy(), icestorm2.proxy())
-
- sys.stdout.write("setting up the topics... ")
- sys.stdout.flush()
- admin(adminIceStormReference, "create TestIceStorm1/fed1 TestIceStorm2/fed1; link TestIceStorm1/fed1 TestIceStorm2/fed1")
- print("ok")
-
- #
- # Test oneway subscribers.
- #
- sys.stdout.write("testing federation with oneway subscribers... ")
- sys.stdout.flush()
- doTest(icestorm1, icestorm2, 0)
- print("ok")
-
- #
- # Test batch oneway subscribers.
- #
- sys.stdout.write("testing federation with batch subscribers... ")
- sys.stdout.flush()
- doTest(icestorm1, icestorm2, 1)
- print("ok")
-
- #
- # Test #2:
- #
- # Stop and restart the service and repeat the test. This ensures that
- # the database is correct.
- #
- sys.stdout.write("restarting services to ensure that the database content is preserved... ")
- sys.stdout.flush()
-
- #
- # Shutdown icestorm.
- #
- icestorm1.stop()
- icestorm2.stop()
-
- icestorm1.start(echo=False)
- icestorm2.start(echo=False)
- print("ok")
-
- #
- # Test oneway subscribers.
- #
- sys.stdout.write("retesting federation with oneway subscribers... ")
- sys.stdout.flush()
- doTest(icestorm1, icestorm2, 0)
- print("ok")
-
- #
- # Test batch oneway subscribers.
- #
- sys.stdout.write("retesting federation with batch subscribers... ")
- sys.stdout.flush()
- doTest(icestorm1, icestorm2, 1)
- print("ok")
-
- #
- # Shutdown icestorm.
- #
- icestorm1.stop()
- icestorm2.stop()
-
- #
- # Restart the first server and publish some events. Attach a
- # subscriber to the channel and make sure the events are received.
- #
- # Then re-start the linked downstream server and publish the events.
- # Ensure they are received by the linked server.
- #
- if type != "replicated":
- sys.stdout.write("restarting only one IceStorm server... ")
- sys.stdout.flush()
- proc = icestorm1.start(echo=False)
-
- #proc.expect("topic.fed1.*subscriber offline")
- #proc.expect("connection refused")
- print("ok")
-
- #
- # Test oneway subscribers.
- #
- sys.stdout.write("testing that the federation link reports an error... ")
- sys.stdout.flush()
- doTest(icestorm1, icestorm2, 0, icestorm1.reference())
-
- # Give some time for the output to be sent.
- time.sleep(2)
-
- proc.expect("topic.fed1.*subscriber offline")
- print("ok")
-
- sys.stdout.write("starting downstream icestorm server... ")
- sys.stdout.flush()
- icestorm2.start(echo=False)
- print("ok")
-
- #
- # Need to sleep for at least the discard interval.
- #
- time.sleep(3)
-
- #
- # Test oneway subscribers.
- #
- sys.stdout.write("testing link is reestablished... ")
- sys.stdout.flush()
- doTest(icestorm1, icestorm2, 0)
- print("ok")
-
- try:
- proc.expect("topic.fed1.*subscriber offline")
- assert False
- except Expect.TIMEOUT:
- pass
-
- icestorm1.stop()
- icestorm2.stop()
-
- #
- # Test #4:
- #
- # Trash the TestIceStorm2 database. Then restart the servers and
- # verify that the link is removed.
- #
- sys.stdout.write("destroying the downstream IceStorm service database... ")
- sys.stdout.flush()
- icestorm2.clean()
-
- print("ok")
-
- sys.stdout.write("restarting IceStorm servers... ")
- sys.stdout.flush()
- icestorm1.start(echo = False)
- icestorm2.start(echo = False)
- print("ok")
-
- sys.stdout.write("checking link still exists... ")
- sys.stdout.flush()
- line = admin(adminIceStormReference, "links TestIceStorm1")
- if not re.compile("fed1 with cost 0").search(line):
- print(line)
- sys.exit(1)
- print("ok")
-
- sys.stdout.write("publishing some events... ")
- sys.stdout.flush()
- # The publisher must be run twice because all the events can be
- # sent out in one batch to the linked subscriber which means that
- # the link is not reaped until the next batch is
- # sent. Furthermore, with a replicated IceStorm both sets of
- # events must be set to the same replica.
- runPublisher(icestorm1, opt = " --count 2")
- print("ok")
-
- # Give the unsubscription time to propagate.
- time.sleep(1)
-
- # Verify that the link has disappeared.
- sys.stdout.write("verifying that the link has been destroyed... ")
- sys.stdout.flush()
- line = admin(adminIceStormReference, "links TestIceStorm1")
- nRetry = 5
- while len(line) > 0 and nRetry > 0:
- line = admin(adminIceStormReference, "links TestIceStorm1")
- time.sleep(1) # Give more time for unsubscription to propagate.
- nRetry -= 1
- if len(line) > 0:
- print(line)
- sys.exit(1)
- print("ok")
-
- #
- # Destroy the remaining topic.
- #
- sys.stdout.write("destroying topics... ")
- sys.stdout.flush()
- admin(adminIceStormReference, "destroy TestIceStorm1/fed1")
- print("ok")
-
- #
- # Shutdown icestorm.
- #
- sys.stdout.write("shutting down icestorm services... ")
- sys.stdout.flush()
- icestorm1.stop()
- icestorm2.stop()
- print("ok")
-
-runtest("persistent")
-runtest("replicated", replicatedPublisher = False)
-runtest("replicated", replicatedPublisher = True)
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd())
-
-sys.exit(0)
diff --git a/cpp/test/IceStorm/federation2/test.py b/cpp/test/IceStorm/federation2/test.py
new file mode 100644
index 00000000000..5ac2f315555
--- /dev/null
+++ b/cpp/test/IceStorm/federation2/test.py
@@ -0,0 +1,196 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# Publisher/subscriber test cases, publisher publishes on TestIceStorm1 instance(s) and
+# the subscriber subscribes to the TestIceStorm2 instance(s)
+#
+pub1Sub2Oneway=ClientServerTestCase(client=Publisher("TestIceStorm1"), server=Subscriber("TestIceStorm2"))
+pub1Sub2Batch=ClientServerTestCase(client=Publisher("TestIceStorm1"), server=Subscriber("TestIceStorm2", args=["-b"]))
+
+pub1Sub1Oneway=ClientServerTestCase(client=Publisher("TestIceStorm1"), server=Subscriber("TestIceStorm1"))
+
+class IceStormFederation2TestCase(IceStormTestCase):
+
+ def runClientSide(self, current):
+
+ current.write("setting up the topics... ")
+ self.runadmin(current, "create TestIceStorm1/fed1 TestIceStorm2/fed1; link TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.writeln("ok")
+
+ #
+ # Test oneway subscribers.
+ #
+ current.write("testing federation with oneway subscribers... ")
+ pub1Sub2Oneway.run(current)
+ current.writeln("ok")
+
+ #
+ # Test batch oneway subscribers.
+ #
+ current.write("testing federation with batch subscribers... ")
+ pub1Sub2Batch.run(current)
+ current.writeln("ok")
+
+ #
+ # Test #2:
+ #
+ # Stop and restart the service and repeat the test. This ensures that
+ # the database is correct.
+ #
+ current.write("restarting services to ensure that the database content is preserved... ")
+ self.restartIceStorm(current)
+ current.writeln("ok")
+
+ #
+ # Test oneway subscribers.
+ #
+ current.write("retesting federation with oneway subscribers... ")
+ pub1Sub2Oneway.run(current)
+ current.writeln("ok")
+
+ #
+ # Test batch oneway subscribers.
+ #
+ current.write("retesting federation with batch subscribers... ")
+ pub1Sub2Batch.run(current)
+ current.writeln("ok")
+
+ #
+ # Shutdown icestorm.
+ #
+ self.stopIceStorm(current)
+
+ icestorm1 = [icestorm for icestorm in self.icestorm if icestorm.getInstanceName() == "TestIceStorm1"]
+ icestorm2 = [icestorm for icestorm in self.icestorm if icestorm.getInstanceName() == "TestIceStorm2"]
+
+ #
+ # Restart the first server and publish some events. Attach a
+ # subscriber to the channel and make sure the events are received.
+ #
+ # Then re-start the linked downstream server and publish the events.
+ # Ensure they are received by the linked server.
+ #
+ if self.getName().find("replicated") == -1:
+
+ current.write("restarting only one IceStorm server... ")
+ icestorm1[0].start(current)
+ current.writeln("ok")
+
+ #
+ # Test oneway subscribers.
+ #
+ current.write("testing that the federation link reports an error... ")
+ pub1Sub1Oneway.run(current)
+
+ # Give some time for the output to be sent.
+ time.sleep(2)
+
+ icestorm1[0].expect("topic.fed1.*subscriber offline")
+ current.writeln("ok")
+
+ current.write("starting downstream icestorm server... ")
+ icestorm2[0].start(current)
+ current.writeln("ok")
+
+ #
+ # Need to sleep for at least the discard interval.
+ #
+ time.sleep(3)
+
+ #
+ # Test oneway subscribers.
+ #
+ current.write("testing link is reestablished... ")
+ pub1Sub2Oneway.run(current)
+ current.writeln("ok")
+
+ try:
+ icestorm1[0].expect("topic.fed1.*subscriber offline", timeout=1)
+ assert False
+ except Expect.TIMEOUT:
+ pass
+
+ self.stopIceStorm(current)
+
+ #
+ # Test #4:
+ #
+ # Trash the TestIceStorm2 database. Then restart the servers and
+ # verify that the link is removed.
+ #
+ current.write("destroying the downstream IceStorm service database... ")
+ for s in icestorm2:
+ s.teardown(current, True)
+ s.setup(current)
+
+ current.writeln("ok")
+
+ current.write("restarting IceStorm servers... ")
+ self.startIceStorm(current)
+ current.writeln("ok")
+
+ current.write("checking link still exists... ")
+ line = self.runadmin(current, "links TestIceStorm1", quiet=True)
+ if not re.compile("fed1 with cost 0").search(line):
+ raise RuntimeError("unexpected output (`{0}')".format(line))
+ current.writeln("ok")
+
+ current.write("publishing some events... ")
+ # The publisher must be run twice because all the events can be
+ # sent out in one batch to the linked subscriber which means that
+ # the link is not reaped until the next batch is
+ # sent. Furthermore, with a replicated IceStorm both sets of
+ # events must be set to the same replica.
+ Publisher("TestIceStorm1", args=["--count", 2]).run(current)
+ current.writeln("ok")
+
+ # Give the unsubscription time to propagate.
+ time.sleep(1)
+
+ # Verify that the link has disappeared.
+ current.write("verifying that the link has been destroyed... ")
+ line = self.runadmin(current, "links TestIceStorm1")
+ nRetry = 5
+ while len(line) > 0 and nRetry > 0:
+ line = self.runadmin(current, "links TestIceStorm1")
+ time.sleep(1) # Give more time for unsubscription to propagate.
+ nRetry -= 1
+ if len(line) > 0:
+ raise RuntimeError("unexpected output (`{0}')".format(line))
+ current.writeln("ok")
+
+ #
+ # Destroy the remaining topic.
+ #
+ current.write("destroying topics... ")
+ self.runadmin(current, "destroy TestIceStorm1/fed1links TestIceStorm1", quiet=True)
+ current.writeln("ok")
+
+ self.stopIceStorm(current)
+
+# Override ReplicatedPublishEndpoints property to empty for testing without replicated publisher
+props = { 'IceStorm.Discard.Interval' : 2 }
+nonRepProps = { 'IceStorm.Discard.Interval' : 2, 'IceStorm.ReplicatedPublishEndpoints' : '' }
+
+TestSuite(__file__, [
+
+ IceStormFederation2TestCase("persistent", icestorm=
+ [IceStorm("TestIceStorm1", quiet=True, props=props),
+ IceStorm("TestIceStorm2", quiet=True,portnum=20, props=props)]),
+
+ IceStormFederation2TestCase("replicated with non-replicated publisher", icestorm=
+ [IceStorm("TestIceStorm1", i, 3, quiet=True, props=nonRepProps) for i in range(0,3)] +
+ [IceStorm("TestIceStorm2", i, 3, quiet=True, portnum=20, props=nonRepProps) for i in range(0,3)]),
+
+ IceStormFederation2TestCase("replicated with replicated publisher", icestorm=
+ [IceStorm("TestIceStorm1", i, 3, quiet=True, props=props) for i in range(0,3)] +
+ [IceStorm("TestIceStorm2", i, 3, quiet=True, portnum=20, props=props) for i in range(0,3)]),
+], multihost=False)
diff --git a/cpp/test/IceStorm/rep1/Publisher.cpp b/cpp/test/IceStorm/rep1/Publisher.cpp
index a06662e4b29..b90f8f7300a 100644
--- a/cpp/test/IceStorm/rep1/Publisher.cpp
+++ b/cpp/test/IceStorm/rep1/Publisher.cpp
@@ -11,6 +11,7 @@
#include <IceUtil/Options.h>
#include <IceUtil/IceUtil.h>
#include <IceStorm/IceStorm.h>
+#include <TestCommon.h>
#include <Single.h>
using namespace std;
@@ -120,10 +121,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/rep1/Sub.cpp b/cpp/test/IceStorm/rep1/Sub.cpp
index 5192f61e548..55423322069 100644
--- a/cpp/test/IceStorm/rep1/Sub.cpp
+++ b/cpp/test/IceStorm/rep1/Sub.cpp
@@ -94,10 +94,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/rep1/Subscriber.cpp b/cpp/test/IceStorm/rep1/Subscriber.cpp
index fe23907529f..be1b8e0e36c 100644
--- a/cpp/test/IceStorm/rep1/Subscriber.cpp
+++ b/cpp/test/IceStorm/rep1/Subscriber.cpp
@@ -186,10 +186,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/rep1/run.py b/cpp/test/IceStorm/rep1/run.py
deleted file mode 100755
index 2d058a12d22..00000000000
--- a/cpp/test/IceStorm/rep1/run.py
+++ /dev/null
@@ -1,292 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, time, re
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceStormUtil
-
-publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher"))
-subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber"))
-subscriber2 = os.path.join(os.getcwd(), TestUtil.getTestExecutable("sub"))
-
-targets = []
-if TestUtil.appverifier:
- targets = [TestUtil.getIceBox(), publisher, subscriber, subscriber2, TestUtil.getIceBoxAdmin(), \
- TestUtil.getIceStormAdmin()]
- TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd())
-
-def runsub(opt, ref, arg = "", echo=False):
- qos = ""
- if opt == "twoway":
- qos = " --twoway"
- if opt == "ordered":
- qos = " --ordered"
- return TestUtil.startServer(subscriber, ref + arg + qos)
-
-def runpub(ref, arg = "", echo=False):
- return TestUtil.startClient(publisher, ref + arg)
-
-def runtest(opt, ref, subopt="", pubopt=""):
- subscriberProc = runsub(opt, ref, subopt)
- publisherProc = runpub(ref, pubopt)
- publisherProc.waitTestSuccess()
- subscriberProc.waitTestSuccess()
-
-def runsub2(replica = -1, expect = None):
- proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo', count=0, echo = False)
- if expect:
- proc.expect(expect)
- proc.wait()
- else:
- proc.waitTestSuccess()
-
-def rununsub2(replica = -1, expect = None):
- if replica == -1:
- proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo --unsub', count=0)
- proc.waitTestSuccess()
- # Else we first subscribe to this replica, then unsub. We
- # shouldn't get an AlreadySubscribedException.
- proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo', count=0, echo = False)
- if expect:
- proc.expect(expect)
- proc.wait()
- return
- else:
- proc.waitTestSuccess()
- proc = TestUtil.startServer(subscriber2, icestorm.reference(replica) + ' --id foo --unsub', count=0)
- proc.waitTestSuccess()
-
-icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), "replicated", replicatedPublisher=True, additional =
- ' --IceStorm.Election.MasterTimeout=2' +
- ' --IceStorm.Election.ElectionTimeout=2' +
- ' --IceStorm.Election.ResponseTimeout=2')
-icestorm.start()
-
-sys.stdout.write("testing topic creation across replicas... ")
-sys.stdout.flush()
-icestorm.admin("create single")
-
-for replica in range(0, 3):
- icestorm.adminForReplica(replica, "create single", "error: topic `single' exists")
-print("ok")
-
-sys.stdout.write("testing topic destruction across replicas... ")
-sys.stdout.flush()
-icestorm.admin("destroy single")
-
-for replica in range(0, 3):
- icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'")
-print("ok")
-
-sys.stdout.write("testing topic creation without replica... ")
-sys.stdout.flush()
-
-icestorm.stopReplica(0)
-icestorm.admin("create single")
-
-for replica in range(1, 3):
- icestorm.adminForReplica(replica, "create single", "error: topic `single' exists")
-
-icestorm.adminForReplica(0, "create single", ["ConnectionRefused", "ConnectFailed"])
-
-icestorm.startReplica(0, echo=False)
-
-icestorm.adminForReplica(0, "create single", "error: topic `single' exists")
-print("ok")
-
-icestorm.admin("destroy single")
-
-sys.stdout.write("testing topic creation without master... ")
-sys.stdout.flush()
-icestorm.stopReplica(2)
-
-icestorm.admin("create single")
-
-for replica in range(0, 2):
- icestorm.adminForReplica(replica, "create single", "error: topic `single' exists")
-
-icestorm.adminForReplica(2, "create single", ["ConnectionRefused", "ConnectFailed"])
-
-icestorm.startReplica(2, echo=False)
-
-icestorm.adminForReplica(2, "create single", "error: topic `single' exists")
-print("ok")
-
-# All replicas are running
-
-sys.stdout.write("testing topic destruction without replica... ")
-sys.stdout.flush()
-icestorm.stopReplica(0)
-
-icestorm.admin("destroy single")
-
-for replica in range(1, 3):
- icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'")
-
-icestorm.adminForReplica(0, "destroy single", ["ConnectionRefused", "ConnectFailed"])
-
-icestorm.startReplica(0, echo=False)
-
-icestorm.adminForReplica(0, "destroy single", "error: couldn't find topic `single'")
-print("ok")
-
-sys.stdout.write("testing topic destruction without master... ")
-sys.stdout.flush()
-
-icestorm.admin("create single")
-icestorm.stopReplica(2)
-
-icestorm.admin("destroy single")
-
-for replica in range(0, 2):
- icestorm.adminForReplica(replica, "destroy single", "error: couldn't find topic `single'")
-
-icestorm.adminForReplica(2, "destroy single", ["ConnectionRefused", "ConnectFailed"])
-
-icestorm.startReplica(2, echo=False)
-
-icestorm.adminForReplica(2, "destroy single", "error: couldn't find topic `single'")
-print("ok")
-
-# Now test subscription/unsubscription on all replicas.
-
-icestorm.admin("create single")
-
-sys.stdout.write("testing subscription across replicas... ")
-sys.stdout.flush()
-runsub2()
-
-for replica in range(0, 3):
- runsub2(replica, "IceStorm::AlreadySubscribed")
-print("ok")
-
-sys.stdout.write("testing unsubscription across replicas... ")
-sys.stdout.flush()
-rununsub2()
-
-for replica in range(0, 3):
- rununsub2(replica)
-print("ok")
-
-sys.stdout.write("testing subscription without master... ")
-sys.stdout.flush()
-icestorm.stopReplica(2)
-
-runsub2()
-
-for replica in range(0, 2):
- runsub2(replica, "IceStorm::AlreadySubscribed")
-
-runsub2(2, ["ConnectionRefused", "ConnectFailed"])
-
-icestorm.startReplica(2, echo=False)
-
-runsub2(2, "IceStorm::AlreadySubscribed")
-print("ok")
-
-sys.stdout.write("testing unsubscription without master... ")
-sys.stdout.flush()
-icestorm.stopReplica(2)
-
-rununsub2()
-
-for replica in range(0, 2):
- rununsub2(replica)
-
-rununsub2(2, ["ConnectionRefused", "ConnectFailed"])
-
-icestorm.startReplica(2, echo=False)
-
-rununsub2(2)
-print("ok")
-
-sys.stdout.write("testing subscription without replica... ")
-sys.stdout.flush()
-icestorm.stopReplica(0)
-
-runsub2()
-
-for replica in range(1, 3):
- runsub2(replica, "IceStorm::AlreadySubscribed")
-
-runsub2(0, ["ConnectionRefused", "ConnectFailed"])
-
-icestorm.startReplica(0, echo=False)
-
-runsub2(0, "IceStorm::AlreadySubscribed")
-print("ok")
-
-sys.stdout.write("testing unsubscription without replica... ")
-sys.stdout.flush()
-icestorm.stopReplica(0)
-
-rununsub2()
-
-for replica in range(1, 3):
- rununsub2(replica)
-
-rununsub2(0, ["ConnectionRefused", "ConnectFailed"])
-
-icestorm.startReplica(0, echo=False)
-
-rununsub2(0)
-print("ok")
-
-# All replicas are running
-
-sys.stdout.write("running twoway subscription test... ")
-sys.stdout.flush()
-runtest("twoway", icestorm.reference())
-print("ok")
-
-sys.stdout.write("running ordered subscription test... ")
-sys.stdout.flush()
-runtest("ordered", icestorm.reference())
-print("ok")
-
-icestorm.stopReplica(2)
-
-sys.stdout.write("running twoway, ordered subscription test without master... ")
-sys.stdout.flush()
-runtest("twoway", icestorm.reference())
-runtest("ordered", icestorm.reference())
-print("ok")
-
-icestorm.startReplica(2, echo = False)
-icestorm.stopReplica(0)
-
-sys.stdout.write("running twoway, ordered subscription test without replica... ")
-sys.stdout.flush()
-runtest("twoway", icestorm.reference())
-runtest("ordered", icestorm.reference())
-print("ok")
-
-icestorm.startReplica(0, echo = False)
-
-sys.stdout.write("running cycle publishing test... ")
-sys.stdout.flush()
-runtest("twoway", icestorm.reference(), pubopt=" --cycle")
-print("ok")
-
-sys.stdout.write("stopping replicas... ")
-sys.stdout.flush()
-icestorm.stop()
-print("ok")
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd())
diff --git a/cpp/test/IceStorm/rep1/test.py b/cpp/test/IceStorm/rep1/test.py
new file mode 100644
index 00000000000..7385a9d8d25
--- /dev/null
+++ b/cpp/test/IceStorm/rep1/test.py
@@ -0,0 +1,290 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# Make sure IceStorm and the subscriber use the same buffer size for
+# sending/receiving datagrams. This ensures the test works with bogus
+# OS configurations where the reicever buffer size is smaller than the
+# send buffer size (causing the received messages to be
+# truncated). See also bug #6070.
+#
+props = {
+ "IceStorm.Election.MasterTimeout" : 2,
+ "IceStorm.Election.ElectionTimeout" : 2,
+ "IceStorm.Election.ResponseTimeout" : 2
+}
+
+icestorm = [ IceStorm(replica=i, nreplicas=3, props = props) for i in range(0,3) ]
+
+class IceStormRep1TestCase(IceStormTestCase):
+
+ def runClientSide(self, current):
+
+ def checkExpect(output, expect):
+ if not expect:
+ return
+
+ if type(expect) == str:
+ expect = [expect]
+
+ for e in expect:
+ if output.find(e) >= 0:
+ return
+ else:
+ raise RuntimeError("unexected output `{0}' (expected `{1}')".format(output, expect))
+
+ def adminForReplica(replica, cmd, expect):
+ checkExpect(self.runadmin(current, cmd, instance=self.icestorm[replica], quiet=True, exitstatus=1),
+ expect)
+
+ def stopReplica(num):
+ self.icestorm[num].shutdown(current)
+ self.icestorm[num].stop(current, True)
+
+ def startReplica(num):
+ self.icestorm[num].start(current)
+
+ def runtest(s="", p=""):
+ ClientServerTestCase(client=Publisher(args=p.split(" ")),
+ server=Subscriber(args=s.split(" "))).run(current)
+
+ def runsub2(replica=None, expect=None):
+ subscriber = Subscriber(exe="sub",
+ instance=None if replica is None else self.icestorm[replica],
+ args=["--id", "foo"],
+ readyCount=0,
+ quiet=True)
+ subscriber.run(current, exitstatus=1 if expect else 0)
+ checkExpect(subscriber.getOutput(), expect)
+
+ def rununsub2(replica=None, expect=None):
+ sub = Subscriber(exe="sub",
+ instance=None if replica is None else self.icestorm[replica],
+ args=["--id", "foo"],
+ readyCount=0,
+ quiet=True)
+
+ if replica is None:
+ sub.run(current, args=["--unsub"])
+ # Else we first subscribe to this replica, then unsub. We
+ # shouldn't get an AlreadySubscribedException.
+ sub.run(current, exitstatus=1 if expect else 0)
+ if expect:
+ checkExpect(sub.getOutput(), expect)
+ return
+
+ sub.run(current, args=["--unsub"])
+
+ current.write("testing topic creation across replicas... ")
+ self.runadmin(current, "create single")
+ for replica in range(0, 3):
+ adminForReplica(replica, "create single", "error: topic `single' exists")
+ current.writeln("ok")
+
+ current.write("testing topic destruction across replicas... ")
+ sys.stdout.flush()
+ self.runadmin(current, "destroy single")
+
+ for replica in range(0, 3):
+ adminForReplica(replica, "destroy single", "error: couldn't find topic `single'")
+ current.writeln("ok")
+
+ current.write("testing topic creation without replica... ")
+
+ stopReplica(0)
+
+ self.runadmin(current, "create single")
+
+ for replica in range(1, 3):
+ adminForReplica(replica, "create single", "error: topic `single' exists")
+
+ adminForReplica(0, "create single", ["ConnectionRefused", "ConnectFailed"])
+
+ startReplica(0)
+
+ adminForReplica(0, "create single", "error: topic `single' exists")
+ current.writeln("ok")
+
+ self.runadmin(current, "destroy single")
+
+ current.write("testing topic creation without master... ")
+ sys.stdout.flush()
+
+ stopReplica(2)
+
+ self.runadmin(current, "create single")
+
+ for replica in range(0, 2):
+ adminForReplica(replica, "create single", "error: topic `single' exists")
+
+ adminForReplica(2, "create single", ["ConnectionRefused", "ConnectFailed"])
+
+ startReplica(2)
+
+ adminForReplica(2, "create single", "error: topic `single' exists")
+ current.writeln("ok")
+
+ # All replicas are running
+
+ current.write("testing topic destruction without replica... ")
+
+ stopReplica(0)
+
+ self.runadmin(current, "destroy single")
+
+ for replica in range(1, 3):
+ adminForReplica(replica, "destroy single", "error: couldn't find topic `single'")
+
+ adminForReplica(0, "destroy single", ["ConnectionRefused", "ConnectFailed"])
+
+ startReplica(0)
+
+ adminForReplica(0, "destroy single", "error: couldn't find topic `single'")
+ current.writeln("ok")
+
+ current.write("testing topic destruction without master... ")
+ sys.stdout.flush()
+
+ self.runadmin(current, "create single")
+ stopReplica(2)
+
+ self.runadmin(current, "destroy single")
+
+ for replica in range(0, 2):
+ adminForReplica(replica, "destroy single", "error: couldn't find topic `single'")
+
+ adminForReplica(2, "destroy single", ["ConnectionRefused", "ConnectFailed"])
+
+ startReplica(2)
+
+ adminForReplica(2, "destroy single", "error: couldn't find topic `single'")
+ current.writeln("ok")
+
+ # Now test subscription/unsubscription on all replicas.
+
+ self.runadmin(current, "create single")
+
+ current.write("testing subscription across replicas... ")
+ sys.stdout.flush()
+ runsub2()
+
+ for replica in range(0, 3):
+ runsub2(replica, "IceStorm::AlreadySubscribed")
+ current.writeln("ok")
+
+ current.write("testing unsubscription across replicas... ")
+ sys.stdout.flush()
+ rununsub2()
+
+ for replica in range(0, 3):
+ rununsub2(replica)
+ current.writeln("ok")
+
+ current.write("testing subscription without master... ")
+ sys.stdout.flush()
+ stopReplica(2)
+
+ runsub2()
+
+ for replica in range(0, 2):
+ runsub2(replica, "IceStorm::AlreadySubscribed")
+
+ runsub2(2, ["ConnectionRefused", "ConnectFailed"])
+
+ startReplica(2)
+
+ runsub2(2, "IceStorm::AlreadySubscribed")
+ current.writeln("ok")
+
+ current.write("testing unsubscription without master... ")
+ sys.stdout.flush()
+ stopReplica(2)
+
+ rununsub2()
+
+ for replica in range(0, 2):
+ rununsub2(replica)
+
+ rununsub2(2, ["ConnectionRefused", "ConnectFailed"])
+
+ startReplica(2)
+
+ rununsub2(2)
+ current.writeln("ok")
+
+ current.write("testing subscription without replica... ")
+ sys.stdout.flush()
+ stopReplica(0)
+
+ runsub2()
+
+ for replica in range(1, 3):
+ runsub2(replica, "IceStorm::AlreadySubscribed")
+
+ runsub2(0, ["ConnectionRefused", "ConnectFailed"])
+
+ startReplica(0)
+
+ runsub2(0, "IceStorm::AlreadySubscribed")
+ current.writeln("ok")
+
+ current.write("testing unsubscription without replica... ")
+ stopReplica(0)
+
+ rununsub2()
+
+ for replica in range(1, 3):
+ rununsub2(replica)
+
+ rununsub2(0, ["ConnectionRefused", "ConnectFailed"])
+
+ startReplica(0)
+
+ rununsub2(0)
+ current.writeln("ok")
+
+ # All replicas are running
+
+ current.write("running twoway subscription test... ")
+ runtest("--twoway")
+ current.writeln("ok")
+
+ current.write("running ordered subscription test... ")
+ runtest("--ordered")
+ current.writeln("ok")
+
+ stopReplica(2)
+
+ current.write("running twoway, ordered subscription test without master... ")
+ runtest("--twoway")
+ runtest("--ordered")
+ current.writeln("ok")
+
+ startReplica(2)
+ stopReplica(0)
+
+ current.write("running twoway, ordered subscription test without replica... ")
+ runtest("--twoway")
+ runtest("--ordered")
+ current.writeln("ok")
+
+ startReplica(0)
+
+ current.write("running cycle publishing test... ")
+ sys.stdout.flush()
+ runtest("--twoway", "--cycle")
+ current.writeln("ok")
+
+ current.write("stopping replicas... ")
+ sys.stdout.flush()
+ self.stopIceStorm(current)
+ current.writeln("ok")
+
+TestSuite(__file__, [ IceStormRep1TestCase("replicated", icestorm=icestorm) ], multihost=False)
diff --git a/cpp/test/IceStorm/repgrid/Client.cpp b/cpp/test/IceStorm/repgrid/Client.cpp
index 7941f6fea77..f13afb1cf46 100644
--- a/cpp/test/IceStorm/repgrid/Client.cpp
+++ b/cpp/test/IceStorm/repgrid/Client.cpp
@@ -117,10 +117,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/repgrid/run.py b/cpp/test/IceStorm/repgrid/run.py
deleted file mode 100755
index 5a798964755..00000000000
--- a/cpp/test/IceStorm/repgrid/run.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceStormUtil, IceGridAdmin
-
-targets = []
-if TestUtil.appverifier:
- targets = [TestUtil.getIceBox()]
- TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd())
-
-
-variables = "icebox.exe='%s'" % TestUtil.getIceBox()
-
-#
-# Don't use a slave registry for this test.
-#
-IceGridAdmin.nreplicas=0
-
-#
-# Test client/server without on demand activation.
-#
-IceGridAdmin.iceGridTest("application.xml", "", variables)
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd())
diff --git a/cpp/test/IceStorm/repgrid/test.py b/cpp/test/IceStorm/repgrid/test.py
new file mode 100644
index 00000000000..5beb3296d89
--- /dev/null
+++ b/cpp/test/IceStorm/repgrid/test.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+TestSuite(__file__, [ IceGridTestCase(icegridregistry=IceGridRegistryMaster(),
+ client=IceGridClient()) ],
+ runOnMainThread=True, multihost=False) \ No newline at end of file
diff --git a/cpp/test/IceStorm/repstress/Control.cpp b/cpp/test/IceStorm/repstress/Control.cpp
index 1fe321b5533..c04289cdbad 100644
--- a/cpp/test/IceStorm/repstress/Control.cpp
+++ b/cpp/test/IceStorm/repstress/Control.cpp
@@ -9,6 +9,7 @@
#include <Ice/Ice.h>
#include <Controller.h>
+#include <TestCommon.h>
using namespace std;
using namespace Ice;
@@ -34,10 +35,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/repstress/Publisher.cpp b/cpp/test/IceStorm/repstress/Publisher.cpp
index b38212ff427..b8a91876a9e 100644
--- a/cpp/test/IceStorm/repstress/Publisher.cpp
+++ b/cpp/test/IceStorm/repstress/Publisher.cpp
@@ -12,6 +12,7 @@
#include <IceStorm/IceStorm.h>
#include <Single.h>
#include <Controller.h>
+#include <TestCommon.h>
using namespace std;
using namespace Ice;
@@ -71,7 +72,7 @@ public:
Lock sync(*this);
_destroy = true;
}
-
+
private:
const SinglePrx _single;
@@ -109,7 +110,7 @@ run(int, char* argv[], const CommunicatorPtr& communicator)
{
cerr << argv[0] << ": NoSuchTopic: " << e.name << endl;
return EXIT_FAILURE;
-
+
}
assert(topic);
@@ -140,10 +141,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/repstress/Subscriber.cpp b/cpp/test/IceStorm/repstress/Subscriber.cpp
index a19aea9aca6..6ac382ce38c 100644
--- a/cpp/test/IceStorm/repstress/Subscriber.cpp
+++ b/cpp/test/IceStorm/repstress/Subscriber.cpp
@@ -132,10 +132,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/repstress/run.py b/cpp/test/IceStorm/repstress/run.py
deleted file mode 100755
index 6e616437cf1..00000000000
--- a/cpp/test/IceStorm/repstress/run.py
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, time, re
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceStormUtil
-
-publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher"))
-subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber"))
-control = os.path.join(os.getcwd(), TestUtil.getTestExecutable("control"))
-
-targets = []
-if TestUtil.appverifier:
- targets = [TestUtil.getIceBox(), publisher, subscriber, control, TestUtil.getIceBoxAdmin(), \
- TestUtil.getIceStormAdmin()]
- TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd())
-
-def runcontrol(proxy):
- proc = TestUtil.startClient(control, ' "%s"' % proxy)
- proc.waitTestSuccess()
-
-icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), "replicated", replicatedPublisher=True, additional =
- ' --IceStorm.Election.MasterTimeout=2' +
- ' --IceStorm.Election.ElectionTimeout=2' +
- ' --IceStorm.Election.ResponseTimeout=2')
-icestorm.start()
-
-sys.stdout.write("creating topic... ")
-sys.stdout.flush()
-icestorm.admin("create single")
-print("ok")
-
-sys.stdout.write("running subscriber... ")
-sys.stdout.flush()
-subscriberProc = TestUtil.startServer(subscriber, ' --Ice.ServerIdleTime=0 ' + icestorm.reference(), echo = False)
-subscriberProc.expect("([^\n]+)\n")
-subControl = subscriberProc.match.group(1)
-print("ok")
-
-sys.stdout.write("running publisher... ")
-sys.stdout.flush()
-publisherProc = TestUtil.startServer(publisher, ' --Ice.ServerIdleTime=0 ' + icestorm.reference(), echo = False)
-publisherProc.expect("([^\n]+)\n")
-pubControl = publisherProc.match.group(1)
-print("ok")
-
-time.sleep(2)
-
-for i in range(0, 3):
- # 0, 1
- sys.stdout.write("stopping replica 2 (0, 1 running)... ")
- sys.stdout.flush()
- icestorm.stopReplica(2)
- print("ok")
- time.sleep(2)
-
- # 1, 2
- sys.stdout.write("starting 2, stopping 0 (1, 2 running)... ")
- sys.stdout.flush()
- icestorm.startReplica(2, echo=False)
- icestorm.stopReplica(0)
- print("ok")
- # This waits for the replication to startup
- #icestorm.admin("list")
- time.sleep(2)
-
- # 0, 2
- sys.stdout.write("starting 0, stopping 1 (0, 2 running)... ")
- sys.stdout.flush()
- icestorm.startReplica(0, echo=False)
- icestorm.stopReplica(1)
- print("ok")
- # This waits for the replication to startup
- #icestorm.admin("list")
- time.sleep(2)
-
- sys.stdout.write("starting 1 (all running)... ")
- sys.stdout.flush()
- icestorm.startReplica(1, echo=False)
- print("ok")
- # This waits for the replication to startup
- #icestorm.admin("list")
-
- time.sleep(2)
-
-sys.stdout.write("stopping publisher... ")
-sys.stdout.flush()
-runcontrol(pubControl)
-publisherProc.expect("([^\n]+)\n")
-publisherCount = publisherProc.match.group(1)
-publisherProc.waitTestSuccess()
-print("ok")
-
-sys.stdout.write("stopping replicas... ")
-sys.stdout.flush()
-icestorm.stop()
-print("ok")
-
-sys.stdout.write("stopping subscriber... ")
-sys.stdout.flush()
-runcontrol(subControl)
-subscriberProc.expect("([^\n]+)\n")
-subscriberCount = subscriberProc.match.group(1)
-subscriberProc.waitTestSuccess()
-print("ok")
-
-print("publisher published %s events, subscriber received %s events" % (publisherCount, subscriberCount))
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd())
diff --git a/cpp/test/IceStorm/repstress/test.py b/cpp/test/IceStorm/repstress/test.py
new file mode 100644
index 00000000000..f61befa8961
--- /dev/null
+++ b/cpp/test/IceStorm/repstress/test.py
@@ -0,0 +1,113 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# Make sure IceStorm and the subscriber use the same buffer size for
+# sending/receiving datagrams. This ensures the test works with bogus
+# OS configurations where the reicever buffer size is smaller than the
+# send buffer size (causing the received messages to be
+# truncated). See also bug #6070.
+#
+props = {
+ "IceStorm.Election.MasterTimeout" : 2,
+ "IceStorm.Election.ElectionTimeout" : 2,
+ "IceStorm.Election.ResponseTimeout" : 2,
+ "Ice.Warn.Dispatch" : 0
+}
+
+icestorm = [ IceStorm(replica=i, nreplicas=3, props = props) for i in range(0,3) ]
+
+class IceStormRepStressTestCase(IceStormTestCase):
+
+ def runClientSide(self, current):
+
+ def stopReplica(num):
+ self.icestorm[num].shutdown(current)
+ self.icestorm[num].stop(current, True)
+
+ def startReplica(num):
+ self.icestorm[num].start(current)
+
+ current.write("creating topic... ")
+ self.runadmin(current, "create single")
+ current.writeln("ok")
+
+ current.write("running subscriber... ")
+ subscriber = Subscriber(quiet=True)
+ subscriber.start(current)
+ subscriber.expect("([^\n]+)\n")
+ subControl = subscriber.process.match.group(1)
+ current.writeln("ok")
+
+ current.write("running publisher... ")
+ publisher = Publisher(quiet=True)
+ publisher.start(current)
+ publisher.expect("([^\n]+)\n")
+ pubControl = publisher.process.match.group(1)
+ current.writeln("ok")
+
+ time.sleep(2)
+
+ for i in range(0, 3):
+ # 0, 1
+ current.write("stopping replica 2 (0, 1 running)... ")
+ stopReplica(2)
+ current.writeln("ok")
+ time.sleep(2)
+
+ # 1, 2
+ current.write("starting 2, stopping 0 (1, 2 running)... ")
+ startReplica(2)
+ stopReplica(0)
+ current.writeln("ok")
+ # This waits for the replication to startup
+ #self.runadmin(current, "list")
+ time.sleep(2)
+
+ # 0, 2
+ current.write("starting 0, stopping 1 (0, 2 running)... ")
+ startReplica(0)
+ stopReplica(1)
+ current.writeln("ok")
+ # This waits for the replication to startup
+ #self.runadmin(current, "list")
+ time.sleep(2)
+
+ current.write("starting 1 (all running)... ")
+ startReplica(1)
+ current.writeln("ok")
+ # This waits for the replication to startup
+ #self.runadmin(current, "list")
+ time.sleep(2)
+
+ current.write("stopping publisher... ")
+ Client(exe="control", args=[pubControl]).run(current)
+ publisher.expect("([^\n]+)\n")
+ publisherCount = publisher.process.match.group(1)
+ publisher.stop(current, True)
+ current.writeln("ok")
+
+ current.write("stopping replicas... ")
+ self.stopIceStorm(current)
+ current.writeln("ok")
+
+ current.write("stopping subscriber... ")
+ Client(exe="control", args=[subControl]).run(current)
+ subscriber.expect("([^\n]+)\n")
+ subscriberCount = subscriber.process.match.group(1)
+ subscriber.stop(current, True)
+ current.writeln("ok")
+
+ current.writeln("publisher published %s events, subscriber received %s events" % (publisherCount, subscriberCount))
+
+TestSuite(__file__,
+ [ IceStormRepStressTestCase("replicated", icestorm=icestorm) ],
+ options={ "ipv6" : [False] },
+ multihost=False)
diff --git a/cpp/test/IceStorm/single/0.db/.gitignore b/cpp/test/IceStorm/single/0.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/single/0.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/single/1.db/.gitignore b/cpp/test/IceStorm/single/1.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/single/1.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/single/2.db/.gitignore b/cpp/test/IceStorm/single/2.db/.gitignore
deleted file mode 100644
index 72e8ffc0db8..00000000000
--- a/cpp/test/IceStorm/single/2.db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-*
diff --git a/cpp/test/IceStorm/single/Publisher.cpp b/cpp/test/IceStorm/single/Publisher.cpp
index 8c06e428955..a88dff82add 100644
--- a/cpp/test/IceStorm/single/Publisher.cpp
+++ b/cpp/test/IceStorm/single/Publisher.cpp
@@ -9,6 +9,7 @@
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
+#include <TestCommon.h>
#include <Single.h>
using namespace std;
@@ -70,7 +71,8 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp
index f2ee78ee554..7b4c0a17351 100644
--- a/cpp/test/IceStorm/single/Subscriber.cpp
+++ b/cpp/test/IceStorm/single/Subscriber.cpp
@@ -251,7 +251,8 @@ main(int argc, char* argv[])
try
{
- communicator = initialize(argc, argv);
+ Ice::InitializationData initData = getTestInitData(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/single/db/.gitignore b/cpp/test/IceStorm/single/db/.gitignore
deleted file mode 100644
index 39af5887579..00000000000
--- a/cpp/test/IceStorm/single/db/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-# Dummy file, so that git retains this otherwise empty directory.
diff --git a/cpp/test/IceStorm/single/run.py b/cpp/test/IceStorm/single/run.py
deleted file mode 100755
index 162854b9084..00000000000
--- a/cpp/test/IceStorm/single/run.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-import time
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceStormUtil
-
-publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher"))
-subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber"))
-
-#
-# Make sure IceStorm and the subscriber use the same buffer size for
-# sending/receiving datagrams. This ensures the test works with bogus
-# OS configurations where the reicever buffer size is smaller than the
-# send buffer size (causing the received messages to be
-# truncated). See also bug #6070.
-#
-iceStormArgs = " --Ice.UDP.SndSize=4096"
-subscriberArgs = " --Ice.UDP.RcvSize=4096"
-
-targets = []
-if TestUtil.appverifier:
- targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), TestUtil.getIceStormAdmin()]
- TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd())
-
-def dotest(type):
- icestorm = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, additional=iceStormArgs)
- icestorm.start()
-
- sys.stdout.write("creating topic... ")
- sys.stdout.flush()
- icestorm.admin("create single")
- print("ok")
-
- sys.stdout.write("starting subscriber... ")
- sys.stdout.flush()
- subscriberProc = TestUtil.startServer(subscriber, icestorm.reference() + subscriberArgs + " " + type, count = 3)
- print("ok")
-
- #
- # Start the publisher. This should publish 10 events which eventually
- # causes subscriber to terminate.
- #
- sys.stdout.write("starting publisher... ")
- sys.stdout.flush()
- publisherProc = TestUtil.startClient(publisher, icestorm.reference(), startReader = False)
- print("ok")
- publisherProc.startReader()
-
- subscriberProc.waitTestSuccess()
- publisherProc.waitTestSuccess()
-
- #
- # Destroy the topic.
- #
- sys.stdout.write("destroy topic... ")
- sys.stdout.flush()
- icestorm.admin("destroy single")
- print("ok")
-
- #
- # Shutdown icestorm.
- #
- icestorm.stop()
-
-dotest("persistent")
-dotest("transient")
-dotest("replicated")
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd([targets], cwd = os.getcwd())
-
-sys.exit(0)
diff --git a/cpp/test/IceStorm/single/test.py b/cpp/test/IceStorm/single/test.py
new file mode 100644
index 00000000000..b4e5848e2b0
--- /dev/null
+++ b/cpp/test/IceStorm/single/test.py
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# Make sure IceStorm and the subscriber use the same buffer size for
+# sending/receiving datagrams. This ensures the test works with bogus
+# OS configurations where the reicever buffer size is smaller than the
+# send buffer size (causing the received messages to be
+# truncated). See also bug #6070.
+#
+props = { "Ice.UDP.SndSize" : 4096, "Ice.Warn.Dispatch" : 0 }
+persistent = IceStorm(props = props)
+transient = IceStorm(props = props, transient=True)
+replicated = [ IceStorm(replica=i, nreplicas=3, props = props) for i in range(0,3) ]
+
+sub = Subscriber(args=["{testcase.parent.name}"], props = { "Ice.UDP.RcvSize" : 4096 }, readyCount=3)
+pub = Publisher(args=["{testcase.parent.name}"])
+
+class IceStormSingleTestCase(IceStormTestCase):
+
+ def setupClientSide(self, current):
+ self.runadmin(current, "create single")
+
+ def teardownClientSide(self, current, success):
+ self.runadmin(current, "destroy single")
+ self.shutdown(current)
+
+TestSuite(__file__, [
+ IceStormSingleTestCase("persistent", icestorm=persistent, client=ClientServerTestCase(client=pub, server=sub)),
+ IceStormSingleTestCase("transient", icestorm=transient, client=ClientServerTestCase(client=pub, server=sub)),
+ IceStormSingleTestCase("replicated", icestorm=replicated, client=ClientServerTestCase(client=pub, server=sub)),
+], multihost=False)
diff --git a/cpp/test/IceStorm/stress/Publisher.cpp b/cpp/test/IceStorm/stress/Publisher.cpp
index 6b9c7801f68..7d41977191a 100644
--- a/cpp/test/IceStorm/stress/Publisher.cpp
+++ b/cpp/test/IceStorm/stress/Publisher.cpp
@@ -11,6 +11,7 @@
#include <IceUtil/Options.h>
#include <IceStorm/IceStorm.h>
#include <Event.h>
+#include <TestCommon.h>
using namespace std;
using namespace Ice;
@@ -117,10 +118,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/stress/Subscriber.cpp b/cpp/test/IceStorm/stress/Subscriber.cpp
index 132bd5c4d34..1baa978ae3f 100644
--- a/cpp/test/IceStorm/stress/Subscriber.cpp
+++ b/cpp/test/IceStorm/stress/Subscriber.cpp
@@ -515,10 +515,10 @@ main(int argc, char* argv[])
{
int status;
CommunicatorPtr communicator;
-
+ InitializationData initData = getTestInitData(argc, argv);
try
{
- communicator = initialize(argc, argv);
+ communicator = initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
catch(const Exception& ex)
diff --git a/cpp/test/IceStorm/stress/run.py b/cpp/test/IceStorm/stress/run.py
deleted file mode 100755
index ea56f3ed0a5..00000000000
--- a/cpp/test/IceStorm/stress/run.py
+++ /dev/null
@@ -1,204 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, time, threading, re
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil, IceStormUtil
-
-iceStormAdmin = TestUtil.getIceStormAdmin()
-
-publisher = os.path.join(os.getcwd(), TestUtil.getTestExecutable("publisher"))
-subscriber = os.path.join(os.getcwd(), TestUtil.getTestExecutable("subscriber"))
-
-targets = []
-if TestUtil.appverifier:
- targets = [TestUtil.getIceBox(), publisher, subscriber, TestUtil.getIceBoxAdmin(), \
- TestUtil.getIceStormAdmin()]
- TestUtil.setAppVerifierSettings(targets, cwd = os.getcwd())
-
-def doTest(server1, server2, subOpts, pubOpts):
-
- subscriberProcs = []
- if type(subOpts) != type([]):
- subOpts = [ subOpts ]
- for opts in subOpts:
- # We don't want the subscribers to time out.
- proc = TestUtil.startServer(subscriber, ' --Ice.ServerIdleTime=0 ' + opts)
- subscriberProcs.append(proc)
-
- publisherProc = TestUtil.startClient(publisher, server1.reference() + r' ' + pubOpts)
- publisherProc.waitTestSuccess()
- for p in subscriberProcs:
- sys.stdout.flush()
- p.waitTestSuccess()
-
- return 0
-
-def runAdmin(cmd, desc = None):
- global iceStormAdmin
- global iceStormAdminReference
- if desc:
- sys.stdout.write(desc + " ")
- sys.stdout.flush()
- proc = TestUtil.startClient(iceStormAdmin, adminIceStormReference + r' -e "%s"' % cmd, startReader = True)
- proc.waitTestSuccess()
- if desc:
- print("ok")
-
-def runtest(type):
- # Clear the idle timeout otherwise the IceBox ThreadPool will timeout.
- server1 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, dbDir = "db", instanceName = "TestIceStorm1",
- port = 12000)
- server2 = IceStormUtil.init(TestUtil.toplevel, os.getcwd(), type, dbDir = "db2", instanceName = "TestIceStorm2",
- port = 12500)
- global adminIceStormReference
- adminIceStormReference = ' --IceStormAdmin.TopicManager.Proxy="%s" --IceStormAdmin.TopicManager.Proxy2="%s"' % (
- server1.proxy(), server2.proxy())
-
- sys.stdout.write("starting icestorm services... ")
- sys.stdout.flush()
- server1.start(echo=False)
- server2.start(echo=False)
- print("ok")
-
- runAdmin("create TestIceStorm1/fed1 TestIceStorm2/fed1", "setting up the topics...")
-
- sys.stdout.write("Sending 5000 ordered events... ")
- sys.stdout.flush()
- doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server1.reference(), '--events 5000')
- print("ok")
-
- runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1")
- sys.stdout.write("Sending 5000 ordered events across a link... ")
- sys.stdout.flush()
- doTest(server1, server2, '--events 5000 --qos "reliability,ordered" ' + server2.reference(), '--events 5000')
- print("ok")
-
- runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1")
- sys.stdout.write("Sending 20000 unordered events... ")
- sys.stdout.flush()
- doTest(server1, server2, '--events 20000 ' + server1.reference(), '--events 20000 --oneway')
- print("ok")
-
- runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1")
- sys.stdout.write("Sending 20000 unordered events across a link... ")
- sys.stdout.flush()
- doTest(server1, server2, '--events 20000 ' + server2.reference(), '--events 20000 --oneway')
- print("ok")
-
- runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1")
- sys.stdout.write("Sending 20000 unordered batch events... ")
- sys.stdout.flush()
- doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server1.reference(), '--events 20000 --oneway')
- print("ok")
-
- runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1")
- sys.stdout.write("Sending 20000 unordered batch events across a link... ")
- sys.stdout.flush()
- doTest(server1, server2, '--events 20000 --qos "reliability,batch" ' + server2.reference(), '--events 20000 --oneway')
- print("ok")
-
- runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1")
- sys.stdout.write("Sending 20000 unordered events with slow subscriber... ")
- sys.stdout.flush()
- doTest(server1, server2, ['--events 2 --slow ' + server1.reference(), '--events 20000 ' + server1.reference()], '--events 20000 --oneway')
- print("ok")
-
- runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1")
- sys.stdout.write("Sending 20000 unordered events with slow subscriber & link... ")
- sys.stdout.flush()
- doTest(server1, server2, ['--events 2 --slow' + server1.reference(), '--events 20000' + server1.reference(), '--events 2 --slow' + server2.reference(), '--events 20000' + server2.reference()], '--events 20000 --oneway')
- print("ok")
-
- sys.stdout.write("shutting down icestorm services... ")
- sys.stdout.flush()
- server1.stop()
- server2.stop()
- print("ok")
-
- sys.stdout.write("starting icestorm services... ")
- sys.stdout.flush()
- #
- # The erratic tests emit lots of connection warnings so they are
- # disabled here. The IceStorm servers are stopped and restarted so the
- # settings will take effect.
- #
- server1.start(echo=False, additionalOptions = ' --Ice.Warn.Connections=0')
- server2.start(echo=False, additionalOptions = ' --Ice.Warn.Connections=0')
- print("ok")
-
- runAdmin("unlink TestIceStorm1/fed1 TestIceStorm2/fed1")
-
- sys.stdout.write("Sending 20000 unordered events with erratic subscriber... ")
- sys.stdout.flush()
- doTest(server1, server2,
- [ '--erratic 5 --qos "reliability,ordered" --events 20000' + server1.reference(),
- '--erratic 5 --events 20000' + server1.reference(),
- '--events 20000' + server1.reference()],
- '--events 20000 --oneway')
- print("ok")
-
- runAdmin("link TestIceStorm1/fed1 TestIceStorm2/fed1")
- sys.stdout.write("Sending 20000 unordered events with erratic subscriber across a link... ")
- sys.stdout.flush()
- doTest(server1, server2,
- [ '--events 20000' + server1.reference(),
- '--erratic 5 --qos "reliability,ordered" --events 20000 ' + server1.reference(),
- '--erratic 5 --events 20000 ' + server1.reference(),
- '--events 20000' + server2.reference(),
- '--erratic 5 --qos "reliability,ordered" --events 20000 ' + server2.reference(),
- '--erratic 5 --events 20000 ' + server2.reference()],
- '--events 20000 --oneway ')
- print("ok")
-
- #
- # Shutdown icestorm.
- #
- sys.stdout.write("shutting down icestorm services... ")
- sys.stdout.flush()
- server1.stop()
- server2.stop()
- print("ok")
-
- sys.stdout.write("Sending 5000 ordered events with max queue size drop events... ")
- sys.stdout.flush()
- opts = " --IceStorm.Send.QueueSizeMax=2000 --IceStorm.Send.QueueSizeMaxPolicy=DropEvents"
- server1.start(echo=False, additionalOptions = opts)
- doTest(server1, server2,
- '--events 5000 --qos "reliability,ordered" --maxQueueDropEvents=2000 ' + server1.reference(),
- '--events 5000 --maxQueueTest')
- server1.stop()
- print("ok")
-
- sys.stdout.write("Sending 5000 ordered events with max queue size remove subscriber... ")
- sys.stdout.flush()
- opts = " --IceStorm.Send.QueueSizeMax=2000 --IceStorm.Send.QueueSizeMaxPolicy=RemoveSubscriber"
- server1.start(echo=False, additionalOptions = opts)
- doTest(server1, server2,
- '--events 5000 --qos "reliability,ordered" --maxQueueRemoveSub=2000 ' + server1.reference(),
- '--events 5000 --maxQueueTest')
- server1.stop()
- print("ok")
-
-
-
-runtest("persistent")
-runtest("replicated")
-
-if TestUtil.appverifier:
- TestUtil.appVerifierAfterTestEnd(targets, cwd = os.getcwd())
diff --git a/cpp/test/IceStorm/stress/test.py b/cpp/test/IceStorm/stress/test.py
new file mode 100644
index 00000000000..16f30f28a30
--- /dev/null
+++ b/cpp/test/IceStorm/stress/test.py
@@ -0,0 +1,155 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# Publisher/subscriber test cases, publisher publishes on TestIceStorm1 instance(s) and
+# the subscriber subscribes to the TestIceStorm2 instance(s)
+#
+pubSub=lambda si, pi, s={}, p={}: ClientServerTestCase(client=Publisher(args=s), server=Subscriber(args=p))
+
+class IceStormStressTestCase(IceStormTestCase):
+
+ def runClientSide(self, current):
+
+ icestorm1 = [icestorm for icestorm in self.icestorm if icestorm.getInstanceName() == "TestIceStorm1"]
+ icestorm2 = [icestorm for icestorm in self.icestorm if icestorm.getInstanceName() == "TestIceStorm2"]
+
+ def doTest(subOpts, pubOpts):
+ # Create the subscribers
+ subscribers = []
+ for (instanceName, opts) in subOpts if type(subOpts) == list else [subOpts]:
+ subscribers.append(Subscriber(instanceName or "TestIceStorm1", args=opts.split(" ")))
+
+ # Create the publisher
+ publisher = Publisher("TestIceStorm1", args=pubOpts.split(" "))
+
+ # Run the test case
+ ClientServerTestCase(client=publisher, servers=subscribers).run(current)
+
+ current.write("setting up the topics...")
+ self.runadmin(current, "create TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.writeln("ok")
+
+ current.write("Sending 5000 ordered events... ")
+ doTest(("TestIceStorm1", '--events 5000 --qos "reliability,ordered"'), '--events 5000')
+ current.writeln("ok")
+
+ self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.write("Sending 5000 ordered events across a link... ")
+ doTest(("TestIceStorm2", '--events 5000 --qos "reliability,ordered"'), '--events 5000')
+ current.writeln("ok")
+
+ self.runadmin(current, "unlink TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.write("Sending 20000 unordered events... ")
+ doTest(("TestIceStorm1", '--events 20000'), '--events 20000 --oneway')
+ current.writeln("ok")
+
+ self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.write("Sending 20000 unordered events across a link... ")
+ doTest(("TestIceStorm2", '--events 20000'), '--events 20000 --oneway')
+ current.writeln("ok")
+
+ self.runadmin(current, "unlink TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.write("Sending 20000 unordered batch events... ")
+ doTest(("TestIceStorm1", '--events 20000 --qos "reliability,batch"'), '--events 20000 --oneway')
+ current.writeln("ok")
+
+ self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.write("Sending 20000 unordered batch events across a link... ")
+ doTest(("TestIceStorm2", '--events 20000 --qos "reliability,batch"'), '--events 20000 --oneway')
+ current.writeln("ok")
+
+ self.runadmin(current, "unlink TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.write("Sending 20000 unordered events with slow subscriber... ")
+ doTest([("TestIceStorm1", '--events 2 --slow'),
+ ("TestIceStorm1", '--events 20000 ')],
+ '--events 20000 --oneway')
+ current.writeln("ok")
+
+ self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.write("Sending 20000 unordered events with slow subscriber & link... ")
+ doTest([("TestIceStorm1", '--events 2 --slow'),
+ ("TestIceStorm1", '--events 20000'),
+ ("TestIceStorm2", '--events 2 --slow'),
+ ("TestIceStorm2", '--events 20000')],
+ '--events 20000 --oneway')
+ current.writeln("ok")
+
+ current.write("shutting down icestorm services... ")
+ self.stopIceStorm(current)
+ current.writeln("ok")
+
+ current.write("starting icestorm services... ")
+ #
+ # The erratic tests emit lots of connection warnings so they are
+ # disabled here. The IceStorm servers are stopped and restarted so the
+ # settings will take effect.
+ #
+ self.startIceStorm(current)
+ current.writeln("ok")
+
+ self.runadmin(current, "unlink TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.write("Sending 20000 unordered events with erratic subscriber... ")
+ doTest([ ("TestIceStorm1", '--erratic 5 --qos "reliability,ordered" --events 20000'),
+ ("TestIceStorm1", '--erratic 5 --events 20000'),
+ ("TestIceStorm1", '--events 20000')],
+ '--events 20000 --oneway')
+ current.writeln("ok")
+
+ self.runadmin(current, "link TestIceStorm1/fed1 TestIceStorm2/fed1")
+ current.write("Sending 20000 unordered events with erratic subscriber across a link... ")
+ doTest([ ("TestIceStorm1", '--events 20000'),
+ ("TestIceStorm1", '--erratic 5 --qos "reliability,ordered" --events 20000 '),
+ ("TestIceStorm1", '--erratic 5 --events 20000 '),
+ ("TestIceStorm2", '--events 20000'),
+ ("TestIceStorm2", '--erratic 5 --qos "reliability,ordered" --events 20000 '),
+ ("TestIceStorm2", '--erratic 5 --events 20000 ')],
+ '--events 20000 --oneway ')
+ current.writeln("ok")
+
+ #
+ # Shutdown icestorm.
+ #
+ current.write("shutting down icestorm services... ")
+ self.stopIceStorm(current)
+ current.writeln("ok")
+
+ current.write("Sending 5000 ordered events with max queue size drop events... ")
+ opts = " --IceStorm.Send.QueueSizeMax=2000 --IceStorm.Send.QueueSizeMaxPolicy=DropEvents"
+ for s in icestorm1:
+ s.start(current, args=opts.split(" "))
+ doTest(("TestIceStorm1", '--events 5000 --qos "reliability,ordered" --maxQueueDropEvents=2000'),
+ '--events 5000 --maxQueueTest')
+ for s in icestorm1:
+ s.shutdown(current)
+ s.stop(current, True)
+ current.writeln("ok")
+
+ current.write("Sending 5000 ordered events with max queue size remove subscriber... ")
+ opts = " --IceStorm.Send.QueueSizeMax=2000 --IceStorm.Send.QueueSizeMaxPolicy=RemoveSubscriber"
+ for s in icestorm1:
+ s.start(current, args=opts.split(" "))
+ doTest(("TestIceStorm1", '--events 5000 --qos "reliability,ordered" --maxQueueRemoveSub=2000'),
+ '--events 5000 --maxQueueTest')
+ for s in icestorm1:
+ s.shutdown(current)
+ s.stop(current, True)
+ current.writeln("ok")
+
+TestSuite(__file__, [
+
+ IceStormStressTestCase("persistent", icestorm=[IceStorm("TestIceStorm1", quiet=True),
+ IceStorm("TestIceStorm2", quiet=True, portnum=20)]),
+
+ IceStormStressTestCase("replicated with replicated publisher", icestorm=
+ [IceStorm("TestIceStorm1", i, 3, quiet=True) for i in range(0,3)] +
+ [IceStorm("TestIceStorm2", i, 3, portnum=20, quiet=True) for i in range(0,3)]),
+
+], multihost=False)
diff --git a/cpp/test/IceUtil/condvar/run.py b/cpp/test/IceUtil/condvar/run.py
deleted file mode 100755
index 2d25b9060d4..00000000000
--- a/cpp/test/IceUtil/condvar/run.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-workqueue = os.path.join(os.getcwd(), TestUtil.getTestExecutable("workqueue"))
-
-TestUtil.simpleTest(workqueue)
-
-match = os.path.join(os.getcwd(), TestUtil.getTestExecutable("match"))
-
-TestUtil.simpleTest(match)
-
-# Don't use simpleTest(match + " -b") this will confuse
-# appverifier about the name of target exe
-TestUtil.simpleTest(match, " -b")
diff --git a/cpp/test/IceUtil/ctrlCHandler/test.py b/cpp/test/IceUtil/ctrlCHandler/test.py
new file mode 100644
index 00000000000..6dda05ec6ec
--- /dev/null
+++ b/cpp/test/IceUtil/ctrlCHandler/test.py
@@ -0,0 +1,10 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+# Dummy file to not run this test which is only ran manually. \ No newline at end of file
diff --git a/cpp/test/IceUtil/inputUtil/run.py b/cpp/test/IceUtil/inputUtil/run.py
deleted file mode 100755
index cc23013f5c5..00000000000
--- a/cpp/test/IceUtil/inputUtil/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client, os.getcwd())
diff --git a/cpp/test/IceUtil/priority/run.py b/cpp/test/IceUtil/priority/run.py
deleted file mode 100755
index fb7a3661cd8..00000000000
--- a/cpp/test/IceUtil/priority/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-TestUtil.simpleTest(client, os.getcwd())
diff --git a/cpp/test/IceUtil/priority/test.py b/cpp/test/IceUtil/priority/test.py
new file mode 100644
index 00000000000..30e287825fb
--- /dev/null
+++ b/cpp/test/IceUtil/priority/test.py
@@ -0,0 +1,11 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+if not isinstance(platform, Darwin) and (isinstance(platform, Windows) or os.getuid() == 0):
+ TestSuite(__name__)
diff --git a/cpp/test/IceUtil/sha1/run.py b/cpp/test/IceUtil/sha1/run.py
deleted file mode 100755
index d06758d0994..00000000000
--- a/cpp/test/IceUtil/sha1/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client)
diff --git a/cpp/test/IceUtil/stacktrace/run.py b/cpp/test/IceUtil/stacktrace/run.py
deleted file mode 100755
index d06758d0994..00000000000
--- a/cpp/test/IceUtil/stacktrace/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client)
diff --git a/cpp/test/IceUtil/stacktrace/test.py b/cpp/test/IceUtil/stacktrace/test.py
new file mode 100644
index 00000000000..f371bb23ced
--- /dev/null
+++ b/cpp/test/IceUtil/stacktrace/test.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+TestSuite(__name__, options = { "cpp11" : [False] })
diff --git a/cpp/test/IceUtil/thread/run.py b/cpp/test/IceUtil/thread/run.py
deleted file mode 100755
index fb7a3661cd8..00000000000
--- a/cpp/test/IceUtil/thread/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-TestUtil.simpleTest(client, os.getcwd())
diff --git a/cpp/test/IceUtil/timer/run.py b/cpp/test/IceUtil/timer/run.py
deleted file mode 100755
index d06758d0994..00000000000
--- a/cpp/test/IceUtil/timer/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client)
diff --git a/cpp/test/IceUtil/unicode/run.py b/cpp/test/IceUtil/unicode/run.py
deleted file mode 100755
index 3a33273413b..00000000000
--- a/cpp/test/IceUtil/unicode/run.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-
-TestUtil.simpleTest(client, '"%s"' % os.getcwd())
diff --git a/cpp/test/IceUtil/unicode/test.py b/cpp/test/IceUtil/unicode/test.py
new file mode 100644
index 00000000000..b3da595727d
--- /dev/null
+++ b/cpp/test/IceUtil/unicode/test.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+TestSuite(__name__, [ ClientTestCase(client=SimpleClient(args=["{testdir}"])) ])
diff --git a/cpp/test/IceUtil/uuid/run.py b/cpp/test/IceUtil/uuid/run.py
deleted file mode 100755
index d06758d0994..00000000000
--- a/cpp/test/IceUtil/uuid/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client)
diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py
deleted file mode 100755
index d1a194258d4..00000000000
--- a/cpp/test/Slice/errorDetection/run.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, re
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel os.getcwd()!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-slice2cpp = '"%s"' % TestUtil.getSliceTranslator()
-
-regex1 = re.compile("\.ice$", re.IGNORECASE)
-files = []
-for file in os.listdir(os.getcwd()):
- if(regex1.search(file)):
- files.append(file)
-
-files.sort()
-
-for file in files:
-
- sys.stdout.write(file + "... ")
- sys.stdout.flush()
-
- if file.find("Underscore") != -1:
- command = slice2cpp + ' --underscore -I. "%s"' % os.path.join(os.getcwd(), file)
- else:
- command = slice2cpp + ' -I. "%s"' % os.path.join(os.getcwd(), file)
- p = TestUtil.runCommand(command)
- (stdin, stdout, stderr) = (p.stdin, p.stdout, p.stderr)
-
- lines1 = stderr.readlines()
- lines2 = open(os.path.join(os.getcwd(), regex1.sub(".err", file)), "r").readlines()
- if len(lines1) != len(lines2):
- print("failed!")
- sys.exit(1)
-
- regex2 = re.compile("^.*(?=" + file + ")")
- i = 0
- while i < len(lines1):
- if sys.version_info[0] == 2:
- line1 = regex2.sub("", lines1[i]).strip()
- line2 = regex2.sub("", lines2[i]).strip()
- else:
- line1 = regex2.sub("", lines1[i].decode("utf-8")).strip()
- line2 = regex2.sub("", lines2[i]).strip()
- if line1 != line2:
- print("\n" + line1)
- print("\n" + line2)
- print("failed!")
- sys.exit(1)
- i = i + 1
- else:
- print("ok")
-
-sys.exit(0)
diff --git a/cpp/test/Slice/errorDetection/test.py b/cpp/test/Slice/errorDetection/test.py
new file mode 100644
index 00000000000..71953c3086c
--- /dev/null
+++ b/cpp/test/Slice/errorDetection/test.py
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import glob
+
+class SliceErrorDetectionTestCase(ClientTestCase):
+
+ def runClientSide(self, current):
+ testdir = self.getPath()
+ slice2cpp = SliceTranslator("slice2cpp")
+
+ files = glob.glob("{0}/*.ice".format(testdir))
+ files.sort()
+ for file in files:
+ current.write(os.path.basename(file) + "... ")
+
+ args = ["-I.", file]
+ if file.find("Underscore") >= 0:
+ args.append("--underscore")
+
+ # Don't print out slice2cpp output and expect failures
+ slice2cpp.run(current, args=args, exitstatus=1)
+ output = slice2cpp.getOutput()
+
+ regex1 = re.compile("\.ice$", re.IGNORECASE)
+ lines1 = output.strip().split("\n")
+ lines2 = open(os.path.join(testdir, regex1.sub(".err", file)), "r").readlines()
+ if len(lines1) != len(lines2):
+ raise RuntimeError("failed (lines1 = {0}, lines2 = {1})!".format(len(lines1), len(lines2)))
+
+ regex2 = re.compile("^.*(?=" + os.path.basename(file) + ")")
+ i = 0
+ while i < len(lines1):
+ line1 = regex2.sub("", lines1[i]).strip()
+ line2 = regex2.sub("", lines2[i]).strip()
+ if line1 != line2:
+ raise RuntimeError("failed! (line1 = \"{0}\", line2 = \"{1}\"".format(line1, line2))
+ i = i + 1
+ else:
+ current.writeln("ok")
+
+TestSuite(__name__, [ SliceErrorDetectionTestCase() ])
diff --git a/cpp/test/Slice/headers/run.py b/cpp/test/Slice/headers/run.py
deleted file mode 100755
index 0747f0c8e63..00000000000
--- a/cpp/test/Slice/headers/run.py
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, re
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-def clean():
- for f in ["iceslices",
- "linktoslices",
- os.path.join("slices", "linktodir2"),
- os.path.join("slices", "linktodir1"),
- os.path.join("slices", "dir1", "linktoa3.ice")]:
- if os.path.exists(f):
- os.unlink(f)
- os.system("rm -rf project1 tmp")
-
-clean()
-os.symlink("slices", "linktoslices")
-os.symlink("dir1", os.path.join("slices", "linktodir1"))
-os.symlink("a3.ice", os.path.join("slices", "dir1", "linktoa3.ice"))
-os.symlink("dir2", os.path.join("slices", "linktodir2"))
-
-slice2cpp = TestUtil.getSliceTranslator()
-TestUtil.addLdPath(TestUtil.getCppLibDir())
-
-basedir = os.path.dirname(os.path.abspath(__file__))
-slicedir = TestUtil.getSliceDir()
-os.symlink(slicedir, "iceslices")
-
-def runTest(cmd):
- os.system(cmd)
- f = open("b.h")
- if not re.search('#include <dir1\/a1\.h>\n'
- '#include <linktodir1\/a2\.h>\n'
- '#include <linktodir1\/linktoa3\.h>\n'
- '#include <Ice\/Identity\.h>\n', f.read(), re.S):
- print("failed!")
- sys.exit(1)
- os.unlink("b.h")
- os.unlink("b.cpp")
-
-sys.stdout.write("compiling slice files and checking headers... ")
-sys.stdout.flush()
-runTest("%s -Iiceslices -Islices slices/dir2/b.ice" % (slice2cpp))
-runTest("%s -Iiceslices -I../headers/slices slices/dir2/b.ice" % (slice2cpp))
-runTest("%s -Iiceslices -Ilinktoslices slices/dir2/b.ice" % (slice2cpp))
-runTest("%s -Iiceslices -Ilinktoslices/../linktoslices slices/dir2/b.ice" % (slice2cpp))
-runTest("%s -I%s -Islices linktoslices/dir2/b.ice" % (slice2cpp, slicedir))
-runTest("%s -I%s -Ilinktoslices linktoslices/linktodir2/b.ice" % (slice2cpp, slicedir))
-
-# Also ensure it works with case insensitive file system
-if os.path.exists("SLICES"):
- runTest("%s -IICESLICES -ISLICES SLICES/DIR2/B.ice" % (slice2cpp))
- runTest("%s -IICESLICES -ILINKTOSLICES LINKTOSLICES/LINKTODIR2/B.ice" % (slice2cpp))
-
-#
-# Slice files are symlinks, include dir is a regular directory
-#
-os.system("mkdir -p project1/git/services.settings.slices")
-os.system("mkdir -p project1/src/services/settings")
-os.system("cd project1/src/services/settings && ln -s ../../../git/services.settings.slices slices")
-
-f = open("project1/git/services.settings.slices/A.ice", "w")
-f.write("// dumy file")
-f.close()
-f = open("project1/git/services.settings.slices/B.ice", "w")
-f.write("#include <services/settings/slices/A.ice>")
-f.close()
-
-os.system("cd project1 && %s -Isrc src/services/settings/slices/B.ice" % slice2cpp)
-f = open("project1/B.h")
-
-if not re.search(re.escape('#include <services/settings/slices/A.h>'), f.read()):
- print("failed!")
- sys.exit(1)
-
-clean()
-
-#
-# Slice file is regular file, include dir is a symlink to a second symlink
-#
-os.system("mkdir -p tmp/Ice-x.y.z/share")
-os.system("cd tmp/Ice-x.y.z/share && ln -s %s" % slicedir)
-
-
-os.system("mkdir -p project1/share")
-os.system("cd project1/share && ln -s %s/tmp/Ice-x.y.z/share/slice" % basedir)
-f = open("project1/A.ice", "w")
-f.write("#include <Ice/Identity.ice>")
-f.close()
-os.system("cd project1 && %s -Ishare/slice A.ice" % slice2cpp)
-f = open("project1/A.h")
-if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()):
- print("failed!")
- sys.exit(1)
-
-clean()
-
-#
-# Typical Ice install with symlink Ice-x.y -> Ice-x.y.z
-#
-os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice")
-os.system("cd tmp && ln -s Ice-x.y.z Ice-x.y")
-f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w")
-f.write("// dumy file")
-
-os.system("mkdir -p project1")
-f = open("project1/A.ice", "w")
-f.write("#include <Ice/Identity.ice>")
-f.close()
-os.system("cd project1 && %s -I%s/tmp/Ice-x.y/slice A.ice" % (slice2cpp, basedir))
-f = open("project1/A.h")
-if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()):
- print("failed!")
- sys.exit(1)
-
-clean()
-
-#
-# symlink directory with extra / at end
-#
-#
-os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice")
-os.system("mkdir -p tmp/Ice")
-os.system("cd tmp/Ice && ln -s ../Ice-x.y.z/slice/ .")
-f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w")
-f.write("// dumy file")
-f.close()
-os.system("mkdir -p project1")
-f = open("project1/A.ice", "w")
-f.write("#include <Ice/Identity.ice>")
-f.close()
-os.system("cd project1 && %s -I%s/tmp/Ice/slice A.ice" % (slice2cpp, basedir))
-f = open("project1/A.h")
-if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()):
- print("failed!2")
- sys.exit(1)
-clean()
-
-print("ok")
diff --git a/cpp/test/Slice/headers/test.py b/cpp/test/Slice/headers/test.py
new file mode 100644
index 00000000000..a5c169ede49
--- /dev/null
+++ b/cpp/test/Slice/headers/test.py
@@ -0,0 +1,154 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import glob
+
+class SliceHeadersTestCase(ClientTestCase):
+
+ def runClientSide(self, current):
+ self.clean()
+
+ slice2cpp = SliceTranslator("slice2cpp")
+
+ os.symlink("slices", "linktoslices")
+ os.symlink("dir1", os.path.join("slices", "linktodir1"))
+ os.symlink("a3.ice", os.path.join("slices", "dir1", "linktoa3.ice"))
+ os.symlink("dir2", os.path.join("slices", "linktodir2"))
+
+ basedir = self.testsuite.getPath()
+ slicedir = current.driver.getSliceDir()
+ os.symlink(slicedir, "iceslices")
+
+ def runTest(args):
+ slice2cpp.run(current, args=args.split(" "))
+ f = open("b.h")
+ if not re.search('#include <dir1\/a1\.h>\n'
+ '#include <linktodir1\/a2\.h>\n'
+ '#include <linktodir1\/linktoa3\.h>\n'
+ '#include <Ice\/Identity\.h>\n', f.read(), re.S):
+ raise RuntimeError("failed!")
+
+ os.unlink("b.h")
+ os.unlink("b.cpp")
+
+ current.write("compiling slice files and checking headers... ")
+ runTest("-Iiceslices -Islices slices/dir2/b.ice")
+ runTest("-Iiceslices -I../headers/slices slices/dir2/b.ice")
+ runTest("-Iiceslices -Ilinktoslices slices/dir2/b.ice")
+ runTest("-Iiceslices -Ilinktoslices/../linktoslices slices/dir2/b.ice")
+ runTest("-I%s -Islices linktoslices/dir2/b.ice" % slicedir)
+ runTest("-I%s -Ilinktoslices linktoslices/linktodir2/b.ice" % slicedir)
+
+ # Also ensure it works with case insensitive file system
+ if os.path.exists("SLICES"):
+ runTest("-IICESLICES -ISLICES SLICES/DIR2/B.ice")
+ runTest("-IICESLICES -ILINKTOSLICES LINKTOSLICES/LINKTODIR2/B.ice")
+
+ slice2cpp = slice2cpp.getCommandLine(current)
+
+ #
+ # Slice files are symlinks, include dir is a regular directory
+ #
+ os.system("mkdir -p project1/git/services.settings.slices")
+ os.system("mkdir -p project1/src/services/settings")
+ os.system("cd project1/src/services/settings && ln -s ../../../git/services.settings.slices slices")
+
+ f = open("project1/git/services.settings.slices/A.ice", "w")
+ f.write("// dumy file")
+ f.close()
+ f = open("project1/git/services.settings.slices/B.ice", "w")
+ f.write("#include <services/settings/slices/A.ice>")
+ f.close()
+
+ os.system("cd project1 && %s -Isrc src/services/settings/slices/B.ice" % slice2cpp)
+ f = open("project1/B.h")
+ if not re.search(re.escape('#include <services/settings/slices/A.h>'), f.read()):
+ raise RuntimeError("failed!")
+
+ self.clean()
+
+ #
+ # Slice file is regular file, include dir is a symlink to a second symlink
+ #
+ os.system("mkdir -p tmp/Ice-x.y.z/share")
+ os.system("cd tmp/Ice-x.y.z/share && ln -s %s" % slicedir)
+
+ os.system("mkdir -p project1/share")
+ os.system("cd project1/share && ln -s %s/tmp/Ice-x.y.z/share/slice" % basedir)
+ f = open("project1/A.ice", "w")
+ f.write("#include <Ice/Identity.ice>")
+ f.close()
+ os.system("cd project1 && %s -Ishare/slice A.ice" % slice2cpp)
+ f = open("project1/A.h")
+ if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()):
+ raise RuntimeError("failed!")
+
+ self.clean()
+
+ #
+ # Typical Ice install with symlink Ice-x.y -> Ice-x.y.z
+ #
+ os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice")
+ os.system("cd tmp && ln -s Ice-x.y.z Ice-x.y")
+ f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w")
+ f.write("// dumy file")
+
+ os.system("mkdir -p project1")
+ f = open("project1/A.ice", "w")
+ f.write("#include <Ice/Identity.ice>")
+ f.close()
+ os.system("cd project1 && %s -I%s/tmp/Ice-x.y/slice A.ice" % (slice2cpp, basedir))
+ f = open("project1/A.h")
+ if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()):
+ raise RuntimeError("failed!")
+
+ self.clean()
+
+ #
+ # symlink directory with extra / at end
+ #
+ #
+ os.system("mkdir -p tmp/Ice-x.y.z/slice/Ice")
+ os.system("mkdir -p tmp/Ice")
+ os.system("cd tmp/Ice && ln -s ../Ice-x.y.z/slice/ .")
+ f = open("tmp/Ice-x.y.z/slice/Ice/Identity.ice", "w")
+ f.write("// dumy file")
+ f.close()
+ os.system("mkdir -p project1")
+ f = open("project1/A.ice", "w")
+ f.write("#include <Ice/Identity.ice>")
+ f.close()
+ os.system("cd project1 && %s -I%s/tmp/Ice/slice A.ice" % (slice2cpp, basedir))
+ f = open("project1/A.h")
+ if not re.search(re.escape('#include <Ice/Identity.h>'), f.read()):
+ raise RuntimeError("failed!")
+ self.clean()
+
+ current.writeln("ok")
+
+ def teardownClientSide(self, current, success):
+ self.clean()
+
+ def clean(self):
+ for f in ["iceslices",
+ "linktoslices",
+ os.path.join("slices", "linktodir2"),
+ os.path.join("slices", "linktodir1"),
+ os.path.join("slices", "dir1", "linktoa3.ice")]:
+ if os.path.lexists(f):
+ os.unlink(f)
+
+ if os.path.exists("project1"): shutil.rmtree("project1")
+ if os.path.exists("tmp"): shutil.rmtree("tmp")
+
+if not isinstance(platform, Windows):
+ TestSuite(__name__, [ SliceHeadersTestCase() ], chdir=True)
+
+
diff --git a/cpp/test/Slice/keyword/Client.cpp b/cpp/test/Slice/keyword/Client.cpp
index 87f1556485b..661b0b223ac 100644
--- a/cpp/test/Slice/keyword/Client.cpp
+++ b/cpp/test/Slice/keyword/Client.cpp
@@ -170,7 +170,7 @@ testtypes()
int
run(const Ice::CommunicatorPtr& communicator)
{
- communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
+ communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default");
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
adapter->add(ICE_MAKE_SHARED(charI), Ice::stringToIdentity("test"));
adapter->activate();
diff --git a/cpp/test/Slice/keyword/run.py b/cpp/test/Slice/keyword/run.py
deleted file mode 100755
index d06758d0994..00000000000
--- a/cpp/test/Slice/keyword/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client)
diff --git a/cpp/test/Slice/macros/run.py b/cpp/test/Slice/macros/run.py
deleted file mode 100755
index d06758d0994..00000000000
--- a/cpp/test/Slice/macros/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client)
diff --git a/cpp/test/Slice/structure/run.py b/cpp/test/Slice/structure/run.py
deleted file mode 100755
index d06758d0994..00000000000
--- a/cpp/test/Slice/structure/run.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys
-
-path = [ ".", "..", "../..", "../../..", "../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client"))
-TestUtil.simpleTest(client)
diff --git a/cpp/test/Slice/unicodePaths/run.py b/cpp/test/Slice/unicodePaths/run.py
deleted file mode 100644
index c8f999a0cab..00000000000
--- a/cpp/test/Slice/unicodePaths/run.py
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# **********************************************************************
-#
-# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-#
-# This copy of Ice is licensed to you under the terms described in the
-# ICE_LICENSE file included in this distribution.
-#
-# **********************************************************************
-
-import os, sys, locale, shutil
-
-path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ]
-head = os.path.dirname(sys.argv[0])
-if len(head) > 0:
- path = [os.path.join(head, p) for p in path]
-path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
-if len(path) == 0:
- raise RuntimeError("can't find toplevel directory!")
-sys.path.append(os.path.join(path[0], "scripts"))
-import TestUtil
-
-def test(b):
- if not b:
- print("failed!")
- sys.exit(1)
-
-if TestUtil.isAIX() or TestUtil.isLinux():
- encoding = locale.getdefaultlocale()[1]
- if encoding != "UTF-8":
- print("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8")
- print("Skipping test")
- sys.exit(0)
-
-if sys.version_info[0] == 2 and TestUtil.isWin32():
- print("To run this test on Windows you need to be using Python 3.x")
- print("Python 2.x subprocess module doesn't support unicode on Windows")
- print("Skipping tes")
- sys.exit(0)
-
-sys.stdout.write("testing Slice compiler and unicode file paths... ")
-sys.stdout.flush()
-tests = [
- ("cpp", ["Test.cpp", "Test.h", "TestI.cpp", "TestI.h"], "--impl-c++11"),
- ("cpp", ["Test.cpp", "Test.h", "TestI.cpp", "TestI.h"], "--impl-c++98"),
- ("cs", ["Test.cs", "TestI.cs"], "--impl"),
- ("html", ["index.html"], ""),
- ("java", ["Test/Point.java", "Test/CanvasI.java"], "--impl"),
- ("js", ["Test.js"], ""),
- ("objc", ["Test.m"], ""),
- ("php", ["Test.php"], "")]
-
-#
-# Write config
-#
-if sys.version_info[0] == 2:
- srcPath = "./\xe4\xb8\xad\xe5\x9b\xbd".decode("utf-8")
-else:
- srcPath = "./\u4e2d\u56fd"
-if os.path.exists(srcPath):
- shutil.rmtree(srcPath)
-os.mkdir(srcPath)
-TestUtil.createFile("%s/Test.ice" % srcPath, ["module Test { ",
- "class Point{int x; int y; };",
- "interface Canvas{ void draw(Point p); };",
- "};"], "utf-8")
-
-for language, generated, args in tests:
- compiler = '%s' % TestUtil.getSliceTranslator(language)
- if not os.path.isfile(compiler):
- continue
- p = TestUtil.runCommand('"%s" %s/Test.ice --output-dir %s %s' % (compiler, srcPath, srcPath, args))
- test(p.wait() == 0)
- for f in generated:
- test(os.path.isfile(os.path.join(srcPath, f)))
- os.remove(os.path.join(srcPath, f))
-
-
-if os.path.exists(srcPath):
- shutil.rmtree(srcPath)
-print("ok")
diff --git a/cpp/test/Slice/unicodePaths/test.py b/cpp/test/Slice/unicodePaths/test.py
new file mode 100644
index 00000000000..95923fc10c2
--- /dev/null
+++ b/cpp/test/Slice/unicodePaths/test.py
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import shutil, locale
+
+class SliceUnicodePathsTestCase(ClientTestCase):
+
+ def runClientSide(self, current):
+
+ if isinstance(platform, Linux) or isinstance(platform, AIX):
+ encoding = locale.getdefaultlocale()[1]
+ if encoding != "UTF-8":
+ current.writeln("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8")
+ current.writeln("Skipping test")
+ return
+ elif isinstance(platform, Windows) and isPython2:
+ current.writeln("To run this test on Windows you need to be using Python 3.x")
+ current.writeln("Python 2.x subprocess module doesn't support unicode on Windows")
+ current.writeln("Skipping test")
+ return
+
+ current.write("testing Slice compiler and unicode file paths... ")
+
+ srcPath = "./\xe4\xb8\xad\xe5\x9b\xbd" if isPython2 else "./\u4e2d\u56fd"
+
+ if os.path.exists(srcPath): shutil.rmtree(srcPath)
+ os.mkdir(srcPath)
+
+ self.createFile("%s/Test.ice" % srcPath,
+ ["module Test { ",
+ "class Point{int x; int y; };",
+ "interface Canvas{ void draw(Point p); };",
+ "};"], "utf-8")
+
+ tests = [
+ ("cpp", ["Test.cpp", "Test.h", "TestI.cpp", "TestI.h"], "--impl-c++11"),
+ ("cpp", ["Test.cpp", "Test.h", "TestI.cpp", "TestI.h"], "--impl-c++98"),
+ ("cs", ["Test.cs", "TestI.cs"], "--impl"),
+ ("html", ["index.html"], ""),
+ ("java", ["Test/Point.java", "Test/CanvasI.java"], "--impl"),
+ ("js", ["Test.js"], ""),
+ ("objc", ["Test.m"], ""),
+ ("php", ["Test.php"], "")]
+
+ try:
+ for language, generated, args in tests:
+ compiler = SliceTranslator('slice2%s' % language)
+ if not os.path.isfile(compiler.getCommandLine(current)):
+ continue
+
+ args = [srcPath + "/Test.ice", "--output-dir", srcPath] + args.split(" ")
+ compiler.run(current, args=args)
+
+ for f in generated:
+ if not os.path.isfile(os.path.join(srcPath, f)):
+ raise RuntimeError("failed! (can't find {0})".format(os.path.join(srcPath, f)))
+ os.remove(os.path.join(srcPath, f))
+
+ current.writeln("ok")
+
+ finally:
+ if os.path.exists(srcPath): shutil.rmtree(srcPath)
+
+TestSuite(__name__, [ SliceUnicodePathsTestCase() ], chdir=True)
diff --git a/cpp/test/include/TestCommon.h b/cpp/test/include/TestCommon.h
index e8605f5c1b4..acc3b8d2152 100644
--- a/cpp/test/include/TestCommon.h
+++ b/cpp/test/include/TestCommon.h
@@ -18,6 +18,7 @@
#include <Ice/CommunicatorF.h>
#include <Ice/ProxyF.h>
+#include <Ice/Initialize.h>
#if defined(ICE_OS_WINRT) || (TARGET_OS_IPHONE)
# include <Ice/Initialize.h>
@@ -49,7 +50,12 @@ inline println(const std::string& msg)
std::cout << msg << std::endl;
}
-TEST_API std::string getTestEndpoint(const Ice::CommunicatorPtr&, int, const std::string = std::string());
+TEST_API std::string getTestEndpoint(const Ice::CommunicatorPtr&, int, const std::string& = std::string());
+TEST_API std::string getTestEndpoint(const Ice::PropertiesPtr&, int, const std::string& = std::string());
+TEST_API std::string getTestProtocol(const Ice::PropertiesPtr&);
+TEST_API std::string getTestHost(const Ice::PropertiesPtr&);
+TEST_API int getTestPort(const Ice::PropertiesPtr&, int);
+TEST_API Ice::InitializationData getTestInitData(int&, char*[]);
class TEST_API RemoteConfig
{