Modified: subversion/branches/inheritable-props/subversion/tests/cmdline/commit_tests.py URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/tests/cmdline/commit_tests.py?rev=1376157&r1=1376156&r2=1376157&view=diff ============================================================================== --- subversion/branches/inheritable-props/subversion/tests/cmdline/commit_tests.py (original) +++ subversion/branches/inheritable-props/subversion/tests/cmdline/commit_tests.py Wed Aug 22 17:47:44 2012 @@ -2940,7 +2940,47 @@ def commit_moved_dir_with_nested_mod_in_ 'Last Changed Rev' : '2', } svntest.actions.run_and_verify_info([expected], E_copied) - + +#---------------------------------------------------------------------- +def init_commit_hook_test(sbox): + "init-commit hook failure case testing" + + sbox.build() + + # Get paths to the working copy and repository + wc_dir = sbox.wc_dir + repo_dir = sbox.repo_dir + + # Create a hook that outputs a message to stderr and returns exit code 1 + # Include a non-XML-safe message as history shows there've been + # problems with such in hooks (see issue #3553). + error_msg = "Text with <angle brackets> & ampersand" + svntest.actions.create_failing_hook(repo_dir, "init-commit", error_msg) + + # Modify iota just so there is something to commit. + iota_path = sbox.ospath('iota') + svntest.main.file_append(iota_path, "More stuff in iota") + + # Commit, expect error code 1 + exit_code, actual_stdout, actual_stderr = svntest.main.run_svn( + 1, 'ci', '--quiet', '-m', 'log msg', wc_dir) + + # No stdout expected + svntest.verify.compare_and_display_lines('Init-commit hook test', + 'STDOUT', [], actual_stdout) + + # Compare only the last two lines of stderr since the preceding ones + # contain source code file and line numbers. + if len(actual_stderr) > 2: + actual_stderr = actual_stderr[-2:] + expected_stderr = [ "svn: E165001: " + + svntest.actions.hook_failure_message('init-commit'), + error_msg + "\n", + ] + svntest.verify.compare_and_display_lines('Init-commit hook test', + 'STDERR', + expected_stderr, actual_stderr) + ######################################################################## # Run the tests @@ -3013,6 +3053,7 @@ test_list = [ None, commit_add_subadd, commit_danglers, commit_moved_dir_with_nested_mod_in_subdir, + init_commit_hook_test, ] if __name__ == '__main__':
Modified: subversion/branches/inheritable-props/subversion/tests/cmdline/svntest/actions.py URL: http://svn.apache.org/viewvc/subversion/branches/inheritable-props/subversion/tests/cmdline/svntest/actions.py?rev=1376157&r1=1376156&r2=1376157&view=diff ============================================================================== --- subversion/branches/inheritable-props/subversion/tests/cmdline/svntest/actions.py (original) +++ subversion/branches/inheritable-props/subversion/tests/cmdline/svntest/actions.py Wed Aug 22 17:47:44 2012 @@ -1921,7 +1921,7 @@ def hook_failure_message(hook_name): if svntest.main.options.server_minor_version < 5: return "'%s' hook failed with error output:\n" % hook_name else: - if hook_name in ["start-commit", "pre-commit"]: + if hook_name in ["start-commit", "pre-commit", "init-commit"]: action = "Commit" elif hook_name == "pre-revprop-change": action = "Revprop change"
