subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1703740 - in /subversion/trunk: Makefile.in build/run_tests.py subversion/tests/cmdline/svntest/main.py win-tests.py
Date Fri, 18 Sep 2015 04:52:22 GMT
Author: brane
Date: Fri Sep 18 04:52:22 2015
New Revision: 1703740

URL: http://svn.apache.org/viewvc?rev=1703740&view=rev
Log:
Correctly propagate the log level through the multiple layers of test
suite infrastructure and make sure the default log level is the same
on all platforms and across all types of tests.

* build/run_tests.py
  (create_parser): Make the --verbose option behave exactly as in the
   Python test drivers: i.e., set the log level to DEBUG.
  (TestHarness._init_c_tests): Pass --verbose to the C tests if the
   log level is DEBUG or less (that is, more verbose).
  (TestHarness._init_py_tests): Never send the --verbose option to the
   Python test driver; always use --set-log-level.
* subversion/tests/cmdline/svntest/main.py
  (TestSpawningThread.run_one): Likewise, tell the testcase subprocess
   what the actual log level is instead of passing -v (--verbose).

* Makefile.in
  (check): Do not make tests logs verbose by default.
* win-tests.py:
   Make the -v/--verbose option set the log level to DEBUG.
  (_usage_exit): Deprecate the -q/--quiet option as it is now a no-op.

Modified:
    subversion/trunk/Makefile.in
    subversion/trunk/build/run_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/main.py
    subversion/trunk/win-tests.py

Modified: subversion/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/trunk/Makefile.in?rev=1703740&r1=1703739&r2=1703740&view=diff
==============================================================================
--- subversion/trunk/Makefile.in (original)
+++ subversion/trunk/Makefile.in Fri Sep 18 04:52:22 2015
@@ -519,7 +519,6 @@ check-all-javahl: check-apache-javahl ch
 #  will perform only basic tests (likewise for other tests).
 check: bin @TRANSFORM_LIBTOOL_SCRIPTS@ $(TEST_DEPS) @BDB_TEST_DEPS@
 	@if test "$(PYTHON)" != "none"; then                                 \
-	  flags="--verbose";                                                 \
 	  if test "$(CLEANUP)" != ""; then                                   \
 	    flags="--cleanup $$flags";                                       \
 	  fi;                                                                \

Modified: subversion/trunk/build/run_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=1703740&r1=1703739&r2=1703740&view=diff
==============================================================================
--- subversion/trunk/build/run_tests.py (original)
+++ subversion/trunk/build/run_tests.py Fri Sep 18 04:52:22 2015
@@ -46,6 +46,7 @@ separated list of test numbers; the defa
 
 import os, sys
 import re
+import logging
 import optparse, subprocess, imp, threading, traceback, exceptions
 from datetime import datetime
 
@@ -181,7 +182,8 @@ class TestHarness:
     # ### Support --repos-template
     if self.opts.list_tests is not None:
       cmdline.append('--list')
-    if self.opts.verbose is not None:
+    if (self.opts.set_log_level is not None
+        and self.opts.set_log_level <= logging.DEBUG):
       cmdline.append('--verbose')
     if self.opts.cleanup is not None:
       cmdline.append('--cleanup')
@@ -204,8 +206,6 @@ class TestHarness:
     cmdline = ['--srcdir=%s' % self.srcdir]
     if self.opts.list_tests is not None:
       cmdline.append('--list')
-    if self.opts.verbose is not None:
-      cmdline.append('--verbose')
     if self.opts.cleanup is not None:
       cmdline.append('--cleanup')
     if self.opts.parallel is not None:
@@ -693,11 +693,17 @@ class TestHarness:
 
 
 def create_parser():
+  def set_log_level(option, opt, value, parser, level=None):
+    if level is None:
+      level = value
+    parser.values.set_log_level = getattr(logging, level, None) or int(level)
+
   parser = optparse.OptionParser(usage=__doc__);
 
   parser.add_option('-l', '--list', action='store_true', dest='list_tests',
                     help='Print test doc strings instead of running them')
