You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/01/17 12:18:16 UTC
svn commit: r1434617 - in /subversion/trunk/subversion/tests/cmdline:
basic_tests.py svntest/actions.py
Author: rhuijben
Date: Thu Jan 17 11:18:16 2013
New Revision: 1434617
URL: http://svn.apache.org/viewvc?rev=1434617&view=rev
Log:
In the testsuite make functions run_and_verify_update(), _switch(),
_commit() and _patch verify passed output and status lists even though
an error is expected.
If the caller intended not to check the value it would/should have passed None
for those things not to check, or the caller should have used a different
function.
This allows using these functions to process results for verifying warning
cases like failed external checkouts that only produce a final error.
* subversion/tests/cmdline/basic_tests.py
(basic_commit_corruption): Fix test expectations. No values were checked
here, even though the code assumed that they were.
* subversion/tests/cmdline/svntest/actions.py
(run_and_verify_update): Continue checking after expected error.
(run_and_verify_patch): Fix documentation only.
(process_output_for_commit): Don't verify a committed line on an error.
(run_and_verify_commit): Don't return success early on an expected error.
Modified:
subversion/trunk/subversion/tests/cmdline/basic_tests.py
subversion/trunk/subversion/tests/cmdline/svntest/actions.py
Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1434617&r1=1434616&r2=1434617&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Thu Jan 17 11:18:16 2013
@@ -394,7 +394,7 @@ def basic_commit_corruption(sbox):
# This commit should fail due to text base corruption.
svntest.actions.run_and_verify_commit(wc_dir, expected_output,
- expected_status,
+ None, # expected_status,
"svn: E200014: Checksum",
wc_dir)
@@ -483,9 +483,9 @@ def basic_update_corruption(sbox):
# Do the update and check the results in three ways.
svntest.actions.run_and_verify_update(other_wc,
- expected_output,
- expected_disk,
- expected_status,
+ None, # expected_output,
+ None, # expected_disk,
+ None, # expected_status,
"svn: E155017: Checksum", other_wc)
# Restore the uncorrupted text base.
Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1434617&r1=1434616&r2=1434617&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Thu Jan 17 11:18:16 2013
@@ -838,8 +838,6 @@ def run_and_verify_update(wc_dir_name,
If ERROR_RE_STRING, the update must exit with error, and the error
message must match regular expression ERROR_RE_STRING.
- Else if ERROR_RE_STRING is None, then:
-
If OUTPUT_TREE is not None, the subcommand output will be verified
against OUTPUT_TREE. If DISK_TREE is not None, the working copy
itself will be verified against DISK_TREE. If STATUS_TREE is not
@@ -864,11 +862,13 @@ def run_and_verify_update(wc_dir_name,
if error_re_string:
rm = re.compile(error_re_string)
+ match = None
for line in errput:
match = rm.search(line)
if match:
- return
- raise main.SVNUnmatchedError
+ break
+ if not match:
+ raise main.SVNUnmatchedError
actual = wc.State.from_checkout(output)
verify_update(actual, None, None, wc_dir_name,
@@ -1171,8 +1171,6 @@ def run_and_verify_patch(dir, patch_path
If ERROR_RE_STRING, 'svn patch' must exit with error, and the error
message must match regular expression ERROR_RE_STRING.
- Else if ERROR_RE_STRING is None, then:
-
The subcommand output will be verified against OUTPUT_TREE, and the
working copy itself will be verified against DISK_TREE. If optional
STATUS_TREE is given, then 'svn status' output will be compared.
@@ -1341,7 +1339,6 @@ def run_and_verify_switch(wc_dir_name,
error_re_string = ".*(" + error_re_string + ")"
expected_err = verify.RegexOutput(error_re_string, match_all=False)
verify.verify_outputs(None, None, errput, None, expected_err)
- return
elif errput:
raise verify.SVNUnexpectedStderr(err)
@@ -1353,7 +1350,7 @@ def run_and_verify_switch(wc_dir_name,
singleton_handler_b, b_baton,
check_props)
-def process_output_for_commit(output):
+def process_output_for_commit(output, error_re_string):
"""Helper for run_and_verify_commit(), also used in the factory."""
# Remove the final output line, and verify that the commit succeeded.
lastline = ""
@@ -1372,7 +1369,7 @@ def process_output_for_commit(output):
cm = re.compile("(Committed|Imported) revision [0-9]+.")
match = cm.search(lastline)
- if not match:
+ if not match and not error_re_string:
logger.warn("ERROR: commit did not succeed.")
logger.warn("The final line from 'svn ci' was:")
logger.warn(lastline)
@@ -1431,22 +1428,22 @@ def run_and_verify_commit(wc_dir_name, o
error_re_string = ".*(" + error_re_string + ")"
expected_err = verify.RegexOutput(error_re_string, match_all=False)
verify.verify_outputs(None, None, errput, None, expected_err)
- return
# Else not expecting error:
# Convert the output into a tree.
- output = process_output_for_commit(output)
+ output = process_output_for_commit(output, error_re_string)
actual = tree.build_tree_from_commit(output)
# Verify actual output against expected output.
- try:
- tree.compare_trees("output", actual, output_tree)
- except tree.SVNTreeError:
- verify.display_trees("Output of commit is unexpected",
- "OUTPUT TREE", output_tree, actual)
- _log_tree_state("ACTUAL OUTPUT TREE:", actual, wc_dir_name)
- raise
+ if output_tree:
+ try:
+ tree.compare_trees("output", actual, output_tree)
+ except tree.SVNTreeError:
+ verify.display_trees("Output of commit is unexpected",
+ "OUTPUT TREE", output_tree, actual)
+ _log_tree_state("ACTUAL OUTPUT TREE:", actual, wc_dir_name)
+ raise
# Verify via 'status' command too, if possible.
if status_tree: