From 6f1d9dd9f40b000f03c209207e98d8a4469594bb Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 27 Feb 2012 03:26:59 +0000 Subject: 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 --- sca-cpp/trunk/modules/server/client-test.hpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'sca-cpp/trunk/modules/server/client-test.hpp') 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(string("echo"), string("Hello")), testURI, ch)); - assert(val == string("Hello")); + const failable r = http::evalExpr(mklist(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(string("echo"), string("Hello")), uri, ch)); - assert(val == string("Hello")); + const failable r = http::evalExpr(mklist(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(string("echo"), blobs), uri, ch)); - assert(val == blobs); + const failable r = content(http::evalExpr(mklist(string("echo"), blobs), uri, ch)); + assert(hasContent(r)); + assert(content(r) == blobs); return true; } }; @@ -227,12 +230,12 @@ const bool checkPost(const list >& r) { struct postThreadLoop { const lambda l; + worker& w; const int threads; - const gc_ptr w; - postThreadLoop(const lambda& l, const int threads) : l(l), threads(threads), w(new (gc_new()) worker(threads)) { + postThreadLoop(const lambda& l, worker& w, const int threads) : l(l), w(w), threads(threads) { } const bool operator()() const { - list > r = startPost(*w, threads, l); + list > 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 i = list() + "content" + (list() + "item" + (list() + "name" + string("Apple")) @@ -252,7 +256,7 @@ const bool testPostThreadPerf() { + i); const lambda pl= curry(lambda(postThread), testURI, count, val); - const lambda ptl = postThreadLoop(pl, threads); + const lambda ptl = postThreadLoop(pl, w, threads); double t = time(ptl, 0, 1) / (threads * count); cout << "ATOMPub POST thread test " << t << " ms" << endl; -- cgit v1.2.3