[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r27036 - trunk/subversion/tests/cmdline

From: David Glasser <glasser_at_davidglasser.net>
Date: 2007-10-09 15:17:19 CEST

Blair, this rev breaks test 8 for me:

dhcp-172-19-36-49:~/Projects/Subversion/svn-trunk/subversion/tests/cmdline
glasser$ ./externals_tests.py 8
UNEXPECTED EXCEPTION:
Traceback (most recent call last):
  File "/Users/glasser/Projects/Subversion/svn-trunk/subversion/tests/cmdline/svntest/main.py",
line 930, in run
    rc = apply(self.pred.run, (), kw)
  File "/Users/glasser/Projects/Subversion/svn-trunk/subversion/tests/cmdline/svntest/testcase.py",
line 121, in run
    return self.func(sandbox)
  File "./externals_tests.py", line 684, in
disallow_dot_or_dotdot_directory_reference
    set_externals_for_path_expect_error(B_path, externals_value_1, wc_dir)
  File "./externals_tests.py", line 653, in set_externals_for_path_expect_error
    svntest.main.file_append(tmp_f, val)
  File "/Users/glasser/Projects/Subversion/svn-trunk/subversion/tests/cmdline/svntest/main.py",
line 478, in file_append
    file_write(path, new_text, 'a') # open in (a)ppend mode
  File "/Users/glasser/Projects/Subversion/svn-trunk/subversion/tests/cmdline/svntest/main.py",
line 489, in file_write
    fp = open(path, mode)
IOError: [Errno 2] No such file or directory:
'svn-test-work/working_copies/externals_tests-8/tmpAsfgXu'
FAIL: externals_tests.py 8: error if external target dir involves '.' or '..'

--dave

On 10/8/07, blair@tigris.org <blair@tigris.org> wrote:
> Author: blair
> Date: Mon Oct 8 20:59:07 2007
> New Revision: 27036
>
> Log:
> Prepare the externals_tests.py file for testing relative URLs by
> having externals_test_setup() return a dictionary keyed by the
> directory created by the external with the external URL as the value.
> The users of externals_test_setup() now use the dictionary to get the
> URLs instead of manually constructing the URLs.
>
> This allows externals_test_setup() to set up different URL styles,
> absolute and different relatives.
>
> * subversion/tests/cmdline/externals_tests.py
> (externals_test_setup):
> Construct and return a dictionary keyed by the directory name
> created by the external and the external's URL.
> (update_receive_new_external),
> (update_lose_external),
> (update_change_pristine_external),
> (update_change_modified_external),
> (modify_and_update_receive_new_external),
> (external_with_peg_and_op_revision),
> (new_style_externals),
> (old_style_externals_ignore_peg_reg):
> Instead of using
> other_repo_url + "some/path"
> use
> external_url_for["some/path"]
> This ends up having all the tests use the same URLs, as there were
> some inconsistencies, such as "scheme://host/some/path" and
> "scheme://host/some/path/".
> (disallow_dot_or_dotdot_directory_reference):
> Cycle through the URLs from externals_test_setup() instead of a
> single URL to test.
>
>
> Modified:
> trunk/subversion/tests/cmdline/externals_tests.py
>
> Modified: trunk/subversion/tests/cmdline/externals_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/externals_tests.py?pathrev=27036&r1=27035&r2=27036
> ==============================================================================
> --- trunk/subversion/tests/cmdline/externals_tests.py (original)
> +++ trunk/subversion/tests/cmdline/externals_tests.py Mon Oct 8 20:59:07 2007
> @@ -61,6 +61,9 @@
> exdir_A/G <scheme>:///<other_repos>/A/D/G
> exdir_A/H -r 3 <scheme>:///<other_repos>/A/D/H
> x/y/z/blah <scheme>:///<other_repos>/A/B
> +
> + A dictionary is returned keyed by the directory created by the
> + external whose value is the URL of the external.
> """
>
> # The test itself will create a working copy
> @@ -134,10 +137,16 @@
> # of random stuff, with no svn:externals props set yet.
> svntest.main.copy_repos(repo_dir, other_repo_dir, 5)
>
> + # This is the returned dictionary.
> + external_url_for = { }
> +
> + external_url_for["A/C/exdir_G"] = other_repo_url + "/A/D/G"
> + external_url_for["A/C/exdir_H"] = other_repo_url + "/A/D/H"
> +
> # Set up the externals properties on A/B/ and A/D/.
> externals_desc = \
> - "exdir_G " + other_repo_url + "/A/D/G" + "\n" + \
> - "exdir_H -r 1 " + other_repo_url + "/A/D/H" + "\n"
> + "exdir_G " + external_url_for["A/C/exdir_G"] + "\n" + \
> + "exdir_H -r 1 " + external_url_for["A/C/exdir_H"] + "\n"
>
> tmp_f = os.tempnam(wc_init_dir, 'tmp')
> svntest.main.file_append(tmp_f, externals_desc)
> @@ -149,14 +158,19 @@
>
> os.remove(tmp_f)
>
> + external_url_for["A/D/exdir_A"] = other_repo_url + "/A"
> + external_url_for["A/D/exdir_A/G/"] = other_repo_url + "/A/D/G/"
> + external_url_for["A/D/exdir_A/H"] = other_repo_url + "/A/D/H"
> + external_url_for["A/D/x/y/z/blah"] = other_repo_url + "/A/B"
> +
> externals_desc = \
> - "exdir_A " + other_repo_url + "/A" + \
> - "\n" + \
> - "exdir_A/G/ " + other_repo_url + "/A/D/G/" + \
> - "\n" + \
> - "exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
> - "\n" + \
> - "x/y/z/blah " + other_repo_url + "/A/B" + \
> + "exdir_A " + external_url_for["A/D/exdir_A"] + \
> + "\n" + \
> + "exdir_A/G/ " + external_url_for["A/D/exdir_A/G/"] + \
> + "\n" + \
> + "exdir_A/H -r 1 " + external_url_for["A/D/exdir_A/H"] + \
> + "\n" + \
> + "x/y/z/blah " + external_url_for["A/D/x/y/z/blah"] + \
> "\n"
>
> svntest.main.file_append(tmp_f, externals_desc)
> @@ -181,6 +195,7 @@
> None, None, None, None, None,
> wc_init_dir)
>
> + return external_url_for
>
> def change_external(path, new_val):
> """Change the value of the externals property on PATH to NEW_VAL,
> @@ -274,7 +289,7 @@
> def update_receive_new_external(sbox):
> "update to receive a new external module"
>
> - externals_test_setup(sbox)
> + external_url_for = externals_test_setup(sbox)
> wc_dir = sbox.wc_dir
>
> other_wc_dir = sbox.add_wc_path('other')
> @@ -298,15 +313,15 @@
> # Add one new external item to the property on A/D. The new item is
> # "exdir_E", deliberately added in the middle not at the end.
> new_externals_desc = \
> - "exdir_A " + other_repo_url + "/A" + \
> + "exdir_A " + external_url_for["A/D/exdir_A"] + \
> "\n" + \
> - "exdir_A/G " + other_repo_url + "/A/D/G" + \
> + "exdir_A/G/ " + external_url_for["A/D/exdir_A/G/"] + \
> "\n" + \
> "exdir_E " + other_repo_url + "/A/B/E" + \
> "\n" + \
> - "exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
> + "exdir_A/H -r 1 " + external_url_for["A/D/exdir_A/H"] + \
> "\n" + \
> - "x/y/z/blah " + other_repo_url + "/A/B/E" + \
> + "x/y/z/blah " + external_url_for["A/D/x/y/z/blah"] + \
> "\n"
>
> # Set and commit the property
> @@ -322,7 +337,7 @@
> def update_lose_external(sbox):
> "update to lose an external module"
>
> - externals_test_setup(sbox)
> + external_url_for = externals_test_setup(sbox)
> wc_dir = sbox.wc_dir
>
> other_wc_dir = sbox.add_wc_path('other')
> @@ -360,11 +375,11 @@
> # A/D/exdir_A/H/... A/D/exdir_A/H/...
>
> new_externals_desc = \
> - "exdir_A/G " + other_repo_url + "/A/D/G" + \
> + "exdir_A/G " + external_url_for["A/D/exdir_A/G/"] + \
> "\n" + \
> - "exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
> + "exdir_A/H -r 1 " + external_url_for["A/D/exdir_A/H"] + \
> "\n" + \
> - "x/y/z/blah " + other_repo_url + "/A/B/E" + \
> + "x/y/z/blah " + external_url_for["A/D/x/y/z/blah"] + \
> "\n"
>
> # Set and commit the property
> @@ -393,7 +408,7 @@
> def update_change_pristine_external(sbox):
> "update change to an unmodified external module"
>
> - externals_test_setup(sbox)
> + external_url_for = externals_test_setup(sbox)
> wc_dir = sbox.wc_dir
>
> other_wc_dir = sbox.add_wc_path('other')
> @@ -418,11 +433,11 @@
> # URL. Since no changes were made to the old checked-out external,
> # we should get a clean replace.
> new_externals_desc = \
> - "exdir_A " + other_repo_url + "/A" + \
> + "exdir_A " + external_url_for["A/D/exdir_A"] + \
> "\n" + \
> - "exdir_A/G " + other_repo_url + "/A/D/G" + \
> + "exdir_A/G " + external_url_for["A/D/exdir_A/G/"] + \
> "\n" + \
> - "exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
> + "exdir_A/H -r 1 " + external_url_for["A/D/exdir_A/H"] + \
> "\n" + \
> "x/y/z/blah " + other_repo_url + "/A/B/F" + \
> "\n"
> @@ -444,7 +459,7 @@
> def update_change_modified_external(sbox):
> "update changes to a modified external module"
>
> - externals_test_setup(sbox)
> + external_url_for = externals_test_setup(sbox)
> wc_dir = sbox.wc_dir
>
> other_wc_dir = sbox.add_wc_path('other')
> @@ -477,11 +492,11 @@
> # URL. There are some local mods under the old checked-out external,
> # so the old dir should be saved under a new name.
> new_externals_desc = \
> - "exdir_A " + other_repo_url + "/A" + \
> + "exdir_A " + external_url_for["A/D/exdir_A"] + \
> "\n" + \
> - "exdir_A/G " + other_repo_url + "/A/D/G" + \
> + "exdir_A/G/ " + external_url_for["A/D/exdir_A/G/"] + \
> "\n" + \
> - "exdir_A/H -r 1 " + other_repo_url + "/A/D/H" + \
> + "exdir_A/H -r 1 " + external_url_for["A/D/exdir_A/H"] + \
> "\n" + \
> "x/y/z/blah " + other_repo_url + "/A/B/F" + \
> "\n"
> @@ -593,7 +608,7 @@
> def modify_and_update_receive_new_external(sbox):
> "commit and update additional externals"
>
> - externals_test_setup(sbox)
> + external_url_for = externals_test_setup(sbox)
> wc_dir = sbox.wc_dir
>
> repo_dir = sbox.repo_dir
> @@ -610,9 +625,9 @@
> # Add one more external item
> B_path = os.path.join(wc_dir, "A/B")
> externals_desc = \
> - "exdir_G " + other_repo_url + "/A/D/G" + "\n" + \
> - "exdir_H -r 1 " + other_repo_url + "/A/D/H" + "\n" + \
> - "exdir_Z " + other_repo_url + "/A/D/H" + "\n"
> + "exdir_G " + external_url_for["A/D/exdir_A/G/"] + "\n" + \
> + "exdir_H -r 1 " + external_url_for["A/D/exdir_A/H"] + "\n" + \
> + "exdir_Z " + external_url_for["A/D/exdir_A/H"] + "\n"
>
> tmp_f = os.tempnam()
> svntest.main.file_append(tmp_f, externals_desc)
> @@ -638,7 +653,8 @@
>
> def disallow_dot_or_dotdot_directory_reference(sbox):
> "error if external target dir involves '.' or '..'"
> - sbox.build()
> +
> + external_url_for = externals_test_setup(sbox)
> wc_dir = sbox.wc_dir
> repo_url = sbox.repo_url
>
> @@ -656,15 +672,25 @@
> H_path = os.path.join(wc_dir, 'A', 'D', 'H')
> C_path = os.path.join(wc_dir, 'A', 'C')
> F_path = os.path.join(wc_dir, 'A', 'C', 'F')
> - externals_value_1 = "../foo" + " " + repo_url + "/A/B/E" + "\n"
> - externals_value_2 = "foo/bar/../baz" + " " + repo_url + "/A/B/E" + "\n"
> - externals_value_3 = "foo/.." + " " + repo_url + "/A/B/E" + "\n"
> - externals_value_4 = "." + " " + repo_url + "/A/B/E" + "\n"
> - externals_value_5 = "./" + " " + repo_url + "/A/B/E" + "\n"
> - externals_value_6 = ".." + " " + repo_url + "/A/B/E" + "\n"
> - externals_value_7 = "././/.///." + " " + repo_url + "/A/B/E" + "\n"
> - externals_value_8 = "/foo" + " " + repo_url + "/A/B/E" + "\n"
>
> + external_urls = external_url_for.values()
> +
> + externals_value_1 = "../foo" + " " + external_urls.pop() + "\n"
> + if not external_urls: external_urls = external_url_for.values()
> + externals_value_2 = "foo/bar/../baz" + " " + external_urls.pop() + "\n"
> + if not external_urls: external_urls = external_url_for.values()
> + externals_value_3 = "foo/.." + " " + external_urls.pop() + "\n"
> + if not external_urls: external_urls = external_url_for.values()
> + externals_value_4 = "." + " " + external_urls.pop() + "\n"
> + if not external_urls: external_urls = external_url_for.values()
> + externals_value_5 = "./" + " " + external_urls.pop() + "\n"
> + if not external_urls: external_urls = external_url_for.values()
> + externals_value_6 = ".." + " " + external_urls.pop() + "\n"
> + if not external_urls: external_urls = external_url_for.values()
> + externals_value_7 = "././/.///." + " " + external_urls.pop() + "\n"
> + if not external_urls: external_urls = external_url_for.values()
> + externals_value_8 = "/foo" + " " + external_urls.pop() + "\n"
> + if not external_urls: external_urls = external_url_for.values()
>
> set_externals_for_path_expect_error(B_path, externals_value_1, wc_dir)
> set_externals_for_path_expect_error(G_path, externals_value_2, wc_dir)
> @@ -775,7 +801,7 @@
> def external_with_peg_and_op_revision(sbox):
> "use a peg revision to specify an external module"
>
> - externals_test_setup(sbox)
> + external_url_for = externals_test_setup(sbox)
> wc_dir = sbox.wc_dir
>
> repo_dir = sbox.repo_dir
> @@ -793,13 +819,14 @@
> svntest.actions.run_and_verify_svn(None, None, [],
> '--username', svntest.main.wc_author,
> '--password', svntest.main.wc_passwd,
> - 'rm', other_repo_url +
> - '/A/D/H', '-m', 'remove original A/D/H')
> + 'rm',
> + external_url_for["A/D/exdir_A/H"],
> + '-m', 'remove original A/D/H')
>
> # Set an external property using peg revision syntax.
> new_externals_desc = \
> - other_repo_url + "/A/D/H@4 exdir_A/H \n" + \
> - other_repo_url + "/A/D/G exdir_A/G \n"
> + external_url_for["A/D/exdir_A/H"] + "@4 exdir_A/H \n" + \
> + external_url_for["A/D/exdir_A/G/"] + " exdir_A/G \n"
>
> # Set and commit the property.
> change_external(os.path.join(wc_dir, "A/D"), new_externals_desc)
> @@ -824,7 +851,7 @@
> def new_style_externals(sbox):
> "check the new '-rN URL PATH' syntax"
>
> - externals_test_setup(sbox)
> + external_url_for = externals_test_setup(sbox)
> wc_dir = sbox.wc_dir
>
> repo_url = sbox.repo_url
> @@ -839,9 +866,9 @@
>
> # Set an external property using the new '-rN URL PATH' syntax.
> new_externals_desc = \
> - other_repo_url + "/A/D/G exdir_G \n" + \
> - "-r 1 " + other_repo_url + "/A/D/H exdir_H \n" + \
> - "-r1 " + other_repo_url + "/A/D/H exdir_I \n"
> + external_url_for["A/C/exdir_G"] + " exdir_G \n" + \
> + "-r 1 " + external_url_for["A/C/exdir_H"] + " exdir_H \n" + \
> + "-r1 " + external_url_for["A/C/exdir_H"] + " exdir_I \n"
>
> # Set and commit the property.
> change_external(os.path.join(wc_dir, "A/C"), new_externals_desc)
> @@ -927,7 +954,7 @@
> def old_style_externals_ignore_peg_reg(sbox):
> "old 'PATH URL' format should ignore peg revisions"
>
> - externals_test_setup(sbox)
> + external_url_for = externals_test_setup(sbox)
> wc_dir = sbox.wc_dir
>
> repo_url = sbox.repo_url
> @@ -948,7 +975,7 @@
>
> # Set an external property using the old 'PATH URL' syntax with
> # @HEAD in the URL.
> - ext = "exdir_G " + other_repo_url + "/A/D/G@HEAD \n"
> + ext = "exdir_G " + external_url_for["A/C/exdir_G"] + "@HEAD\n"
>
> # Set and commit the property.
> change_external(os.path.join(wc_dir, "A"), ext)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
>
>

-- 
David Glasser | glasser_at_davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 9 15:17:32 2007

This is an archived mail posted to the Subversion Dev mailing list.