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

[PATCH] Tests

From: D.J. Heap <dj_at_shadyvale.net>
Date: 2003-09-26 05:55:59 CEST

Any objections to committing this?

I ran it through all tests (local, svn, dav) on RH9 and WinXP again
yesterday with no failures on Linux and the expected two per protocol on
Windows. The 'svn commit -F A\B\C' failure I should be able to supply a
patch for tomorrow or Saturday. The commit-22 failure I'm still
investigating, but it's not new -- it's been failing on and off for me
for months.

Log:

Change the test suite to expect local path separators instead of
tweaking the results to always have '/' separators; Subversion is now
using and outputting local path separators almost everywhere and some of
the tests were breaking on Windows. Most of this patch is removing
tweak-results-on-Windows code.

* subversion/tests/clients/cmdline/copy_tests.py
* subversion/tests/clients/cmdline/basic_tests.py
* subversion/tests/clients/cmdline/trans_tests.py
* subversion/tests/clients/cmdline/schedule_tests.py
* subversion/tests/clients/cmdline/merge_tests.py
   Remove tweaks and distinguish between local paths and urls.

* subversion/tests/clients/cmdline/svntest/actions.py
   After building the test url by appending a local path,
   change '\' to '/' if we're on Windows.

* subversion/tests/clients/cmdline/svnlook_tests.py
* subversion/tests/clients/cmdline/diff_tests.py
   Diffs are one place where we still use '/' all
   the time, so it needs a slight tweak if running on Windows.
   This tweak should be removed when/if diffs are changed to use
   local separators.

* subversion/tests/clients/cmdline/svntest/main.py
   Build the test paths using local path separators and make sure
   urls always use '/'.

Index: subversion/tests/clients/cmdline/diff_tests.py
===================================================================
--- subversion/tests/clients/cmdline/diff_tests.py (revision 7200)
+++ subversion/tests/clients/cmdline/diff_tests.py (working copy)
@@ -38,6 +38,9 @@
 def check_diff_output(diff_output, name, diff_type):
   "check diff output"
 
+# On Windows, diffs still display / rather than \ in paths
+ if svntest.main.windows == 1:
+ name = name.replace('\\', '/')
   i_re = re.compile('^Index:')
   d_re = re.compile('^Index: (\\./)?' + name)
   p_re = re.compile('^--- (\\./)?' + name)
Index: subversion/tests/clients/cmdline/copy_tests.py
===================================================================
--- subversion/tests/clients/cmdline/copy_tests.py (revision 7200)
+++ subversion/tests/clients/cmdline/copy_tests.py (working copy)
@@ -400,8 +400,7 @@
 
   # Use 'svn cp -r 1 URL URL' to resurrect the deleted directory, where
   # the two URLs are identical. This used to trigger a failure.
