Author: gstein
Date: Wed Jul 20 08:08:22 2011
New Revision: 1148644
URL: http://svn.apache.org/viewvc?rev=1148644&view=rev
Log:
Continued tweaks for the pushback testing. In particular, identify what
the parser is being used for. This can assist with debugging (if other
setups begin to efine it), but it is the key for which the new testing
decides whether to activate the testing regimen.
* subversion/libsvn_ra_serf/ra_serf.h:
(svn_ra_serf__xml_parser_t): add RESPONSE_TYPE member
* subversion/libsvn_ra_serf/update.c:
(finish_report): initialize the new RESPONSE_TYPE member
* subversion/libsvn_ra_serf/util.c:
(svn_ra_serf__process_pending): refine the debug output.
(svn_ra_serf__handle_xml_parser): examine RESPONSE_TYPE to decide
whether to begin the testing regimen. adjust some of the debug output.
use the new code if PBTEST_ACTIVE is defined (rather than the old
DISABLE_THIS_FOR_NOW define)
Modified:
subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
subversion/trunk/subversion/libsvn_ra_serf/update.c
subversion/trunk/subversion/libsvn_ra_serf/util.c
Modified: subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h?rev=1148644&r1=1148643&r2=1148644&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/ra_serf.h Wed Jul 20 08:08:22
2011
@@ -535,6 +535,10 @@ struct svn_ra_serf__xml_parser_t {
/* Temporary allocations should be made in this pool. */
apr_pool_t *pool;
+ /* What kind of response are we parsing? If set, this should typically
+ define the report name. */
+ const char *response_type;
+
/* Caller-specific data passed to the start, end, cdata callbacks. */
void *user_data;
Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1148644&r1=1148643&r2=1148644&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Wed Jul 20 08:08:22 2011
@@ -2324,6 +2324,7 @@ finish_report(void *report_baton,
parser_ctx = apr_pcalloc(pool, sizeof(*parser_ctx));
parser_ctx->pool = pool;
+ parser_ctx->response_type = "update-report";
parser_ctx->user_data = report;
parser_ctx->start = start_report;
parser_ctx->end = end_report;
Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1148644&r1=1148643&r2=1148644&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Wed Jul 20 08:08:22 2011
@@ -1499,7 +1499,12 @@ svn_ra_serf__process_pending(svn_ra_serf
PBTEST_SET_PAUSED(parser);
#ifdef PBTEST_ACTIVE
- SVN_DBG(("process: paused=%d\n", parser->paused));
+ /* If this step should not inject content, then fast-path exit. */
+ if (pbtest_step < 14 && !pbtest_description[pbtest_step].inject)
+ {
+ SVN_DBG(("PBTEST: process: injection disabled\n"));
+ return SVN_NO_ERROR;
+ }
#endif
/* Fast path exit: already paused, or nothing to do. */
@@ -1674,9 +1679,13 @@ svn_ra_serf__handle_xml_parser(serf_requ
XML_SetCharacterDataHandler(ctx->xmlp, cdata_xml);
}
- /* This is the first invocation. Possibly move to step 1 of the
- testing sequence. */
- PBTEST_MAYBE_STEP(ctx);
+ /* This is the first invocation. If we're looking at an update
+ report, then move to step 1 of the testing sequence. */
+#ifdef PBTEST_ACTIVE
+ if (ctx->response_type != NULL
+ && strcmp(ctx->response_type, "update-report") == 0)
+ PBTEST_MAYBE_STEP(ctx);
+#endif
}
/* If we are storing content into a spill file, then move to the end of
@@ -1698,10 +1707,6 @@ svn_ra_serf__handle_xml_parser(serf_requ
status = serf_bucket_read(response, PARSE_CHUNK_SIZE, &data, &len);
-#ifdef PBTEST_ACTIVE
- SVN_DBG(("response: len=%d\n", (int)len));
-#endif
-
if (SERF_BUCKET_READ_ERROR(status))
{
return svn_error_wrap_apr(status, NULL);
@@ -1711,6 +1716,12 @@ svn_ra_serf__handle_xml_parser(serf_requ
the flag. */
PBTEST_SET_PAUSED(ctx);
+#ifdef PBTEST_ACTIVE
+ SVN_DBG(("response: len=%d paused=%d status=%08x\n",
+ (int)len, ctx->paused, status));
+ SVN_DBG(("content=%s\n", data));
+#endif
+
/* Note: once the callbacks invoked by inject_to_parser() sets the
PAUSED flag, then it will not be cleared. write_to_pending() will
only save the content. Logic outside of serf_context_run() will
@@ -1720,7 +1731,7 @@ svn_ra_serf__handle_xml_parser(serf_requ
We want to save arriving content into the PENDING structures if
the parser has been paused, or we already have data in there (so
the arriving data is appended, rather than injected out of order) */
-#ifdef DISABLE_THIS_FOR_NOW
+#ifdef PBTEST_ACTIVE
if (ctx->paused || HAS_PENDING_DATA(ctx->pending))
{
err = write_to_pending(ctx, data, len, pool);