You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/07/17 13:23:39 UTC
svn commit: r965054 - in /subversion/branches/atomic-revprop: ./
subversion/tests/cmdline/ subversion/tests/cmdline/svntest/
Author: danielsh
Date: Sat Jul 17 11:23:38 2010
New Revision: 965054
URL: http://svn.apache.org/viewvc?rev=965054&view=rev
Log:
On the 'atomic-revprop' branch:
Add an XFail test for the 'atomically change a revprop over RA' functionality.
* subversion/tests/cmdline/prop_tests.py
(atomic_over_ra): New XFail test.
(test_list): Run it.
* subversion/tests/cmdline/atomic-ra-revprop-change.c:
New utility, wraps svn_ra_change_rev_prop().
* build.conf (atomic-ra-revprop-change): Add (copied from entries-dump).
* subversion/tests/cmdline/
(svn:ignore): Add atomic-ra-revprop-change.
* subversion/tests/cmdline/svntest/actions.py
(run_and_verify_atomic_ra_revprop_change):
New function, wraps the atomic-ra-revprop-change utility.
* subversion/tests/cmdline/svntest/main.py
(atomic_ra_revprop_change_binary,
run_atomic_ra_revprop_change):
New functions, representing the atomic-ra-revprop-change utility.
Added:
subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
Modified:
subversion/branches/atomic-revprop/build.conf
subversion/branches/atomic-revprop/subversion/tests/cmdline/ (props changed)
subversion/branches/atomic-revprop/subversion/tests/cmdline/prop_tests.py
subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/actions.py
subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/main.py
Modified: subversion/branches/atomic-revprop/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/build.conf?rev=965054&r1=965053&r2=965054&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/build.conf (original)
+++ subversion/branches/atomic-revprop/build.conf Sat Jul 17 11:23:38 2010
@@ -981,6 +981,15 @@ install = test
libs = libsvn_wc libsvn_subr apriconv apr
testing = skip
+[atomic-ra-revprop-change]
+type = exe
+path = subversion/tests/cmdline
+sources = atomic-ra-revprop-change.c
+install = test
+libs = libsvn_ra libsvn_subr apriconv apr
+testing = skip
+
+
# ----------------------------------------------------------------------------
#
@@ -1082,7 +1091,7 @@ libs = __ALL__
diff-diff3-test
ra-local-test
svndiff-test vdelta-test
- entries-dump
+ entries-dump atomic-ra-revprop-change
diff-test diff3-test diff4-test
client-test
tree-conflict-data-test db-test pristine-store-test entries-compat-test
Propchange: subversion/branches/atomic-revprop/subversion/tests/cmdline/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sat Jul 17 11:23:38 2010
@@ -6,4 +6,5 @@ httpd-*
*~
.*~
entries-dump
+atomic-ra-revprop-change
.libs
Added: subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c?rev=965054&view=auto
==============================================================================
--- subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c (added)
+++ subversion/branches/atomic-revprop/subversion/tests/cmdline/atomic-ra-revprop-change.c Sat Jul 17 11:23:38 2010
@@ -0,0 +1,116 @@
+/*
+ * atomic-ra-revprop-change.c : wrapper around svn_ra_change_rev_prop2()
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <apr_pools.h>
+#include <apr_general.h>
+
+#include "svn_types.h"
+#include "svn_pools.h"
+#include "svn_dirent_uri.h"
+#include "svn_ra.h"
+
+#include "svn_private_config.h"
+
+
+static svn_error_t *
+change_rev_prop(const char *url,
+ svn_revnum_t revision,
+ const char *propname,
+ const svn_string_t *propval,
+ const svn_string_t *old_value,
+ apr_pool_t *pool)
+{
+ svn_ra_session_t *sess;
+ svn_ra_callbacks2_t *callbacks;
+
+ SVN_ERR(svn_ra_create_callbacks(&callbacks, pool));
+ /* No need to fill callbacks->auth_baton or any other callbacks. */
+
+ SVN_ERR(svn_ra_open3(&sess, url, NULL, callbacks, NULL /* baton */,
+ NULL /* config */, pool));
+
+ /* XXX: pass OLD_PROPVAL here */
+ SVN_ERR(svn_ra_change_rev_prop(sess, revision, propname, propval, pool));
+
+ return SVN_NO_ERROR;
+}
+
+
+int
+main(int argc, const char *argv[])
+{
+ apr_pool_t *pool;
+ int exit_code = EXIT_SUCCESS;
+ svn_error_t *err;
+ const char *url;
+ svn_revnum_t revision;
+ const char *propname;
+ svn_string_t *propval;
+ svn_string_t *old_propval;
+ char *digits_end = NULL;
+
+ if (argc != 6)
+ {
+ printf("USAGE: %s URL REVISION PROPNAME PROPVAL OLDPROPVAL\n");
+ exit(1);
+ }
+
+ if (apr_initialize() != APR_SUCCESS)
+ {
+ printf("apr_initialize() failed.\n");
+ exit(1);
+ }
+
+ /* set up the global pool */
+ pool = svn_pool_create(NULL);
+
+ /* Parse argv. */
+ url = svn_uri_canonicalize(argv[1], pool);
+ revision = strtol(argv[2], &digits_end, 10);
+ propname = argv[3];
+ propval = svn_string_create(argv[4], pool);
+ old_propval = svn_string_create(argv[5], pool);
+
+ if ((! SVN_IS_VALID_REVNUM(revision)) || (! digits_end) || *digits_end)
+ SVN_INT_ERR(svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Invalid revision number supplied")));
+
+ /* Do something. */
+ err = change_rev_prop(url, revision, propname, propval, old_propval, pool);
+ if (err)
+ {
+ svn_handle_error2(err, stderr, FALSE, "atomic-ra-revprop-change: ");
+ svn_error_clear(err);
+ exit_code = EXIT_FAILURE;
+ }
+
+ /* Clean up, and get outta here */
+ svn_pool_destroy(pool);
+ apr_terminate();
+
+ exit(exit_code);
+ return exit_code;
+}
Modified: subversion/branches/atomic-revprop/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/tests/cmdline/prop_tests.py?rev=965054&r1=965053&r2=965054&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/branches/atomic-revprop/subversion/tests/cmdline/prop_tests.py Sat Jul 17 11:23:38 2010
@@ -1961,6 +1961,28 @@ def obstructed_subdirs(sbox):
svntest.actions.run_and_verify_status(wc_dir, expected_status)
+def atomic_over_ra(sbox):
+ "test revprop atomicity guarantees of libsvn_ra"
+
+ sbox.build(create_wc=False)
+ repo_url = sbox.repo_url
+
+ # Set some property.
+ svntest.actions.enable_revprop_changes(sbox.repo_dir)
+ svntest.actions.run_and_verify_svn(None, None, [],
+ 'propset', '--revprop', '-r', '0',
+ 'state', 'old', repo_url)
+
+ # Attempt to change it, unsuccessfully.
+ expected_stderr = ".*revprop 'state' has unexpected value.*"
+ svntest.actions.run_and_verify_atomic_ra_revprop_change(
+ None, None, expected_stderr, 1, repo_url, 0, 'state', 'new', 'not old')
+
+ # Attempt to change it, successfully.
+ svntest.actions.run_and_verify_atomic_ra_revprop_change(
+ None, None, [], 0, repo_url, 0, 'state', 'new', 'old')
+
+
########################################################################
# Run the tests
@@ -2004,6 +2026,7 @@ test_list = [ None,
rm_of_replaced_file,
prop_reject_grind,
obstructed_subdirs,
+ XFail(atomic_over_ra),
]
if __name__ == '__main__':
Modified: subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/actions.py?rev=965054&r1=965053&r2=965054&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/actions.py Sat Jul 17 11:23:38 2010
@@ -141,6 +141,22 @@ def guarantee_greek_repository(path):
main.chmod_tree(path, 0666, 0666)
+def run_and_verify_atomic_ra_revprop_change(message,
+ expected_stdout,
+ expected_stderr,
+ expected_exit,
+ url, revision, propname,
+ propval, old_propval):
+ """Run atomic-ra-revprop-change helper and check its output and exit code."""
+
+ exit_code, out, err = main.run_atomic_ra_revprop_change(url, revision, propname,
+ propval, old_propval)
+ verify.verify_outputs("Unexpected output", out, err,
+ expected_stdout, expected_stderr)
+ verify.verify_exit_code(message, exit_code, expected_exit)
+ return exit_code, out, err
+
+
def run_and_verify_svnlook(message, expected_stdout,
expected_stderr, *varargs):
"""Like run_and_verify_svnlook2, but the expected exit code is
Modified: subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/main.py?rev=965054&r1=965053&r2=965054&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/branches/atomic-revprop/subversion/tests/cmdline/svntest/main.py Sat Jul 17 11:23:38 2010
@@ -157,6 +157,8 @@ svnversion_binary = os.path.abspath('../
svndumpfilter_binary = os.path.abspath('../../svndumpfilter/svndumpfilter' + \
_exe)
entriesdump_binary = os.path.abspath('entries-dump' + _exe)
+atomic_ra_revprop_change_binary = os.path.abspath('atomic-ra-revprop-change' + \
+ _exe)
# Location to the pristine repository, will be calculated from test_area_url
# when we know what the user specified for --url.
@@ -606,6 +608,18 @@ def run_entriesdump(path):
return entries
+def run_atomic_ra_revprop_change(url, revision, propname, propval, old_propval):
+ """Run the atomic-ra-revprop-change helper, returning its exit code, stdout,
+ and stderr."""
+ # use spawn_process rather than run_command to avoid copying all the data
+ # to stdout in verbose mode.
+ #exit_code, stdout_lines, stderr_lines = spawn_process(entriesdump_binary,
+ # 0, 0, None, path)
+
+ return run_command(atomic_ra_revprop_change_binary, True, False,
+ url, revision, propname, propval, old_propval)
+
+
# Chmod recursively on a whole subtree
def chmod_tree(path, mode, mask):
for dirpath, dirs, files in os.walk(path):