summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/server/client-test.hpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-02-27 03:26:59 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-02-27 03:26:59 +0000
commit6f1d9dd9f40b000f03c209207e98d8a4469594bb (patch)
tree7f822db4fc92fa66f9ea97a862242b8124f9965b /sca-cpp/trunk/modules/server/client-test.hpp
parent352462dacc05290102a18fa77964998d68e6380d (diff)
Add options to use mmap or electric fence to check memory accesses, and fix a few memory access violations.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1294008 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/modules/server/client-test.hpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/sca-cpp/trunk/modules/server/client-test.hpp b/sca-cpp/trunk/modules/server/client-test.hpp
index 2dab7b6dfd..2207127e67 100644
--- a/sca-cpp/trunk/modules/server/client-test.hpp
+++ b/sca-cpp/trunk/modules/server/client-test.hpp
@@ -85,8 +85,9 @@ const bool testGetPerf() {
const bool testEval() {
gc_scoped_pool pool;
http::CURLSession ch("", "", "", "");
- const value val = content(http::evalExpr(mklist<value>(string("echo"), string("Hello")), testURI, ch));
- assert(val == string("Hello"));
+ const failable<value> r = http::evalExpr(mklist<value>(string("echo"), string("Hello")), testURI, ch);
+ assert(hasContent(r));
+ assert(content(r) == string("Hello"));
return true;
}
@@ -96,8 +97,9 @@ struct evalLoop {
evalLoop(const string& uri, http::CURLSession& ch) : uri(uri), ch(ch) {
}
const bool operator()() const {
- const value val = content(http::evalExpr(mklist<value>(string("echo"), string("Hello")), uri, ch));
- assert(val == string("Hello"));
+ const failable<value> r = http::evalExpr(mklist<value>(string("echo"), string("Hello")), uri, ch);
+ assert(hasContent(r));
+ assert(content(r) == string("Hello"));
return true;
}
};
@@ -111,8 +113,9 @@ struct blobEvalLoop {
blobEvalLoop(const string& uri, http::CURLSession& ch) : uri(uri), ch(ch) {
}
const bool operator()() const {
- const value val = content(http::evalExpr(mklist<value>(string("echo"), blobs), uri, ch));
- assert(val == blobs);
+ const failable<value> r = content(http::evalExpr(mklist<value>(string("echo"), blobs), uri, ch));
+ assert(hasContent(r));
+ assert(content(r) == blobs);
return true;
}
};
@@ -227,12 +230,12 @@ const bool checkPost(const list<future<bool> >& r) {
struct postThreadLoop {
const lambda<bool()> l;
+ worker& w;
const int threads;
- const gc_ptr<worker> w;
- postThreadLoop(const lambda<bool()>& l, const int threads) : l(l), threads(threads), w(new (gc_new<worker>()) worker(threads)) {
+ postThreadLoop(const lambda<bool()>& l, worker& w, const int threads) : l(l), w(w), threads(threads) {
}
const bool operator()() const {
- list<future<bool> > r = startPost(*w, threads, l);
+ list<future<bool> > r = startPost(w, threads, l);
checkPost(r);
return true;
}
@@ -242,6 +245,7 @@ const bool testPostThreadPerf() {
gc_scoped_pool pool;
const int count = 50;
const int threads = 10;
+ worker w(threads);
const list<value> i = list<value>() + "content" + (list<value>() + "item"
+ (list<value>() + "name" + string("Apple"))
@@ -252,7 +256,7 @@ const bool testPostThreadPerf() {
+ i);
const lambda<bool()> pl= curry(lambda<bool(const string, const int, const value)>(postThread), testURI, count, val);
- const lambda<bool()> ptl = postThreadLoop(pl, threads);
+ const lambda<bool()> ptl = postThreadLoop(pl, w, threads);
double t = time(ptl, 0, 1) / (threads * count);
cout << "ATOMPub POST thread test " << t << " ms" << endl;