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

[PATCH] Make win_tests.py work out-of-the-box

From: Suraj Barkale <surajbarkale_at_gmail.com>
Date: 2007-01-05 07:26:45 CET

Hi All,
    Please ignore patch in my previous mail as I have included it in this one.
This patch removes the need to copy all Python tests as suggested in INSTALL.
Now running win-tests.py is sufficient to launch all tests.

    Can somebody please test this patch independently? I have built Subversion
for the first time & I am not sure that I have done everything correctly.

[[[
Make win_tests.py work out-of-the-box

* build/run_tests.py
  This file tried to cwd to non existent build_dir/subversion/tests/cmdline
  directory for Python scripts. Now it passes build directory to all Python
  scripts and chages to same directory before launching test.

* subversion/tests/cmdline/svntest/main.py
  Added command line option '--build-dir' to change paths of executables to
  ones in the build directory.
  
* subversion/tests/libsvn_subr/target-test.py
  Added option processing code (copied from main.py) to accept different build
  directory.

* win-tests.py
  Copy BDB & OpenSSL dlls to build directory.
]]]

--
Suraj Barkale
Index: build/run_tests.py
===================================================================
--- build/run_tests.py	(revision 22912)
+++ build/run_tests.py	(working copy)
@@ -96,6 +96,8 @@
       progname = sys.executable
       cmdline = [quote(progname),
                  quote(os.path.join(self.srcdir, prog))]
+      progdir = self.builddir
+      cmdline.append(quote('--build-dir=' + self.builddir))
       if self.base_url is not None:
         cmdline.append(quote('--url=' + self.base_url))
       if self.enable_sasl is not None:
Index: subversion/tests/cmdline/svntest/main.py
===================================================================
--- subversion/tests/cmdline/svntest/main.py	(revision 22912)
+++ subversion/tests/cmdline/svntest/main.py	(working copy)
@@ -825,7 +825,7 @@
 
   opts, args = my_getopt(sys.argv[1:], 'vh',
                          ['url=', 'fs-type=', 'verbose', 'cleanup', 'list',
-                          'enable-sasl', 'help'])
+                          'enable-sasl', 'build-dir=', 'help'])
 
   for arg in args:
     if arg == "list":
@@ -860,6 +860,20 @@
     elif opt == "--enable-sasl":
       enable_sasl = 1
 
+    elif opt == "--build-dir":
+      build_dir = os.path.abspath(val)
+      global svn_binary, svnadmin_binary, svnlook_binary, svnsync_binary
+      global svnversion_binary
+      svn_binary = os.path.join(build_dir, 'subversion/svn/svn' + _exe)
+      svnadmin_binary = \
+        os.path.join(build_dir, 'subversion/svnadmin/svnadmin' + _exe)
+      svnlook_binary = \
+        os.path.join(build_dir, 'subversion/svnlook/svnlook' + _exe)
+      svnsync_binary = \
+        os.path.join(build_dir, 'subversion/svnsync/svnsync' + _exe)
+      svnversion_binary = \
+        os.path.join(build_dir, 'subversion/svnversion/svnversion' + _exe)
+
     elif opt == "-h" or opt == "--help":
       usage()
       sys.exit(0)
Index: subversion/tests/libsvn_subr/target-test.py
===================================================================
--- subversion/tests/libsvn_subr/target-test.py	(revision 22912)
+++ subversion/tests/libsvn_subr/target-test.py	(working copy)
@@ -18,6 +18,27 @@
 
 import os, sys, shutil, string
 
+import getopt
+try:
+  my_getopt = getopt.gnu_getopt
+except AttributeError:
+  my_getopt = getopt.getopt
+
+if sys.platform == 'win32':
+  _exe = '.exe'
+else:
+  _exe = ''
+
+progname = './target-test' + _exe
+
+# Get correct program path
+opts, args = my_getopt(sys.argv[1:], 'vbf',
+                       ['verbose', 'build-dir=', 'fs-type='])
+for opt, val in opts:
+  if opt == "--build-dir":
+    progname = os.path.join(os.path.abspath(val),
+                            'subversion/tests/libsvn_subr/target-test' + _exe)
+
 # The list of test cases: [(name, params, expected) ...]
 cwd = os.getcwd().replace('\\', '/')    # Use forward slashes on Windows
 tests = [('normal use',
@@ -67,11 +88,6 @@
 open('z/A/file', 'w').close()
 
 def _run_test(cmdline):
-  if sys.platform == 'win32':
-    progname = '.\\target-test.exe'
-  else:
-    progname = './target-test'
-
   infile, outfile, errfile = os.popen3(progname + ' ' + cmdline)
   stdout_lines = outfile.readlines()
   stderr_lines = errfile.readlines()
Index: win-tests.py
===================================================================
--- win-tests.py	(revision 22912)
+++ win-tests.py	(working copy)
@@ -210,10 +210,23 @@
   copy_changed_file(aprutil_dll_path, abs_objdir)
   copy_changed_file(apriconv_dll_path, abs_objdir)
 
-  libintl_path = get(cp, 'options', '--with-libintl', None)
-  if libintl_path is not None:
-    libintl_dll_path = os.path.join(libintl_path, 'bin', 'intl3_svn.dll')
-    copy_changed_file(libintl_dll_path, abs_objdir)
+  # List out all optional library dll locations as a tuple containg tuples of
+  # path to dll from base library path
+  opt_lib_dll_paths = {
+    '--with-libintl':     (('bin', 'intl3_svn.dll',),),
+    '--with-berkeley-db': (('bin', 'libdb44.dll',),
+                           ('bin', 'libdb44d.dll',),),
+    '--with-openssl': (('out32dll', 'libeay32.dll',),
+                       ('out32dll', 'ssleay32.dll',),)
+  }
+  # Check if user has supplied any option for the library and copy
+  # the dll if present
+  for (lib_opt, lib_dlls) in opt_lib_dll_paths.iteritems():
+    lib_path = get(cp, 'options', lib_opt, None)
+    if lib_path is not None:
+      for lib_dll_info in lib_dlls:
+        lib_dll_path = os.path.join(lib_path, *lib_dll_info)
+        copy_changed_file(lib_dll_path, abs_objdir)
 
   dll_path = reduce(lambda x, y: x + os.path.join(abs_objdir, y) + os.pathsep,
                     dll_paths, "")
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Jan 5 07:27:03 2007

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.