summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/operations/AllTests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/Ice/operations/AllTests.cpp')
-rw-r--r--cpp/test/Ice/operations/AllTests.cpp59
1 files changed, 55 insertions, 4 deletions
diff --git a/cpp/test/Ice/operations/AllTests.cpp b/cpp/test/Ice/operations/AllTests.cpp
index 56b168a5b97..ddf4fb6268e 100644
--- a/cpp/test/Ice/operations/AllTests.cpp
+++ b/cpp/test/Ice/operations/AllTests.cpp
@@ -12,6 +12,12 @@
#include <TestCommon.h>
#include <Test.h>
+#ifdef WIN32
+# include <sys/timeb.h>
+#else
+# include <sys/time.h>
+#endif
+
using namespace std;
Test::MyClassPrx
@@ -20,7 +26,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
string ref;
Ice::PropertiesPtr properties = communicator->getProperties();
-
+
+ string address = properties->getProperty("Ice.Address");
string protocol = properties->getProperty("Ice.Protocol");
string secure;
@@ -34,12 +41,28 @@ allTests(const Ice::CommunicatorPtr& communicator)
secure = " -s ";
}
- string endpts = protocol + " -p 12345 -t 2000";
+ string endpts = protocol + " -p 12345 -t 2000";
+
+ if (!address.empty())
+ {
+ endpts += " -h " + address;
+ }
ref = "test" + secure + ":" + endpts;
+
+ cout << "ref: " << ref << endl;
- cout << "testing stringToProxy... " << flush;
-
+ timeval tv1;
+#ifdef WIN32
+ struct _timeb tb1;
+ _ftime(&tb1);
+ tv1.tv_sec = tb1.time;
+ tv1.tv_usec = tb1.millitm * 1000;
+#else
+ gettimeofday(&tv1, 0);
+#endif
+
+ cout << "testing stringToProxy... " << flush;
Ice::ObjectPrx base = communicator->stringToProxy(ref);
test(base);
cout << "ok" << endl;
@@ -61,5 +84,33 @@ allTests(const Ice::CommunicatorPtr& communicator)
derived->opDerived();
cout << "ok" << endl;
+ timeval tv2;
+#ifdef WIN32
+ struct _timeb tb2;
+ _ftime(&tb2);
+ tv2.tv_sec = tb2.time;
+ tv2.tv_usec = tb2.millitm * 1000;
+#else
+ gettimeofday(&tv2, 0);
+#endif
+
+ timeval tv;
+
+ tv.tv_sec = tv2.tv_sec - tv1.tv_sec;
+ tv.tv_usec = tv2.tv_usec - tv1.tv_usec;
+
+ tv.tv_sec += tv.tv_usec / 1000000;
+ tv.tv_usec = tv.tv_usec % 1000000;
+
+ if (tv.tv_usec < 0)
+ {
+ tv.tv_usec += 1000000;
+ tv.tv_sec -= 1;
+ }
+
+ double total = (tv.tv_sec * 1000000.0 + tv.tv_usec) / 1000.0;
+
+ cout << "elapsed time " << total << "ms" << endl;
+
return cl;
}