You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2016/04/26 05:52:35 UTC
[trafficserver] branch master updated: TS-4385: Improve cache test
debugging.
This is an automated email from the ASF dual-hosted git repository.
jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new dd06857 TS-4385: Improve cache test debugging.
dd06857 is described below
commit dd068570aa0356f4a22565747c88767cb3264d41
Author: James Peach <jp...@apache.org>
AuthorDate: Mon Apr 25 20:30:06 2016 -0700
TS-4385: Improve cache test debugging.
The "cache" regression tests consists of a collection of interdependent
test state machines, but there's no test-level debugging. Add some
logging to show when a test state machine is starting up.
This closes #601.
---
iocore/cache/CacheTest.cc | 45 ++++++++++++++++++++++++++++++---------------
iocore/cache/P_CacheTest.h | 15 ++++++++++++---
proxy/RegressionSM.cc | 33 +++++++++++++++++----------------
proxy/RegressionSM.h | 5 +++--
4 files changed, 62 insertions(+), 36 deletions(-)
diff --git a/iocore/cache/CacheTest.cc b/iocore/cache/CacheTest.cc
index c376baf..19bccde 100644
--- a/iocore/cache/CacheTest.cc
+++ b/iocore/cache/CacheTest.cc
@@ -29,13 +29,22 @@
using namespace std;
-CacheTestSM::CacheTestSM(RegressionTest *t)
- : RegressionSM(t), timeout(0), cache_action(0), start_time(0), cache_vc(0), cvio(0), buffer(0), buffer_reader(0), nbytes(-1),
- repeat_count(0), expect_event(EVENT_NONE), expect_initial_event(EVENT_NONE), initial_event(EVENT_NONE), content_salt(0)
+CacheTestSM::CacheTestSM(RegressionTest *t, const char *name)
+ : RegressionSM(t), cache_test_name(name), timeout(0), cache_action(0), start_time(0), cache_vc(0), cvio(0), buffer(0),
+ buffer_reader(0), nbytes(-1), repeat_count(0), expect_event(EVENT_NONE), expect_initial_event(EVENT_NONE),
+ initial_event(EVENT_NONE), content_salt(0)
{
SET_HANDLER(&CacheTestSM::event_handler);
}
+CacheTestSM::CacheTestSM(const CacheTestSM &ao) : RegressionSM(ao)
+{
+ int o = (int)(((char *)&start_memcpy_on_clone) - ((char *)this));
+ int s = (int)(((char *)&end_memcpy_on_clone) - ((char *)&start_memcpy_on_clone));
+ memcpy(((char *)this) + o, ((char *)&ao) + o, s);
+ SET_HANDLER(&CacheTestSM::event_handler);
+}
+
CacheTestSM::~CacheTestSM()
{
ink_assert(!cache_action);
@@ -270,14 +279,6 @@ CacheTestSM::complete(int event)
return EVENT_DONE;
}
-CacheTestSM::CacheTestSM(const CacheTestSM &ao) : RegressionSM(ao)
-{
- int o = (int)(((char *)&start_memcpy_on_clone) - ((char *)this));
- int s = (int)(((char *)&end_memcpy_on_clone) - ((char *)&start_memcpy_on_clone));
- memcpy(((char *)this) + o, ((char *)&ao) + o, s);
- SET_HANDLER(&CacheTestSM::event_handler);
-}
-
EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */, int *pstatus)
{
if (cacheProcessor.IsCacheEnabled() != CACHE_INITIALIZED) {
@@ -385,10 +386,24 @@ EXCLUSIVE_REGRESSION_TEST(cache)(RegressionTest *t, int /* atype ATS_UNUSED */,
pread_test.nbytes = 100;
pread_test.key = large_write_test.key;
- r_sequential(t, write_test.clone(), lookup_test.clone(), r_sequential(t, 10, read_test.clone()), remove_test.clone(),
- lookup_fail_test.clone(), read_fail_test.clone(), remove_fail_test.clone(), replace_write_test.clone(),
- replace_test.clone(), replace_read_test.clone(), large_write_test.clone(), pread_test.clone(), NULL_PTR)
- ->run(pstatus);
+ // clang-format off
+ r_sequential(t,
+ write_test.clone(),
+ lookup_test.clone(),
+ r_sequential(t, 10, read_test.clone()) /* run read_test 10 times */,
+ remove_test.clone(),
+ lookup_fail_test.clone(),
+ read_fail_test.clone(),
+ remove_fail_test.clone(),
+ replace_write_test.clone(),
+ replace_test.clone(),
+ replace_read_test.clone(),
+ large_write_test.clone(),
+ pread_test.clone(),
+ NULL_PTR)
+ ->run(pstatus);
+ // clang-format on
+
return;
}
diff --git a/iocore/cache/P_CacheTest.h b/iocore/cache/P_CacheTest.h
index f124230..dd8c32d 100644
--- a/iocore/cache/P_CacheTest.h
+++ b/iocore/cache/P_CacheTest.h
@@ -63,6 +63,10 @@ struct CacheTestHeader {
struct CacheTestSM : public RegressionSM {
int start_memcpy_on_clone; // place all variables to be copied between these markers
+
+ // Cache test instance name. This is a pointer to a string literal, so copying is safe.
+ const char *cache_test_name;
+
Action *timeout;
Action *cache_action;
ink_hrtime start_time;
@@ -113,12 +117,14 @@ struct CacheTestSM : public RegressionSM {
void
run()
{
+ rprintf(this->t, "running %s (%p)\n", this->cache_test_name, this);
SCOPED_MUTEX_LOCK(lock, mutex, this_ethread());
timeout = eventProcessor.schedule_imm(this);
}
+
virtual RegressionSM *clone() = 0;
- CacheTestSM(RegressionTest *t);
+ CacheTestSM(RegressionTest *t, const char *name);
CacheTestSM(const CacheTestSM &ao);
~CacheTestSM();
};
@@ -127,10 +133,13 @@ struct CacheTestSM : public RegressionSM {
#define CACHE_SM(_t, _sm, _f) \
struct CacheTestSM__##_sm : public CacheTestSM { \
void \
- make_request_internal() _f CacheTestSM__##_sm(RegressionTest *t) \
- : CacheTestSM(t) \
+ make_request_internal() _f \
+ \
+ CacheTestSM__##_sm(RegressionTest *t) \
+ : CacheTestSM(t, #_sm) \
{ \
} \
+ \
CacheTestSM__##_sm(const CacheTestSM__##_sm &xsm) : CacheTestSM(xsm) {} \
RegressionSM * \
clone() \
diff --git a/proxy/RegressionSM.cc b/proxy/RegressionSM.cc
index 2c2d5a5..8d02f83 100644
--- a/proxy/RegressionSM.cc
+++ b/proxy/RegressionSM.cc
@@ -96,7 +96,7 @@ RegressionSM::regression_sm_waiting(int /* event ATS_UNUSED */, void *data)
delete this;
return EVENT_DONE;
}
- if (par || nwaiting > 1) {
+ if (parallel || nwaiting > 1) {
((Event *)data)->schedule_in(REGRESSION_SM_RETRY);
return EVENT_CONT;
}
@@ -117,8 +117,8 @@ r_sequential(RegressionTest *t, RegressionSM *sm, ...)
RegressionSM *new_sm = new RegressionSM(t);
va_list ap;
va_start(ap, sm);
- new_sm->par = false;
- new_sm->rep = false;
+ new_sm->parallel = false;
+ new_sm->repeat = false;
new_sm->ichild = 0;
new_sm->nchildren = 0;
new_sm->nwaiting = 0;
@@ -135,8 +135,8 @@ RegressionSM *
r_sequential(RegressionTest *t, int an, RegressionSM *sm)
{
RegressionSM *new_sm = new RegressionSM(t);
- new_sm->par = false;
- new_sm->rep = true;
+ new_sm->parallel = false;
+ new_sm->repeat = true;
new_sm->ichild = 0;
new_sm->nchildren = 1;
new_sm->children(0) = sm;
@@ -151,8 +151,8 @@ r_parallel(RegressionTest *t, RegressionSM *sm, ...)
RegressionSM *new_sm = new RegressionSM(t);
va_list ap;
va_start(ap, sm);
- new_sm->par = true;
- new_sm->rep = false;
+ new_sm->parallel = true;
+ new_sm->repeat = false;
new_sm->ichild = 0;
new_sm->nchildren = 0;
new_sm->nwaiting = 0;
@@ -169,8 +169,8 @@ RegressionSM *
r_parallel(RegressionTest *t, int an, RegressionSM *sm)
{
RegressionSM *new_sm = new RegressionSM(t);
- new_sm->par = true;
- new_sm->rep = true;
+ new_sm->parallel = true;
+ new_sm->repeat = true;
new_sm->ichild = 0;
new_sm->nchildren = 1;
new_sm->children(0) = sm;
@@ -189,19 +189,20 @@ RegressionSM::run()
goto Lretry;
RegressionSM *x = 0;
while (ichild < n) {
- if (!rep)
+ if (!repeat) {
x = children[ichild];
- else {
- if (ichild != n - 1)
+ } else {
+ if (ichild != n - 1) {
x = children[(intptr_t)0]->clone();
- else
+ } else {
x = children[(intptr_t)0];
+ }
}
if (!ichild)
nwaiting++;
x->xrun(this);
ichild++;
- if (!par && nwaiting > 1)
+ if (!parallel && nwaiting > 1)
goto Lretry;
}
}
@@ -229,8 +230,8 @@ RegressionSM::RegressionSM(const RegressionSM &ao)
children(i) = o.children[i]->clone();
n = o.n;
ichild = o.ichild;
- par = o.par;
- rep = o.rep;
+ parallel = o.parallel;
+ repeat = o.repeat;
pending_action = o.pending_action;
ink_assert(status == REGRESSION_TEST_INPROGRESS);
ink_assert(nwaiting == 0);
diff --git a/proxy/RegressionSM.h b/proxy/RegressionSM.h
index 08399d2..78208f5 100644
--- a/proxy/RegressionSM.h
+++ b/proxy/RegressionSM.h
@@ -58,7 +58,8 @@ struct RegressionSM : public Continuation {
int nchildren;
DynArray<RegressionSM *> children;
intptr_t n, ichild;
- bool par, rep;
+ bool parallel;
+ bool repeat;
Action *pending_action;
int regression_sm_start(int event, void *data);
@@ -69,7 +70,7 @@ struct RegressionSM : public Continuation {
RegressionSM(RegressionTest *at = NULL)
: t(at), status(REGRESSION_TEST_INPROGRESS), pstatus(0), parent(0), nwaiting(0), nchildren(0), children(0), ichild(0),
- par(false), rep(false), pending_action(0)
+ parallel(false), repeat(false), pending_action(0)
{
mutex = new_ProxyMutex();
}
--
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].