Boost logo

Boost-Build :

From: Jurko Gospodnetiæ (jurko.gospodnetic_at_[hidden])
Date: 2007-12-23 01:07:13


   Hi.

   Attached patch fixes the failing searched_lib.py test on Windows.
Problem was that build DLL and import library files were getting copied
by reading them in text mode. Corrected by adding a new default 'binary'
parameter flag to the Tester.read() method and calling it with the
binary flag set in both Tester copy operations.

   Besides that the rest are just a few cosmetic changes.

   And I noticed that the Tester.read_and_strip() method has something
fishy in it related to how it handles trailing new-line characters.
Unless I'm reading this Python code incorrectly it seems to add another
newline in case the read text already ends with a newline but otherwise
does not. Was that by design or was the intent to add a newline to files
that do not end with one? I tried running the tests with the if in this
function reversed and it made no difference.

   My failed test count is now down to 4, 2 of which seem to be timer
related (record_time rule) and 1 is the alias warning test I added for
the related defect report.

   Best regards,
     Jurko Gospodnetiæ

Left base folder: X:\Boost_Build\20071222_nightly_build\Original\boost-build
Right base folder: X:\Boost_Build\20071222_nightly_build\Modified\boost-build
--- test\BoostBuild.py 2007-12-21 15:33:44.000000000 +-0100
+++ test\BoostBuild.py 2007-12-23 06:43:57.000000000 +-0100
@@ -295,27 +295,27 @@
         os.rename(old, new)
         self.touch(new);
 
     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)
 
     def copy_preserving_timestamp(self, src, dst):
         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()
         if not type(names) == types.ListType:
             names = [names]
 
@@ -434,18 +434,23 @@
         if not result:
             result = glob.glob(self.native_file_name(name))
             if result:
                 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)
             return ''
 
     def read_and_strip(self, name):
@@ -519,13 +524,12 @@
                         self.fail_test(1)
 
     def ignore_modification(self, wildcard):
         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):
 
             # We need to check in both touched and modified files.
             # The reason is that:
             # (1) for windows binaries often have slight
--- test\searched_lib.py 2007-12-21 15:33:44.000000000 +-0100
+++ test\searched_lib.py 2007-12-23 05:35:17.000000000 +-0100
@@ -1,22 +1,22 @@
 #!/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", """
 #ifdef _WIN32
 __declspec(dllexport)
 #endif
@@ -25,13 +25,12 @@
 
 t.run_build_system(subdir="lib")
 t.expect_addition("lib/bin/$toolset/debug/test_lib.dll")
 
 # 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")
 else:
     t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/test_lib.dll")
 
@@ -101,13 +100,13 @@
 t.expect_addition("bin/$toolset/debug/link-static/helper.lib")
 t.rm("bin/$toolset/debug/main.exe")
 
 # 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'.
 # This problem shows up when searched libs are in usage
 # requirements.
 


Boost-Build 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