On Wed, Jul 1, 2015 at 4:13 AM, Bert Huijben <b...@qqmail.nl> wrote:

>  It looks like this patch accidentally removes a line from the test?
>

Nope, that was intentional (as mentioned in the commit message).
Best case, patch_format is a no-op for non-shareded repos.
Worst case, it messes up the format file (should never happen, but ...)

-- Stefan^2.


>
>
> *From:* Stefan Fuhrmann <stef...@apache.org>
> *Sent:* ‎Tuesday‎, ‎June‎ ‎30‎, ‎2015 ‎9‎:‎50‎ ‎PM
> *To:* commits@subversion.apache.org
>
> Author: stefan2
> Date: Tue Jun 30 19:50:46 2015
> New Revision: 1688511
>
> URL: http://svn.apache.org/r1688511
> Log:
> Fix svnadmin_tests.py 52 failures with pre-cooked repositories.
>
> Reported by: brane
>
> * subversion/tests/cmdline/svnadmin_tests.py
>   (is_sharded): New utility function.
>   (fsfs_pack_non_sharded): Skip test if the repo is sharded after all.
>                            Also get rid of the useless patch_format call.
>
> Modified:
>     subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py
>
> Modified: subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py?rev=1688511&r1=1688510&r2=1688511&view=diff
>
> ==============================================================================
> --- subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py (original)
> +++ subversion/trunk/subversion/tests/cmdline/svnadmin_tests.py Tue Jun 30
> 19:50:46 2015
> @@ -249,6 +249,18 @@ def patch_format(repo_dir, shard_size):
>    os.chmod(format_path, 0666)
>    open(format_path, 'wb').write(new_contents)
>
> +def is_sharded(repo_dir):
> +  """Return whether the FSFS repository REPO_DIR is sharded."""
> +
> +  format_path = os.path.join(repo_dir, "db", "format")
> +  contents = open(format_path, 'rb').read()
> +
> +  for line in contents.split("\n"):
> +    if line.startswith("layout sharded"):
> +      return True
> +
> +  return False
> +
>  def load_and_verify_dumpstream(sbox, expected_stdout, expected_stderr,
>                                 revs, check_props, dump, *varargs):
>    """Load the array of lines passed in DUMP into the current tests'
> @@ -3074,7 +3086,10 @@ def fsfs_pack_non_sharded(sbox):
>    # Configure two files per shard to trigger packing.
>    sbox.build(create_wc = False,
>               minor_version =
> min(svntest.main.options.server_minor_version,3))
> -  patch_format(sbox.repo_dir, shard_size=2)
> +
> +  # Skip for pre-cooked sharded repositories
> +  if is_sharded(sbox.repo_dir):
> +    raise svntest.Skip('sharded pre-cooked repository')
>
>    svntest.actions.run_and_verify_svnadmin(
>        None, [], "upgrade", sbox.repo_dir)
>
>
>

Reply via email to