- url = svntest.main.test_area_url + '/' \
- + svntest.main.current_repo_dir + '/A/D/G'
+ url = svntest.main.current_repo_url + '/A/D/G'
   svntest.actions.run_and_verify_svn(None, None, [], 'cp',
                                      '--username', svntest.main.wc_author,
                                      '--password', svntest.main.wc_passwd,
@@ -604,8 +603,7 @@
 
   # REPOS to WC copy of file with properties
   rho_url_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho_url')
- rho_url = svntest.main.test_area_url + '/' \
- + svntest.main.current_repo_dir + '/A/D/G/rho'
+ rho_url = svntest.main.current_repo_url + '/A/D/G/rho'
   svntest.actions.run_and_verify_svn(None, None, [],
                                      'copy', rho_url, rho_url_path)
 
@@ -930,7 +928,7 @@
 
   sbox.build()
 
- root = svntest.main.test_area_url + '/' + svntest.main.current_repo_dir
+ root = svntest.main.current_repo_url
   mu = root + '/A/mu'
 
   svntest.actions.run_and_verify_svn(None, None, [], 'cp',
Index: subversion/tests/clients/cmdline/basic_tests.py
===================================================================
--- subversion/tests/clients/cmdline/basic_tests.py (revision 7200)
+++ subversion/tests/clients/cmdline/basic_tests.py (working copy)
@@ -1079,8 +1079,7 @@
                                         wc_dir)
 
   # Now try to checkout revision 1 of A/D.
- url = svntest.main.test_area_url + '/' + svntest.main.current_repo_dir + \
- '/A/D'
+ url = svntest.main.current_repo_url + '/A/D'
   wc2 = os.path.join (sbox.wc_dir, 'new_D')
   svntest.actions.run_and_verify_svn("error checking out r1 of A/D",
                                      None, [], 'co', '-r', '1',
@@ -1164,7 +1163,7 @@
   svntest.main.file_append(new_path, "some text")
 
   # import new files into repository
- url = os.path.join(svntest.main.current_repo_url, "dirA/dirB/new_file")
+ url = svntest.main.current_repo_url + "/dirA/dirB/new_file"
   output, errput = svntest.actions.run_and_verify_svn(
     'Cannot change node kind', None, [], 'import',
     '--username', svntest.main.wc_author,
@@ -1503,7 +1502,7 @@
   open(foo_o_path, 'w')
 
   # import new dir into repository
- url = os.path.join(svntest.main.current_repo_url, 'dir')
+ url = svntest.main.current_repo_url + '/dir'
 
   output, errput = svntest.actions.run_and_verify_svn(
     None, None, [], 'import',
Index: subversion/tests/clients/cmdline/trans_tests.py
===================================================================
--- subversion/tests/clients/cmdline/trans_tests.py (revision 7200)
+++ subversion/tests/clients/cmdline/trans_tests.py (working copy)
@@ -29,19 +29,6 @@
 Item = svntest.wc.StateItem
 
 
-# FIXME: Someday we'll create expected output with the right kind
-# of path separator; but the client doesn't consistently
-# use local style in output yet.
-def _tweak_paths(list):
- if os.sep != "/":
- tweaked_list = []
- for line in list:
- tweaked_list.append(string.replace(line, os.sep, "/"))
- return tweaked_list
- else:
- return list
-
-
 ######################################################################
 # THINGS TO TEST
 #
@@ -439,8 +426,6 @@
   expected_output = ["Sending " + foo_path + "\n",
                      "Transmitting file data .\n",
                      "Committed revision 3.\n"]
- # FIXME: see commend at _tweak_paths
- expected_output = _tweak_paths(expected_output)
   svntest.actions.run_and_verify_svn(None, expected_output, [],
                                      'ci', '-m', 'log msg', foo_path)
 
Index: subversion/tests/clients/cmdline/svnlook_tests.py
===================================================================
--- subversion/tests/clients/cmdline/svnlook_tests.py (revision 7200)
+++ subversion/tests/clients/cmdline/svnlook_tests.py (working copy)
@@ -164,6 +164,9 @@
   if len(output) != len(expected_output):
     raise svntest.Failure
 
+ # On Windows, diff's still output / rather than \ in paths
+ if svntest.main.windows == 1:
+ iota_path = iota_path.replace('\\', '/')
   # Replace all occurences of wc_dir/iota with iota in svn diff output
   reiota = re.compile(iota_path)
 
Index: subversion/tests/clients/cmdline/schedule_tests.py
===================================================================
--- subversion/tests/clients/cmdline/schedule_tests.py (revision 7200)
+++ subversion/tests/clients/cmdline/schedule_tests.py (working copy)
@@ -30,19 +30,6 @@
 Item = svntest.wc.StateItem
 
 
-# FIXME: Someday we'll create expected output with the right kind
-# of path separator; but the client doesn't consistently
-# use local style in output yet.
-def _tweak_paths(list):
- if os.sep != "/":
- tweaked_list = []
- for line in list:
- tweaked_list.append(string.replace(line, os.sep, "/"))
- return tweaked_list
- else:
- return list
-
-
 ######################################################################
 # Tests
 #
@@ -281,7 +268,6 @@
                                                    '--recursive', wc_dir)
 
   ### do we really need to sort these?
- output = _tweak_paths(output) # FIXME: see comment at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
@@ -307,7 +293,6 @@
                                                    '--recursive', wc_dir)
 
   ### do we really need to sort these?
- output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
@@ -332,7 +317,6 @@
                                                    'revert',
                                                    '--recursive', wc_dir)
   ### do we really need to sort these?
- output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
@@ -363,7 +347,6 @@
                                                    '--recursive', wc_dir)
 
   ### do we really need to sort these?
