You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by lg...@apache.org on 2013/07/04 16:21:29 UTC

svn commit: r1499763 - in /subversion/trunk: build/run_tests.py subversion/tests/cmdline/davautocheck.sh subversion/tests/cmdline/svntest/main.py

Author: lgo
Date: Thu Jul  4 14:21:29 2013
New Revision: 1499763

URL: http://svn.apache.org/r1499763
Log:
Enable davautocheck.sh and the test suite to be run with a proxy that 
requires authentication and is installed on another host.

* build/run_tests.py
  (TestHarness.__init__): Add http_proxy_username and http_proxy_password
      arguments. Pass these through to svntest.main.
  (main): Add http-proxy-username and http-proxy-password command-line
      arguments.

* subversion/tests/cmdline/davautocheck.sh
  (BASE_URL): Allow the user to specify a BASE_URL other than http://localhost,
      needed when using a proxy on another host.

* subversion/tests/cmdline/svntest/main.py
  (create_config_dir): When provided, add lines in the servers config file for
      http-proxy-username and http-proxy-password.
  (_create_parser): Add http-proxy-username and http-proxy-password command-line
      arguments.

Modified:
    subversion/trunk/build/run_tests.py
    subversion/trunk/subversion/tests/cmdline/davautocheck.sh
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/build/run_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=1499763&r1=1499762&r2=1499763&view=diff
==============================================================================
--- subversion/trunk/build/run_tests.py (original)
+++ subversion/trunk/build/run_tests.py Thu Jul  4 14:21:29 2013
@@ -126,7 +126,8 @@ class TestHarness:
                fsfs_sharding=None, fsfs_packing=None,
                list_tests=None, svn_bin=None, mode_filter=None,
                milestone_filter=None, set_log_level=None, ssl_cert=None,
-               http_proxy=None, exclusive_wc_locks=None):
+               http_proxy=None, http_proxy_username=None,
+               http_proxy_password=None, exclusive_wc_locks=None):
     '''Construct a TestHarness instance.
 
     ABS_SRCDIR and ABS_BUILDDIR are the source and build directories.
@@ -144,6 +145,8 @@ class TestHarness:
     in conjunction with LIST_TESTS, the only tests that are listed are
     those with an associated issue in the tracker which has a target
     milestone that matches the regex.
+    HTTP_PROXY (hostname:port), HTTP_PROXY_USERNAME and HTTP_PROXY_PASSWORD
+    define the params to run the tests over a proxy server.
     '''
     self.srcdir = abs_srcdir
     self.builddir = abs_builddir
@@ -179,6 +182,8 @@ class TestHarness:
     self.log = None
     self.ssl_cert = ssl_cert
     self.http_proxy = http_proxy
+    self.http_proxy_username = http_proxy_username
+    self.http_proxy_password = http_proxy_password
     self.exclusive_wc_locks = exclusive_wc_locks
     if not sys.stdout.isatty() or sys.platform == 'win32':
       TextColors.disable()
