r869827 | julianfoad | 2008-03-06 22:27:59 +0000 (Thu, 06 Mar 2008)
Allow testing of application exit codes.
This makes all of the lower-level process-running functions in
cmdline/svntest/main.py and cmdline/svntest/actions.py return
the exit code, all of the "run_and_verify_*()" functions guess the
expected exit code based on whether or not output on stderr is
expected, and new "run_and_verify_*2()" functions allow the
expected exit code to be provided explicitly.
On platforms without the Popen3 Python class (e.g. Windows), exit
codes are returned as None, and therefore disregarded during
validation.
Patch by: Jeremy Hinds <jeremy.hinds@gmail.com>
* subversion/tests/cmdline/svntest/main.py
(run_command, run_svn, run_svnadmin, run_svnlook, run_svnsync,
run_svnversion, run_command_stdin):
Include exit_code in the returned tuple.
(create_repos): Accept exit_code returned from run_command.
(run_one): Clarify a comment concerning exit codes
* subversion/tests/cmdline/svntest/actions.py
(run_and_verify_svnlook2, run_and_verify_svnadmin2,
run_and_verify_svnversion2, run_and_verify_svn2,
run_and_verify_svn_match_any2): New, execute the indicated binary
and check actual outputs and exit code against the expected value
parameters.
(run_and_verify_svnlook, run_and_verify_svnadmin,
run_and_verify_svnversion, run_and_verify_svn,
run_and_verify_svn_match_any): Guess whether the expected exit should
be 0 or 1 based on whether output is expected on stderr. Then invoke
the coresponding run_and_verify_*2 function with that value. Return
exit_code, stdout_lines, stderr_lines.
(setup_pristine_repository, run_and_verify_load, run_and_verify_dump,
run_and_verify_checkout, run_and_verify_update, run_and_verify_commit,
run_and_verify_status, run_and_verify_unquiet_status,
run_and_verify_diff_summarize, run_and_verify_diff_summarize_xml,
run_and_verify_log_xml, run_and_verify_merge2,
run_and_verify_mergeinfo, run_and_verify_switch, run_and_validate_lock,
check_prop, inject_conflict_into_wc, run_and_verify_export):
Accept exit_code value returned from main.run_svn, main.run_command,
main.run_svnadmin, main.run_command_stdin, actions.run_and_verify_svn
* subversion/tests/cmdline/svntest/tree.py
(get_props): Accept exit code returned by main.run_svn.
* subversion/tests/cmdline/svntest/verify.py
(SVNUnexpectedExitCode): New exception raised when the exit code was not
what was expected.
(verify_exit_code): New, compares expected and actual exit code and raises
an exception if they are different. Comparison is not performed if
expected exit code is None.
* subversion/tests/cmdline/cat_tests.py,
subversion/tests/cmdline/lock_tests.py,
subversion/tests/cmdline/stat_tests.py:
Accept exit code returned from run_*(), replacing those calls with the
run_*2() counterparts for cases where stderr output is produced while
exiting 0.
* subversion/tests/cmdline/prop_tests.py:
Accept exit code returned from the run_*() function calls, and verify
exit codes along with each verify_output().
* subversion/tests/cmdline/authz_tests.py,
subversion/tests/cmdline/autoprop_tests.py,
subversion/tests/cmdline/basic_tests.py,
subversion/tests/cmdline/blame_tests.py,
subversion/tests/cmdline/changelist_tests.py,
subversion/tests/cmdline/checkout_tests.py,
subversion/tests/cmdline/commit_tests.py,
subversion/tests/cmdline/copy_tests.py,
subversion/tests/cmdline/depth_tests.py,
subversion/tests/cmdline/diff_tests.py,
subversion/tests/cmdline/getopt_tests.py,
subversion/tests/cmdline/import_tests.py,
subversion/tests/cmdline/log_tests.py,
subversion/tests/cmdline/merge_tests.py,
subversion/tests/cmdline/revert_tests.py,
subversion/tests/cmdline/schedule_tests.py,
subversion/tests/cmdline/special_tests.py,
subversion/tests/cmdline/svnadmin_tests.py,
subversion/tests/cmdline/svndumpfilter_tests.py,
subversion/tests/cmdline/svnlook_tests.py,
subversion/tests/cmdline/svnsync_tests.py,
subversion/tests/cmdline/svnversion_tests.py,
subversion/tests/cmdline/switch_tests.py,
subversion/tests/cmdline/update_tests.py:
Accept exit code returned from the run_*() function calls.