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

Re: [patch] regression tests for issues 439 and 440

From: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2002-01-12 22:36:27 CET

Just pinging the list to remind people that these regression tests are
out there and could use a code review.

-garrett

On Sat, Jan 05, 2002 at 05:47:00PM -0500, Garrett Rooney wrote:
> this should handle bite sized task number 441.
>
> * build.conf
> (fs-test-scripts): add entry for stat_tests.py
> * subversion/tests/cmdline/diff_tests.py
> (diff_non_version_controlled_file): a test for issue 439.
> * subversion/tests/cmdline/stat_tests.py
> new file for tests related to 'svn stat'.
> (stat_unversioned_file_in_current_dir): a test for issue 440.
>
> Index: ./build.conf
> ===================================================================
> --- ./.svn/text-base/build.conf.svn-base Sat Jan 5 11:03:57 2002
> +++ ./build.conf Sat Jan 5 17:19:33 2002
> @@ -48,9 +48,10 @@
> subversion/tests/clients/cmdline/copy_tests.py
> # Python: 'svn diff -r' tests
> subversion/tests/clients/cmdline/diff_tests.py
> +# Python: 'svn stat' tests
> + subversion/tests/clients/cmdline/stat_tests.py
> # Python: 'svnadmin' tests
> subversion/tests/clients/cmdline/svnadmin_tests.py
> -
>
> # ----------------------------------------------------------------------------
> #
> Index: ./subversion/tests/clients/cmdline/diff_tests.py
> ===================================================================
> --- ./subversion/tests/clients/cmdline/.svn/text-base/diff_tests.py.svn-base Sat Jan 5 11:05:23 2002
> +++ ./subversion/tests/clients/cmdline/diff_tests.py Sat Jan 5 17:22:19 2002
> @@ -371,6 +371,31 @@
>
> return 0
>
> +# test 7
> +def diff_non_version_controlled_file():
> + "non version controlled files"
> +
> + sbox = sandbox(diff_non_version_controlled_file)
> + wc_dir = os.path.join(svntest.main.general_wc_dir, sbox)
> + if svntest.actions.make_repo_and_wc(sbox): return 1
> +
> + svntest.main.file_append(os.path.join(wc_dir, 'A', 'D', 'foo'), "a new file")
> +
> + diff_output, err_output = svntest.main.run_svn(1, 'diff',
> + os.path.join(wc_dir,
> + 'A', 'D', 'foo'))
> +
> + if count_diff_output(diff_output) != 0: return 1
> +
> + # At one point this would crash, so we would only get a 'Segmentation Fault'
> + # error message. The appropriate response is a few lines of errors. I wish
> + # there was a way to figure out if svn crashed, but all run_svn gives us is
> + # the output, so here we are...
> + if len(err_output) <= 1: return 1
> +
> + return 0
> +
> +
> ########################################################################
> # Run the tests
>
> @@ -382,7 +407,8 @@
> diff_add_a_file_in_a_subdir,
> diff_replace_a_file,
> diff_two_add_reverse,
> - diff_non_recursive
> + diff_non_recursive,
> + diff_non_version_controlled_file,
> ]
>
> if __name__ == '__main__':
> Index: ./subversion/tests/clients/cmdline/stat_tests.py
> ===================================================================
> --- /dev/null Sat Jan 5 17:26:47 2002
> +++ subversion/tests/clients/cmdline/stat_tests.py Sat Jan 5 17:27:08 2002
> @@ -0,0 +1,101 @@
> +#!/usr/bin/env python
> +#
> +# stat_tests.py: testing the svn stat command
> +#
> +# Subversion is a tool for revision control.
> +# See http://subversion.tigris.org for more information.
> +#
> +# ====================================================================
> +# Copyright (c) 2000-2001 CollabNet. All rights reserved.
> +#
> +# This software is licensed as described in the file COPYING, which
> +# you should have received as part of this distribution. The terms
> +# are also available at http://subversion.tigris.org/license-1.html.
> +# If newer versions of this license are posted there, you may use a
> +# newer version instead, at your option.
> +#
> +######################################################################
> +
> +# General modules
> +import shutil, string, sys, re, os.path, traceback
> +
> +# The `svntest' module
> +try:
> + import svntest
> +except SyntaxError:
> + sys.stderr.write('[SKIPPED] ')
> + print "<<< Please make sure you have Python 2 or better! >>>"
> + traceback.print_exc(None,sys.stdout)
> + raise SystemExit
> +
> +
> +# Quick macro for auto-generating sandbox names
> +def sandbox(x):
> + return "basic_tests-" + `test_list.index(x)`
> +
> +# (abbreviation)
> +path_index = svntest.actions.path_index
> +
> +
> +######################################################################
> +# Tests
> +#
> +# Each test must return 0 on success or non-zero on failure.
> +
> +#----------------------------------------------------------------------
> +
> +def stat_unversioned_file_in_current_dir():
> + "stat an unversioned file in the current directory"
> +
> + sbox = sandbox(stat_unversioned_file_in_current_dir)
> + wc_dir = os.path.join(svntest.main.general_wc_dir, sbox)
> + if svntest.actions.make_repo_and_wc(sbox): return 1
> +
> + was_cwd = os.getcwd()
> + os.chdir(wc_dir)
> +
> + svntest.main.file_append('foo', 'a new file')
> +
> + stat_output, err_output = svntest.main.run_svn(None, 'stat', 'foo')
> +
> + if len(stat_output) != 1:
> + os.chdir(was_cwd)
> + return 1
> +
> + if len(err_output) != 0:
> + os.chdir(was_cwd)
> + return 1
> +
> + os.chdir(was_cwd)
> + return 0
> +
> +#----------------------------------------------------------------------
> +
> +
> +########################################################################
> +# Run the tests
> +
> +
> +# list all tests here, starting with None:
> +test_list = [ None,
> + stat_unversioned_file_in_current_dir,
> + ]
> +
> +if __name__ == '__main__':
> +
> + ## run the main test routine on them:
> + err = svntest.main.run_tests(test_list)
> +
> + ## remove all scratchwork: the 'pristine' repository, greek tree, etc.
> + ## This ensures that an 'import' will happen the next time we run.
> + if os.path.exists(svntest.main.temp_dir):
> + shutil.rmtree(svntest.main.temp_dir)
> +
> + ## return whatever main() returned to the OS.
> + sys.exit(err)
> +
> +
> +### End of file.
> +# local variables:
> +# eval: (load-file "../../../svn-dev.el")
> +# end:
>
> --
> garrett rooney Unix was not designed to stop you from
> rooneg@electricjellyfish.net doing stupid things, because that would
> http://electricjellyfish.net/ stop you from doing clever things.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>

-- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:56 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.