Jon Foster wrote on Mon, Sep 20, 2010 at 10:48:44 +0100:
> Hi,
> 
> This patch changes the tests for the atomic-revprop feature, so that
> they test the error number rather than parsing the error text.
> This doesn't work with Serf or Neon yet - they're still TODO.  This
> gives you a way to test Serf & Neon patches.  (You might like to
> hold off on committing this until Serf and Neon are done).
> 
> The patch is against the atomic-revprop branch, and requires
> Patch 1 to be applied first.  It doesn't apply to trunk (I don't
> think the tests have been merged to trunk?)
> 

On trunk there are only the libsvn_fs and libsvn_repos parts.  The
libsvn_ra parts, and the associated Python tests, are only on the
branch.

> [[[
> Change atomic-revprop tests to look at the error number rather
> than parsing the error text.
> 
> * subversion/tests/cmdline/atomic-ra-revprop-change.c:
>   (main): When printing an error, check if it's SVN_ERR_BAD_OLD_VALUE
>           and print a special message if it is.
> 
> * subversion/tests/cmdline/prop_tests.py:
>   (FAILS_WITH_BPV): Look for the special message.
> 
> Patch by: Jon Foster <jon.fos...@cabot.co.uk>
> ]]]
> 

So, this is trying to capture the current ra_dav situation, where the
err->message is correct but err->apr_err isn't?  (and will make the test
fail over ra_neon/ra_serf)

In other news, I've been thinking about moving the entire validation
logic to the C helper; that is, to have it get an extra argv argument
saying whether the revpropchange should pass or fail, and test by itself
that it passed/failed as expected; and the Python tests would always
expect it to exit(0).  What do you think?

> Index: subversion/tests/cmdline/atomic-ra-revprop-change.c
> ===================================================================
> --- subversion/tests/cmdline/atomic-ra-revprop-change.c       (revision 
> 998620)
> +++ subversion/tests/cmdline/atomic-ra-revprop-change.c       (working copy)
> @@ -226,6 +226,8 @@
>                          http_library, pool);
>    if (err)
>      {
> +      if (svn_error_has_cause(err, SVN_ERR_BAD_OLD_VALUE))
> +        fprintf(stderr, "atomic-ra-revprop-change failed due to incorrect 
> old value.\n");

Or even more directly:

- if (err)
+ if (err && err->apr_err == SVN_ERR_BAD_OLD_VALUE)

>        svn_handle_error2(err, stderr, FALSE, "atomic-ra-revprop-change: ");
>        svn_error_clear(err);
>        exit_code = EXIT_FAILURE;

Reply via email to