-  parser.add_option('-v', '--verbose', action='store_true',
+  parser.add_option('-v', '--verbose', action='callback',
+                    callback=set_log_level, callback_args=(logging.DEBUG, ),
                     help='Print binary command-lines')
   parser.add_option('-c', '--cleanup', action='store_true',
                     help='Clean up after successful tests')
@@ -735,7 +741,8 @@ def create_parser():
   parser.add_option('--mode-filter', action='store', dest='mode_filter',
                     default='ALL',
                     help='Limit tests to those with type specified (e.g. XFAIL)')
-  parser.add_option('--set-log-level', action='store',
+  parser.add_option('--set-log-level', action='callback', type='str',
+                    callback=set_log_level,
                     help="Set log level (numerically or symbolically). " +
                          "Symbolic levels are: CRITICAL, ERROR, WARNING, " +
                          "INFO, DEBUG")
@@ -753,6 +760,8 @@ def create_parser():
                     help='Use sqlite exclusive locking for working copies')
   parser.add_option('--memcached-server', action='store',
                     help='Use memcached server at specified URL (FSFS only)')
+
+  parser.set_defaults(set_log_level=None)
   return parser
 
 def main():

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1703740&r1=1703739&r2=1703740&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Fri Sep 18 04:52:22 2015
@@ -1585,13 +1585,12 @@ class TestSpawningThread(threading.Threa
     args = []
     args.append(str(index))
     args.append('-c')
+    args.append('--set-log-level=%s' % logger.getEffectiveLevel())
     # add some startup arguments from this process
     if options.fs_type:
       args.append('--fs-type=' + options.fs_type)
     if options.test_area_url:
       args.append('--url=' + options.test_area_url)
-    if logger.getEffectiveLevel() <= logging.DEBUG:
-      args.append('-v')
     if options.cleanup:
       args.append('--cleanup')
     if options.enable_sasl:

Modified: subversion/trunk/win-tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/win-tests.py?rev=1703740&r1=1703739&r2=1703740&view=diff
==============================================================================
--- subversion/trunk/win-tests.py (original)
+++ subversion/trunk/win-tests.py Fri Sep 18 04:52:22 2015
@@ -31,6 +31,7 @@ import os, sys, subprocess
 import filecmp
 import shutil
 import traceback
+import logging
 try:
   # Python >=3.0
   import configparser
@@ -59,7 +60,6 @@ def _usage_exit():
   print("  -u URL, --url=URL      : run ra_dav or ra_svn tests against URL;")
   print("                           will start svnserve for ra_svn tests")
   print("  -v, --verbose          : talk more")
-  print("  -q, --quiet            : talk less")
   print("  -f, --fs-type=type     : filesystem type to use (fsfs is default)")
   print("  -c, --cleanup          : cleanup after running a test")
   print("  -t, --test=TEST        : Run the TEST test (all is default); use")
@@ -108,6 +108,8 @@ def _usage_exit():
   print("  --config-file          : Configuration file for tests")
   print("  --fsfs-sharding        : Specify shard size (for fsfs)")
   print("  --fsfs-packing         : Run 'svnadmin pack' automatically")
+  print("  -q, --quiet            : Deprecated; this is the default.")
+  print("                           Use --set-log-level instead.")
 
   sys.exit(0)
 
@@ -141,7 +143,7 @@ if len(args) > 1:
   print('Warning: non-option arguments after the first one will be ignored')
 
 # Interpret the options and set parameters
-base_url, fs_type, verbose, quiet, cleanup = None, None, None, None, None
+base_url, fs_type, verbose, cleanup = None, None, None, None
 repo_loc = 'local repository.'
 objdir = 'Debug'
 log = 'tests.log'
@@ -187,8 +189,7 @@ for opt, val in opts:
     fs_type = val
   elif opt in ('-v', '--verbose'):
     verbose = 1
-  elif opt in ('-q', '--quiet'):
-    quiet = 1
+    log_level = logging.DEBUG
   elif opt in ('-c', '--cleanup'):
     cleanup = 1
   elif opt in ('-t', '--test'):
@@ -250,7 +251,7 @@ for opt, val in opts:
   elif opt == '--log-to-stdout':
     log_to_stdout = 1
   elif opt == '--log-level':
-    log_level = val
+    log_level = getattr(logging, val, None) or int(val)
   elif opt == '--ssl-cert':
     ssl_cert = val
   elif opt == '--exclusive-wc-locks':
@@ -999,7 +1000,6 @@ if not test_javahl and not test_swig:
   opts.fs_type = fs_type
   opts.http_library = 'serf'
   opts.server_minor_version = server_minor_version
-  opts.verbose = not quiet
   opts.cleanup = cleanup
   opts.enable_sasl = enable_sasl
   opts.parallel = parallel



Mime
View raw message