hwri...@apache.org wrote on Tue, Nov 09, 2010 at 20:09:53 -0000:
> * STATUS: Add note to the r964349 group.

> @@ -350,6 +350,8 @@ Approved changes:
>     Create fails.log files for test runs.
>     Justification:
>       Developer convenience.
> +   Notes:
> +     Somewhat non-trivial merge conflicts.
>     Votes:
>       +1: danielsh, cmpilato, stsp

Sorry about this.  I've put together a backport, but don't have
a 1.6.x build environment for some reason.  Shall I just commit this (it
should work...), or is someone able to test/commit this for me please?

(The backport already has three +1 votes.)

[[[
Index: .
===================================================================
--- .   (revision 1033278)
+++ .   (working copy)

Property changes on: .
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /subversion/trunk:r964349
Index: win-tests.py
===================================================================
--- win-tests.py        (revision 1033278)
+++ win-tests.py        (working copy)
@@ -103,6 +103,7 @@ base_url, fs_type, verbose, cleanup = None, None,
 repo_loc = 'local repository.'
 objdir = 'Debug'
 log = 'tests.log'
+faillog = 'fails.log'
 run_svnserve = None
 svnserve_args = None
 run_httpd = None
@@ -196,13 +197,16 @@ if base_url:
   repo_loc = 'remote repository ' + base_url + '.'
   if base_url[:4] == 'http':
     log = 'dav-tests.log'
+    faillog = 'dav-fails.log'
   elif base_url[:3] == 'svn':
     log = 'svn-tests.log'
+    faillog = 'svn-fails.log'
     run_svnserve = 1
   else:
     # Don't know this scheme, but who're we to judge whether it's
     # correct or not?
     log = 'url-tests.log'
+    faillog = 'url-fails.log'
 
 # Have to move the executables where the tests expect them to be
 copied_execs = []   # Store copied exec files to avoid the final dir scan
@@ -583,6 +587,7 @@ sys.path.insert(0, os.path.join(abs_srcdir, 'build
 import run_tests
 th = run_tests.TestHarness(abs_srcdir, abs_builddir,
                            os.path.join(abs_builddir, log),
+                           os.path.join(abs_builddir, faillog),
                            base_url, fs_type, http_library,
                            server_minor_version, 1, cleanup,
                            enable_sasl, parallel, config_file,
Index: build/run_tests.py
===================================================================
--- build/run_tests.py  (revision 1033278)
+++ build/run_tests.py  (working copy)
@@ -15,7 +15,7 @@ to the TestHarness constructor.  All other paramet
 test programs.
 '''
 
-import os, sys
+import os, re, sys
 import time
 
 import getopt
@@ -28,7 +28,7 @@ class TestHarness:
   '''Test harness for Subversion tests.
   '''
 
-  def __init__(self, abs_srcdir, abs_builddir, logfile,
+  def __init__(self, abs_srcdir, abs_builddir, logfile, faillogfile,
                base_url=None, fs_type=None, http_library=None,
                server_minor_version=None, verbose=None,
                cleanup=None, enable_sasl=None, parallel=None, config_file=None,
@@ -47,6 +47,7 @@ class TestHarness:
     self.srcdir = abs_srcdir
     self.builddir = abs_builddir
     self.logfile = logfile
+    self.faillogfile = faillogfile
     self.base_url = base_url
     self.fs_type = fs_type
     self.http_library = http_library
@@ -106,6 +107,27 @@ class TestHarness:
                                       's'*min(len(failed_list), 1)))
       if xpassed:
         print('  %d test%s XPASSED' % (len(xpassed), 's'*min(len(xpassed), 1)))
+    # Copy the truly interesting verbose logs to a separate file, for easier
+    # viewing.
+    if xpassed or failed_list:
+      faillog = open(self.faillogfile, 'wb')
+      last_start_lineno = None
+      last_start_re = re.compile('^(FAIL|SKIP|XFAIL|PASS|START|CLEANUP|END):')
+      for lineno, line in enumerate(log_lines):
+        # Iterate the lines.  If it ends a test we're interested in, dump that
+        # test to FAILLOG.  If it starts a test (at all), remember the line
+        # number (in case we need it later).
+        if line in xpassed or line in failed_list:
+          faillog.write('[[[\n')
+          faillog.writelines(log_lines[last_start_lineno : lineno+1])
+          faillog.write(']]]\n\n')
+        if last_start_re.match(line):
+          last_start_lineno = lineno + 1
+      faillog.close()
+    elif os.path.exists(self.faillogfile):
+      print("WARNING: no failures, but '%s' exists from a previous run."
+            % self.faillogfile)
+
     self._close_log()
     return failed
 
@@ -281,7 +303,7 @@ def main():
       raise getopt.GetoptError
 
   th = TestHarness(args[0], args[1],
-                   os.path.abspath('tests.log'),
+                   os.path.abspath('tests.log'), os.path.abspath('fails.log'),
                    base_url, fs_type, http_library, server_minor_version,
                    verbose, cleanup, enable_sasl, parallel, config_file,
                    fsfs_sharding, fsfs_packing)
]]]

Thanks,

Daniel

Reply via email to