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

[PATCH] In svnadmin tests, use XFail properly, etc.

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2006-03-27 01:53:27 CEST

Does this look good enough for me to commit it?

- Julian

In "svnadmin" tests, don't use "XFail" for testing an operation that fails when
Subversion is working correctly, and other improvements.

* subversion/tests/README
  Emphasise what XFAIL is not to be used for.

* subversion/tests/cmdline/svnadmin_tests.py
  (load_and_verify_dumpstream): Enable use of SVNAnyOutput. Don't try
    to verify the result if an error was expected.
  (clean_dumpfile): Convert from a variable to a function so that the
    data cannot be modified in place, which was happening before (due to
    only shallow copies being made of it).
  (extra_blockcontent): Remove an obsolete comment. Insert extra data
    earlier in the stream to check that processing continues after it.
  (inconsistent_headers): Expect an error in loading the dump stream.
  (test_list): Remove "XFail" from "inconsistent_headers".

Index: subversion/tests/README
===================================================================
--- subversion/tests/README (revision 19040)
+++ subversion/tests/README (working copy)
@@ -80,6 +80,9 @@
 The purpose of XFAIL tests is to confirm that a known bug still
 exists. When you see such a test uneXpectedly PASS, you've probably
 fixed the bug it tests for, even if that wasn't your intention. :-)
+XFAIL is not to be used as a way of testing a deliberately invalid
+operation that is expected to fail when Subversion is working
+correctly, nor as a place-holder for a test that is not yet written.
 
 Each test function conforms to the svn_test_driver_t prototype:
 
Index: subversion/tests/cmdline/svnadmin_tests.py
===================================================================
--- subversion/tests/cmdline/svnadmin_tests.py (revision 19040)
+++ subversion/tests/cmdline/svnadmin_tests.py (working copy)
@@ -21,7 +21,8 @@
 
 # Our testing module
 import svntest
-
+from svntest import SVNAnyOutput
+from svntest.actions import SVNExpectedStdout, SVNExpectedStderr
 
 # (abbreviation)
 Skip = svntest.testcase.Skip
@@ -89,18 +90,28 @@
     expected_stderr, 1, dump)
 
   if expected_stdout:
- svntest.actions.compare_and_display_lines(
- "Standard output", "STDOUT:", expected_stdout, output)
+ if expected_stdout == SVNAnyOutput:
+ if len(output) == 0:
+ raise SVNExpectedStdout
+ else:
+ svntest.actions.compare_and_display_lines(
+ "Standard output", "STDOUT:", expected_stdout, output)
 
   if expected_stderr:
- svntest.actions.compare_and_display_lines(
- "Standard error output", "STDERR:", expected_stderr, errput)
+ if expected_stderr == SVNAnyOutput:
+ if len(errput) == 0:
+ raise SVNExpectedStderr
+ else:
+ svntest.actions.compare_and_display_lines(
+ "Standard error output", "STDERR:", expected_stderr, errput)
+ # The expected error occurred, so don't try to verify the result
+ return
 
   if revs:
     # verify revs as wc states
     for rev in xrange(len(revs)):
       svntest.actions.run_and_verify_svn("Updating to r%s" % (rev+1),
- svntest.SVNAnyOutput, [],
+ SVNAnyOutput, [],
                                          "update", "-r%s" % (rev+1),
                                          '--username', svntest.main.wc_author,
                                          '--password', svntest.main.wc_passwd,
@@ -158,7 +169,8 @@
 
 # dump stream tests need a dump file
 
-clean_dumpfile = \
+def clean_dumpfile():
+ return \
   [ "SVN-fs-dump-format-version: 2\n\n",
     "UUID: 668cc64a-31ed-0310-8ccb-b75d75bb44e3\n\n",
     "Revision-number: 0\n",
@@ -188,7 +200,7 @@
 
   test_create(sbox)
 
- dumpfile = clean_dumpfile
+ dumpfile = clean_dumpfile()
 
   dumpfile[3:3] = \
        [ "X-Comment-Header: Ignored header normally not in dump stream\n" ]
@@ -196,20 +208,20 @@
   load_and_verify_dumpstream(sbox,[],[], dumpfile_revisions, dumpfile)
 
 #----------------------------------------------------------------------
+# Ensure loading continues after skipping a bit of unknown extra content.
 def extra_blockcontent(sbox):
   "load success on oversized Content-length"
 
- ###FIXME: This test fails but should succeed in the light of
- # forward compatibility
-
   test_create(sbox)
 
- dumpfile = clean_dumpfile[0:-2] + \
- [ "Extra-content-length: 10\n",
- "Content-length: 50\n\n",
- "K 12\nsvn:keywords\nV 2\nId\nPROPS-END\n",
- "text\nextra text\n\n\n"]
+ dumpfile = clean_dumpfile()
 
+ # Replace "Content-length" line with two lines
+ dumpfile[8:9] = \
+ [ "Extra-content-length: 10\n",
+ "Content-length: 108\n\n" ]
+ # Insert the extra content after "PROPS-END\n"
+ dumpfile[11] = dumpfile[11][:-2] + "extra text\n\n\n"
 
   load_and_verify_dumpstream(sbox,[],[], dumpfile_revisions, dumpfile)
 
@@ -219,11 +231,12 @@
 
   test_create(sbox)
 
- dumpfile = clean_dumpfile
+ dumpfile = clean_dumpfile()
 
   dumpfile[-2] = "Content-length: 30\n\n"
 
- load_and_verify_dumpstream(sbox,[],[], dumpfile_revisions, dumpfile)
+ load_and_verify_dumpstream(sbox, [], SVNAnyOutput,
+ dumpfile_revisions, dumpfile)
 
 #----------------------------------------------------------------------
 
@@ -354,7 +367,7 @@
 test_list = [ None,
               extra_headers,
               extra_blockcontent,
- XFail(inconsistent_headers),
+ inconsistent_headers,
               dump_copied_dir,
               dump_move_dir_modify_child,
               dump_quiet,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Mar 27 01:53:49 2006

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.