Boost logo

Boost-Commit :

From: ghost_at_[hidden]
Date: 2007-12-25 04:43:45


Author: vladimir_prus
Date: 2007-12-25 04:43:44 EST (Tue, 25 Dec 2007)
New Revision: 42301
URL: http://svn.boost.org/trac/boost/changeset/42301

Log:
Make the Tester.copy method open files in binary mode.
This fixes the searched_lib.py failure on Windows.

Patch from Jurko Gospodnetic.

Text files modified:
   trunk/tools/build/v2/test/BoostBuild.py | 16 ++++++++++------
   trunk/tools/build/v2/test/searched_lib.py | 15 +++++++--------
   2 files changed, 17 insertions(+), 14 deletions(-)

Modified: trunk/tools/build/v2/test/BoostBuild.py
==============================================================================
--- trunk/tools/build/v2/test/BoostBuild.py (original)
+++ trunk/tools/build/v2/test/BoostBuild.py 2007-12-25 04:43:44 EST (Tue, 25 Dec 2007)
@@ -298,7 +298,7 @@
     def copy(self, src, dst):
         self.wait_for_time_change()
         try:
- self.write(dst, self.read(src))
+ self.write(dst, self.read(src, 1))
         except:
             self.fail_test(1)
 
@@ -306,13 +306,13 @@
         src_name = self.native_file_name(src)
         dst_name = self.native_file_name(dst)
         stats = os.stat(src_name)
- self.write(dst, self.read(src))
+ self.write(dst, self.read(src, 1))
         os.utime(dst_name, (stats.st_atime, stats.st_mtime))
         
     def touch(self, names):
         self.wait_for_time_change()
         for name in self.adjust_names(names):
- os.utime(self.native_file_name(name), None)
+ os.utime(self.native_file_name(name), None)
 
     def rm(self, names):
         self.wait_for_time_change()
@@ -437,12 +437,17 @@
                 result = result[0]
         return result
 
- def read(self, name):
+ def read(self, name, binary = 0):
         try:
             if self.toolset:
                 name = string.replace(name, "$toolset", self.toolset+"*")
             name = self.glob_file(name)
- return open(name, "rU").read()
+ openMode = "r"
+ if ( binary ):
+ openMode += "b"
+ else:
+ openMode += "U"
+ return open(name, openMode).read()
         except:
             annotation("reason", "Could not open '%s'" % name)
             self.fail_test(1)
@@ -522,7 +527,6 @@
         self.ignore_elements(self.unexpected_difference.modified_files, wildcard)
 
     def expect_touch(self, names):
-
         d = self.unexpected_difference
         for name in self.adjust_names(names):
 

Modified: trunk/tools/build/v2/test/searched_lib.py
==============================================================================
--- trunk/tools/build/v2/test/searched_lib.py (original)
+++ trunk/tools/build/v2/test/searched_lib.py 2007-12-25 04:43:44 EST (Tue, 25 Dec 2007)
@@ -1,19 +1,19 @@
 #!/usr/bin/python
 
-# Copyright 2003 Dave Abrahams
-# Copyright 2003, 2004, 2005, 2006 Vladimir Prus
-# Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+# Copyright 2003 Dave Abrahams
+# Copyright 2003, 2004, 2005, 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
 # Test usage of searched-libs: one which are found via -l
-# switch to the linker/compiler.
+# switch to the linker/compiler.
 
 from BoostBuild import Tester, get_toolset
 import string
 import os
 t = Tester()
 
-# To start with, we have to prepate a library to link with
+# To start with, we have to prepare a library to link with.
 t.write("lib/project-root.jam", "")
 t.write("lib/Jamfile", "lib test_lib : test_lib.cpp ;")
 t.write("lib/test_lib.cpp", """
@@ -28,7 +28,6 @@
 
 # Auto adjusting of suffixes does not work, since we need to
 # change dll to lib.
-#
 if (os.name == 'nt' or os.uname()[0].lower().startswith('cygwin')) and get_toolset() != 'gcc':
     t.copy("lib/bin/$toolset/debug/test_lib.implib", "lib/test_lib.implib")
     t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/test_lib.dll")
@@ -104,7 +103,7 @@
 # A regression test: <library>property referring to
 # searched-lib was mishandled. As the result, we were
 # putting target name to the command line!
-# Note that
+# Note that
 # g++ ...... <.>z
 # works nicely in some cases, sending output from compiler
 # to file 'z'.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk