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

Re: [PATCH] commit_tests.py test 15 converted to exception handling

From: B. W. Fitzpatrick <fitz_at_red-bean.com>
Date: 2003-09-07 21:42:44 CEST

Erik =?ISO-8859-1?Q?H=FClsmann?= <e.huelsmann@gmx.net> writes:
> Fitz,
>
> As promised I would send in a patch where both commit_tests 15 is converted t
> o the exception handling and the pickyness of svntest.actions.run_and_verify_
> svn with respect to the types of arguments it gets is increased. Before this
> patch tests will *always* pass when tuples are passed to run_and_verify_svn f
> or the expected_output or expected_error.
>
> Learning from my previous experience, I decided to split up the test in two p
> arts:
> 1) run_and_verify_svn pickyness
> 2) commit_tests 15

I can't get all commit_tests to pass by applying just the commit_test or
after applying both patches.

If I apply just the commit_test patch. I get this:

    ./commit_tests.py
    PASS: commit_tests.py 1: commit one file
    PASS: commit_tests.py 2: commit one newly added file
    PASS: commit_tests.py 3: commit one newly added binary file
    PASS: commit_tests.py 4: commit multiple targets
    PASS: commit_tests.py 5: commit multiple targets, 2nd variation
    PASS: commit_tests.py 6: commit wc_dir/A/D -- includes D. (anchor=A, tgt=D)
    PASS: commit_tests.py 7: commit wc_dir -- (anchor=wc_dir, tgt={})
    PASS: commit_tests.py 8: committing unversioned object produces error
    PASS: commit_tests.py 9: replace two nested dirs, verify empty contents
    PASS: commit_tests.py 10: hudson prob 1.0: delete file, commit, update
    PASS: commit_tests.py 11: hudson prob 1.1: delete dir, commit, update
    PASS: commit_tests.py 12: hudson prob 1.2: delete, commit, re-add, commit
    PASS: commit_tests.py 13: hudson prob 2.0: prop commit on old dir fails
    PASS: commit_tests.py 14: hudson prob 2.1: move files, update empty dir
    EXPECTED STDOUT:
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15 1
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15 2
    ACTUAL STDOUT:
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15 3
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15 2
    EXCEPTION: SVNLineUnequal
    XFAIL: commit_tests.py 15: hook testing
    PASS: commit_tests.py 16: commit mixed-rev wc (no erroneous merge error)
    PASS: commit_tests.py 17: commit files and dirs with URI-unsafe characters
    PASS: commit_tests.py 18: commit deleted yet edited files
    PASS: commit_tests.py 19: commit a file inside dir scheduled for addition
    PASS: commit_tests.py 20: commit deleted (and missing) file
    PASS: commit_tests.py 21: issue 644 attempt to add a file twice
    PASS: commit_tests.py 22: commit from a dir with a longer name than the wc
    PASS: commit_tests.py 23: try to commit when directory is locked
    PASS: commit_tests.py 24: commit the current directory
    PASS: commit_tests.py 25: attempted commit from multiple wc fails
    PASS: commit_tests.py 26: commit named targets with -N (issues #1195, #1239)
    PASS: commit_tests.py 27: commit with conflicts and check txn in repo
    PASS: commit_tests.py 28: committing a symlink should fail
    PASS: commit_tests.py 29: commit deletion of out-of-date file or dir
    PASS: commit_tests.py 30: commit with a log message containing bad data
    PASS: commit_tests.py 31: commit with invalid external editor cmd

Applying both patches I get this:

    pantheon: /home/fitz/svn-work/subversion/subversion/tests/clients/cmdline$ ./commit_tests.py
    PASS: commit_tests.py 1: commit one file
    PASS: commit_tests.py 2: commit one newly added file
    PASS: commit_tests.py 3: commit one newly added binary file
    PASS: commit_tests.py 4: commit multiple targets
    PASS: commit_tests.py 5: commit multiple targets, 2nd variation
    PASS: commit_tests.py 6: commit wc_dir/A/D -- includes D. (anchor=A, tgt=D)
    PASS: commit_tests.py 7: commit wc_dir -- (anchor=wc_dir, tgt={})
    PASS: commit_tests.py 8: committing unversioned object produces error
    PASS: commit_tests.py 9: replace two nested dirs, verify empty contents
    PASS: commit_tests.py 10: hudson prob 1.0: delete file, commit, update
    PASS: commit_tests.py 11: hudson prob 1.1: delete dir, commit, update
    PASS: commit_tests.py 12: hudson prob 1.2: delete, commit, re-add, commit
    PASS: commit_tests.py 13: hudson prob 2.0: prop commit on old dir fails
    PASS: commit_tests.py 14: hudson prob 2.1: move files, update empty dir
    EXPECTED STDOUT:
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15 1
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15 2
    ACTUAL STDOUT:
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15 3
    /disk/hda4/home/svn-work/subversion/subversion/tests/clients/cmdline/repositories/commit_tests-15 2
    EXCEPTION: SVNLineUnequal
    XFAIL: commit_tests.py 15: hook testing
    PASS: commit_tests.py 16: commit mixed-rev wc (no erroneous merge error)
    PASS: commit_tests.py 17: commit files and dirs with URI-unsafe characters
    PASS: commit_tests.py 18: commit deleted yet edited files
    PASS: commit_tests.py 19: commit a file inside dir scheduled for addition
    PASS: commit_tests.py 20: commit deleted (and missing) file
    PASS: commit_tests.py 21: issue 644 attempt to add a file twice
    PASS: commit_tests.py 22: commit from a dir with a longer name than the wc
    PASS: commit_tests.py 23: try to commit when directory is locked
    PASS: commit_tests.py 24: commit the current directory
    EXCEPTION: SVNIncorrectDatatype: Unexpected specification for stderr data
    FAIL: commit_tests.py 25: attempted commit from multiple wc fails
    PASS: commit_tests.py 26: commit named targets with -N (issues #1195, #1239)
    PASS: commit_tests.py 27: commit with conflicts and check txn in repo
    PASS: commit_tests.py 28: committing a symlink should fail
    PASS: commit_tests.py 29: commit deletion of out-of-date file or dir
    PASS: commit_tests.py 30: commit with a log message containing bad data
    PASS: commit_tests.py 31: commit with invalid external editor cmd

Are all tests passing fine for you? This is against HEAD (7001)

-Fitz

--
Brian W. Fitzpatrick    <fitz_at_red-bean.com>   http://www.red-bean.com/fitz/
 
> Log:
> [[[
> 
> * subversion/tests/clients/cmdline/svntest/actions.py
>   Check expected_stdout and expected_stderr for allowed
>   value types and bail out if no match
> 
> ]]]
> 
> Index: svn/subversion/tests/clients/cmdline/svntest/actions.py
> ===================================================================
> --- svn/subversion/tests/clients/cmdline/svntest/actions.py     (revision 692
> 4)
> +++ svn/subversion/tests/clients/cmdline/svntest/actions.py     (working copy
> )
> @@ -46,6 +46,12 @@
>    STDERR when output was expected."""
>    pass
> 
> +class SVNIncorrectDatatype(SVNUnexpectedOutput):
> +  """Exception raised if invalid input is passed to the
> +  run_and_verify_* API"""
> +  pass
> +
> +
>  ######################################################################
>  # Used by every test, so that they can run independently of
>  # one another.  The first time it's run, it executes 'svnadmin' to
> @@ -138,17 +144,21 @@
> 
>    if type(expected_stdout) is type([]):
>      compare_and_display_lines(message, 'STDOUT', expected_stdout, out)
> -  if expected_stdout == SVNAnyOutput:
> +  elif expected_stdout == SVNAnyOutput:
>      if len(out) == 0:
>        if message is not None: print message
>        raise SVNExpectedStdout
> -
> +  elif expected_stdout is not None:
> +    raise SVNIncorrectDatatype("Unexpected specification for stdout data")
> +
>    if type(expected_stderr) is type([]):
>      compare_and_display_lines(message, 'STDERR', expected_stderr, err)
> -  if expected_stderr == SVNAnyOutput:
> +  elif expected_stderr == SVNAnyOutput:
>      if len(err) == 0:
>        if message is not None: print message
>        raise SVNExpectedStderr
> +  elif expected_stderr is not None:
> +    raise SVNIncorrectDatatype("Unexpected specification for stderr data")
>    return out, err
The above looks fine to me.
> 
> 
> 
> 
> 
> Log:
> [[[ convert commit_tests.py test 15 to new exception based system
> 
> * subversion/tests/clients/cmdline/commit_tests.py
>   convert expected_output from tuple to list: 
>   run_and_verify_svn does not allow tuples
> 
> ]]]
> 
> 
> Index: subversion/tests/clients/cmdline/commit_tests.py
> ===================================================================
> --- subversion/tests/clients/cmdline/commit_tests.py    (revision 6995)
> +++ subversion/tests/clients/cmdline/commit_tests.py    (working copy)
> @@ -860,8 +860,7 @@
>  def hook_test(sbox):
>    "hook testing"
> 
> -  if sbox.build():
> -    return 1
> +  sbox.build()
> 
>    # Get paths to the working copy and repository
>    wc_dir = sbox.wc_dir
> @@ -894,19 +893,13 @@
>    # filesystem will report an absolute path because that's the way the
>    # filesystem is created by this test suite.
>    abs_repo_dir = os.path.abspath (repo_dir)
> -  expected_output = (abs_repo_dir + "\n",
> -                     abs_repo_dir + " 1\n",
> -                     abs_repo_dir + " 2\n")
> -  output, errput = svntest.main.run_svn (None, 'ci', '--quiet',
> -                                         '-m', 'log msg', wc_dir)
> +  expected_output = [ abs_repo_dir + "\n",
> +                      abs_repo_dir + " 1\n",
> +                      abs_repo_dir + " 2\n" ]
> +  svntest.actions.run_and_verify_svn (None, expected_output, None,
> +                                      'ci', '--quiet',
> +                                      '-m', 'log msg', wc_dir)
> 
> -  # Make sure we got the right output.
> -  if output != expected_output:
> -    return 1
> -
> -  return 0
> -
> -
>  #----------------------------------------------------------------------
> 
>  # Regression test for bug #469, whereby merge() was once reporting
-Fitz  
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Sep 7 21:43:47 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.