@@ -188,6 +193,7 @@ class TestHarness:
        there is a log file. Return zero iff all test programs passed.'''
     self._open_log('w')
     failed = 0
+
     for cnt, prog in enumerate(list):
       failed = self._run_test(prog, cnt, len(list)) or failed
 
@@ -483,6 +489,10 @@ class TestHarness:
       svntest.main.options.ssl_cert = self.ssl_cert
     if self.http_proxy is not None:
       svntest.main.options.http_proxy = self.http_proxy
+    if self.http_proxy_username is not None:
+          svntest.main.options.http_proxy_username = self.http_proxy_username
+    if self.http_proxy_password is not None:
+        svntest.main.options.http_proxy_password = self.http_proxy_password
     if self.exclusive_wc_locks is not None:
       svntest.main.options.exclusive_wc_locks = self.exclusive_wc_locks
 
@@ -649,7 +659,8 @@ def main():
                             'enable-sasl', 'parallel', 'config-file=',
                             'log-to-stdout', 'list', 'milestone-filter=',
                             'mode-filter=', 'set-log-level=', 'ssl-cert=',
-                            'http-proxy=', 'exclusive-wc-locks'])
+                            'http-proxy=', 'http-proxy-username=',
+                            'http-proxy-password=','exclusive-wc-locks'])
   except getopt.GetoptError:
     args = []
 
@@ -660,9 +671,10 @@ def main():
   base_url, fs_type, verbose, cleanup, enable_sasl, http_library, \
     server_minor_version, fsfs_sharding, fsfs_packing, parallel, \
     config_file, log_to_stdout, list_tests, mode_filter, milestone_filter, \
-    set_log_level, ssl_cert, http_proxy, exclusive_wc_locks = \
+    set_log_level, ssl_cert, http_proxy, http_proxy_username, \
+    http_proxy_password, exclusive_wc_locks = \
             None, None, None, None, None, None, None, None, None, None, None, \
-            None, None, None, None, None, None, None, None
+            None, None, None, None, None, None, None, None, None, None
   for opt, val in opts:
     if opt in ['-u', '--url']:
       base_url = val
@@ -700,6 +712,10 @@ def main():
       ssl_cert = val
     elif opt in ['--http-proxy']:
       http_proxy = val
+    elif opt in ['--http-proxy-username']:
+      http_proxy_username = val
+    elif opt in ['--http-proxy-password']:
+      http_proxy_password = val
     elif opt in ['--exclusive-wc-locks']:
       exclusive_wc_locks = 1
     else:
@@ -719,6 +735,8 @@ def main():
                    mode_filter=mode_filter, milestone_filter=milestone_filter,
                    set_log_level=set_log_level, ssl_cert=ssl_cert,
                    http_proxy=http_proxy,
+                   http_proxy_username=http_proxy_username,
+                   http_proxy_password=http_proxy_password,
                    exclusive_wc_locks=exclusive_wc_locks)
 
   failed = th.run(args[2:])

Modified: subversion/trunk/subversion/tests/cmdline/davautocheck.sh
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/davautocheck.sh?rev=1499763&r1=1499762&r2=1499763&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/davautocheck.sh (original)
+++ subversion/trunk/subversion/tests/cmdline/davautocheck.sh Thu Jul  4 14:21:29 2013
@@ -318,7 +318,13 @@ HTTPD_PID="$HTTPD_ROOT/pid"
 HTTPD_ACCESS_LOG="$HTTPD_ROOT/access_log"
 HTTPD_ERROR_LOG="$HTTPD_ROOT/error_log"
 HTTPD_MIME_TYPES="$HTTPD_ROOT/mime.types"
-BASE_URL="http://localhost:$HTTPD_PORT"
+if [ -z "$BASE_URL" ]; then
+  BASE_URL="http://localhost:$HTTPD_PORT"
+else
+  # Specify the public name of the host when using a proxy on another host, the
+  # port number will be appended.
+  BASE_URL="$BASE_URL:$HTTPD_PORT"
+fi
 HTTPD_USERS="$HTTPD_ROOT/users"
 
 mkdir "$HTTPD_ROOT" \

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1499763&r1=1499762&r2=1499763&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Thu Jul  4 14:21:29 2013
@@ -594,18 +594,30 @@ exclusive-locking = true
     if options.http_library:
       http_library_str = "http-library=%s" % (options.http_library)
     http_proxy_str = ""
+    http_proxy_username_str = ""
+    http_proxy_password_str = ""
     if options.http_proxy:
       http_proxy_parsed = urlparse("//" + options.http_proxy)
       http_proxy_str = "http-proxy-host=%s\n" % (http_proxy_parsed.hostname) + \
                        "http-proxy-port=%d" % (http_proxy_parsed.port or 80)
+    if options.http_proxy_username:
+      http_proxy_username_str = "http-proxy-username=%s" % \
+                                     (options.http_proxy_username)
+    if options.http_proxy_password:
+      http_proxy_password_str = "http-proxy-password=%s" % \
+                                     (options.http_proxy_password)
+
     server_contents = """
 #
 [global]
 %s
 %s
+%s
+%s
 store-plaintext-passwords=yes
 store-passwords=yes
-""" % (http_library_str, http_proxy_str)
+""" % (http_library_str, http_proxy_str, http_proxy_username_str,
+       http_proxy_password_str)
 
   file_write(cfgfile_cfg, config_contents)
   file_write(cfgfile_srv, server_contents)
@@ -1432,6 +1444,10 @@ class TestSpawningThread(threading.Threa
       args.append('--ssl-cert=' + options.ssl_cert)
     if options.http_proxy:
       args.append('--http-proxy=' + options.http_proxy)
+    if options.http_proxy-username:
+      args.append('--http-proxy-username=' + options.http_proxy_username)
+    if options.http_proxy-password:
+      args.append('--http-proxy-password=' + options.http_proxy_password)
     if options.exclusive_wc_locks:
       args.append('--exclusive-wc-locks')
 
@@ -1779,6 +1795,10 @@ def _create_parser():
                     help='Path to SSL server certificate.')
   parser.add_option('--http-proxy', action='store',
                     help='Use the HTTP Proxy at hostname:port.')
+  parser.add_option('--http-proxy-username', action='store',
+                    help='Username for the HTTP Proxy.')
+  parser.add_option('--http-proxy-password', action='store',
+                    help='Password for the HTTP Proxy.')
   parser.add_option('--tools-bin', action='store', dest='tools_bin',
                     help='Use the svn tools installed in this path')
   parser.add_option('--exclusive-wc-locks', action='store_true',