- expected_output = _tweak_paths(expected_output)
   output.sort()
   expected_output.sort()
   if output != expected_output:
@@ -390,7 +373,6 @@
                                                    'revert',
                                                    '--recursive', wc_dir)
   ### do we really need to sort these?
- output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
@@ -425,7 +407,6 @@
                                                    'revert',
                                                    '--recursive', wc_dir)
   ### do we really need to sort these?
- output = _tweak_paths(output) # FIXME: see commend at _tweak_paths
   output.sort()
   expected_output.sort()
   if output != expected_output:
Index: subversion/tests/clients/cmdline/svntest/actions.py
===================================================================
--- subversion/tests/clients/cmdline/svntest/actions.py (revision 7200)
+++ subversion/tests/clients/cmdline/svntest/actions.py (working copy)
@@ -76,6 +76,8 @@
 
     # build a URL for doing an import.
     url = main.test_area_url + '/' + main.pristine_dir
+ if main.windows == 1:
+ url = url.replace('\\', '/')
 
     # import the greek tree, using l:foo/p:bar
     ### todo: svn should not be prompting for auth info when using
Index: subversion/tests/clients/cmdline/svntest/main.py
===================================================================
--- subversion/tests/clients/cmdline/svntest/main.py (revision 7200)
+++ subversion/tests/clients/cmdline/svntest/main.py (working copy)
@@ -81,32 +81,6 @@
   windows = 1
   file_schema_prefix = 'file:///'
   _exe = '.exe'
-
- # svn on windows doesn't support backslashes in path names
- _os_path_abspath_orig = os.path.abspath
- def _os_path_abspath(arg):
- path = _os_path_abspath_orig(arg)
- return path.replace('\\', '/')
- os.path.abspath = _os_path_abspath
-
- _os_path_join_orig = os.path.join
- def _os_path_join(*args):
- path = apply(_os_path_join_orig, args)
- return path.replace('\\', '/')
- os.path.join = _os_path_join
-
- _os_path_normpath_orig = os.path.normpath
- def _os_path_normpath(arg):
- path = _os_path_normpath_orig(arg)
- return path.replace('\\', '/')
- os.path.normpath = _os_path_normpath
-
- _os_path_dirname_orig = os.path.dirname
- def _os_path_dirname(arg):
- path = _os_path_dirname_orig(arg)
- return path.replace('\\', '/')
- os.path.dirname = _os_path_dirname
-
 else:
   windows = 0
   file_schema_prefix = 'file://'
@@ -131,7 +105,10 @@
 
 # Global URL to testing area. Default to ra_local, current working dir.
 test_area_url = file_schema_prefix + os.path.abspath(os.getcwd())
+if windows == 1:
+ test_area_url = test_area_url.replace('\\', '/')
 
+
 # Where we want all the repositories and working copies to live.
 # Each test will have its own!
 general_repo_dir = "repositories"
@@ -382,6 +359,8 @@
   global current_repo_dir, current_repo_url
   current_repo_dir = repo_dir
   current_repo_url = test_area_url + '/' + repo_dir
+ if windows == 1:
+ current_repo_url = current_repo_url.replace('\\', '/')
 
 
 ######################################################################
@@ -395,6 +374,8 @@
     self.wc_dir = os.path.join(general_wc_dir, self.name)
     self.repo_dir = os.path.join(general_repo_dir, self.name)
     self.repo_url = test_area_url + '/' + self.repo_dir
+ if windows == 1:
+ self.repo_url = self.repo_url.replace('\\', '/')
     self.test_paths = [self.wc_dir, self.repo_dir]
 
   def build(self):
Index: subversion/tests/clients/cmdline/merge_tests.py
===================================================================
--- subversion/tests/clients/cmdline/merge_tests.py (revision 7200)
+++ subversion/tests/clients/cmdline/merge_tests.py (working copy)
@@ -913,7 +913,7 @@
   expected_output = wc.State(wc_dir, { rho_rel_path : Item(verb='Sending'), })
   expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
   expected_status.tweak(wc_rev=1)
- expected_status.tweak(rho_rel_path, wc_rev=2)
+ expected_status.tweak('A/D/G/rho', wc_rev=2)
   svntest.actions.run_and_verify_commit (wc_dir,
                                          expected_output,
                                          expected_status,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Sep 26 05:57:14 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.