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

[PATCH] Add diagnostic output to svnversion_tests.py

From: Erik Hülsmann <e.huelsmann_at_gmx.net>
Date: 2003-08-05 07:46:10 CEST
('binary' encoding is not supported, stored as-is) Hi,

I changed the svnversion_tests.py file to generate diagnostic output like the run_and_verify_* series of commands does for svn.

Log message:

[[[

  * subversion/tests/clients/cmdline/svnversion_tests.py
     Added run_and_verify_svnversion procedure to generate
     diagnostic output when a test fails

]]]

the patch:

[[[
Index: subversion/tests/clients/cmdline/svnversion_tests.py
===================================================================
--- subversion/tests/clients/cmdline/svnversion_tests.py (revision 6645)
+++ subversion/tests/clients/cmdline/svnversion_tests.py (working copy)
@@ -30,6 +30,27 @@
 
 #----------------------------------------------------------------------
 
+def run_and_verify_svnversion(wc_dir, repo_url, expected_output):
+ "run the svnversion command and check it's output"
+ output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
+ if (expected_output and (errput or output != expected_output)):
+ print "COMMAND:\nsvnversion ", wc_dir, " ", repo_url
+ print "EXPECTED: (stdout)\n", expected_output
+ print "ACTUAL:\n", "stdout:\n", output
+ print "stderr:\n", errput
+ return 1
+ elif ((not expected_output) and (not errput or output)):
+ print "COMMAND:\nsvnversion ", wc_dir, " ", repo_url
+ print "EXPECTED: (stdout)\n(none)"
+ print "ACTUAL:\nstdout:\n", output
+ print "stderr:\n", errput
+ return 1
+ else:
+ return 0
+
+
+#----------------------------------------------------------------------
+
 def svnversion_test(sbox):
   "test 'svnversion' on a working copy and other directories"
   sbox.build()
@@ -37,21 +58,18 @@
   repo_url = sbox.repo_url
 
   # Unmodified
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1\n" ]:
+ if run_and_verify_svnversion(wc_dir, repo_url, [ "1\n" ]):
     raise svntest.Failure
 
   # Unmodified, whole wc switched
- output, errput = svntest.main.run_svnversion(wc_dir, "some/other/url")
- if errput or output != [ "1S\n" ]:
+ if run_and_verify_svnversion(wc_dir, "some/other/url", [ "1S\n" ]):
     raise svntest.Failure
 
   mu_path = os.path.join(wc_dir, 'A', 'mu')
   svntest.main.file_append (mu_path, 'appended mu text')
 
   # Text modified
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1M\n" ]:
+ if run_and_verify_svnversion(wc_dir, repo_url, [ "1M\n" ]):
     raise svntest.Failure
 
   expected_output = wc.State(wc_dir, {'A/mu' : Item(verb='Sending')})
@@ -65,8 +83,7 @@
     raise svntest.Failure
 
   # Unmodified, mixed
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1:2\n" ]:
+ if run_and_verify_svnversion(wc_dir, repo_url, [ "1:2\n" ]):
     raise svntest.Failure
 
   output, errput = svntest.main.run_svn(None, 'propset', 'blue', 'azul',
@@ -75,8 +92,7 @@
     raise svntest.Failure
 
   # Prop modified, mixed
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1:2M\n" ]:
+ if run_and_verify_svnversion(wc_dir, repo_url, [ "1:2M\n" ]):
     raise svntest.Failure
 
   iota_path = os.path.join(wc_dir, 'iota')
@@ -97,28 +113,24 @@
     raise svntest.Failure
 
   # Prop modified, mixed, part wc switched
- output, errput = svntest.main.run_svnversion(wc_dir, repo_url)
- if errput or output != [ "1:2MS\n" ]:
+ if run_and_verify_svnversion(wc_dir, repo_url, [ "1:2MS\n" ]):
     raise svntest.Failure
 
   # Plain (exported) directory that is a direct subdir of a versioned dir
   Q_path = os.path.join(wc_dir, 'Q')
   os.mkdir(Q_path)
- output, errput = svntest.main.run_svnversion(Q_path, repo_url)
- if errput or output != [ "exported\n" ]:
+ if run_and_verify_svnversion(Q_path, repo_url, [ "exported\n" ]):
     raise svntest.Failure
 
   # Plain (exported) directory that is not a direct subdir of a versioned dir
   R_path = os.path.join(Q_path, 'Q')
   os.mkdir(R_path)
- output, errput = svntest.main.run_svnversion(R_path, repo_url)
- if errput or output != [ "exported\n" ]:
+ if run_and_verify_svnversion(R_path, repo_url, [ "exported\n" ]):
     raise svntest.Failure
 
   # No directory generates an error
- output, errput = svntest.main.run_svnversion(os.path.join(wc_dir, 'Q', 'X'),
- repo_url)
- if not errput or output:
+ if run_and_verify_svnversion(os.path.join(wc_dir, 'Q', 'X'),
+ repo_url, None):
     raise svntest.Failure
 
]]]

end of the patch

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Aug 5 07:47:06 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.