Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78671 - in trunk/tools/build/v2: test tools
From: jurko.gospodnetic_at_[hidden]
Date: 2012-05-27 02:36:50


Author: jurko
Date: 2012-05-27 02:36:49 EDT (Sun, 27 May 2012)
New Revision: 78671
URL: http://svn.boost.org/trac/boost/changeset/78671

Log:
Fix for Boost Build testing.jam module's time action on Windows. It now no longer outputs extra quote characters when run under the Windows cmd shell and so no longer fails when Boost Build passes it an even number of sources. Updated related unit test (to see the full effect run using the Windows cmd shell and the Cygwin gcc toolset as this test still fails for other reasons when using the msvc toolset). Better commented related code.
Text files modified:
   trunk/tools/build/v2/test/timedata.py | 8 +++++---
   trunk/tools/build/v2/tools/testing-aux.jam | 14 ++++++++++++--
   trunk/tools/build/v2/tools/testing.jam | 14 ++++++++++++--
   3 files changed, 29 insertions(+), 7 deletions(-)

Modified: trunk/tools/build/v2/test/timedata.py
==============================================================================
--- trunk/tools/build/v2/test/timedata.py (original)
+++ trunk/tools/build/v2/test/timedata.py 2012-05-27 02:36:49 EDT (Sun, 27 May 2012)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 # Copyright 2005 David Abrahams
-# Copyright 2008 Jurko Gospodnetic
+# Copyright 2008, 2012 Jurko Gospodnetic
 # 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)
 
@@ -104,8 +104,10 @@
     t.expect_addition("bin/$toolset/debug/my-exe.exe")
     t.expect_addition("bin/$toolset/debug/my-time.time")
 
- t.expect_content_line("bin/$toolset/debug/my-time.time", "user: *")
- t.expect_content_line("bin/$toolset/debug/my-time.time", "system: *")
+ t.expect_content_line("bin/$toolset/debug/my-time.time",
+ "user: *[0-9] seconds")
+ t.expect_content_line("bin/$toolset/debug/my-time.time",
+ "system: *[0-9] seconds")
 
     t.cleanup()
 

Modified: trunk/tools/build/v2/tools/testing-aux.jam
==============================================================================
--- trunk/tools/build/v2/tools/testing-aux.jam (original)
+++ trunk/tools/build/v2/tools/testing-aux.jam 2012-05-27 02:36:49 EDT (Sun, 27 May 2012)
@@ -178,11 +178,21 @@
     $(LAUNCHER) "$(>)" $(ARGS) && $(.MAKE_FILE) "$(<)"
 }
 
+# Note that this rule may be called multiple times for a single target in case
+# there are multiple actions operating on the same target in sequence. One such
+# example are msvc exe targets first created by a linker action and then updated
+# with an embedded manifest file by a separate action.
 rule record-time ( target : source : start end user system )
 {
     local src-string = [$(source:G=:J=",")"] " ;
     USER_TIME on $(target) += $(src-string)$(user) ;
     SYSTEM_TIME on $(target) += $(src-string)$(system) ;
+
+ # We need the following variables because attempting to perform such
+ # variable expansion in actions would not work due to quotes getting treated
+ # as regular characters.
+ USER_TIME_SECONDS on $(target) += $(src-string)$(user)" seconds" ;
+ SYSTEM_TIME_SECONDS on $(target) += $(src-string)$(system)" seconds" ;
 }
 
 # Calling this rule requests that Boost Build time how long it takes to build
@@ -205,6 +215,6 @@
     echo user: $(USER_TIME)
     echo system: $(SYSTEM_TIME)
 
- echo user: $(USER_TIME)" seconds" > "$(<)"
- echo system: $(SYSTEM_TIME)" seconds" >> "$(<)"
+ echo user: $(USER_TIME_SECONDS) > "$(<)"
+ echo system: $(SYSTEM_TIME_SECONDS) >> "$(<)"
 }

Modified: trunk/tools/build/v2/tools/testing.jam
==============================================================================
--- trunk/tools/build/v2/tools/testing.jam (original)
+++ trunk/tools/build/v2/tools/testing.jam 2012-05-27 02:36:49 EDT (Sun, 27 May 2012)
@@ -545,11 +545,21 @@
 generators.register-standard testing.time : : TIME ;
 
 
+# Note that this rule may be called multiple times for a single target in case
+# there are multiple actions operating on the same target in sequence. One such
+# example are msvc exe targets first created by a linker action and then updated
+# with an embedded manifest file by a separate action.
 rule record-time ( target : source : start end user system )
 {
     local src-string = [$(source:G=:J=",")"] " ;
     USER_TIME on $(target) += $(src-string)$(user) ;
     SYSTEM_TIME on $(target) += $(src-string)$(system) ;
+
+ # We need the following variables because attempting to perform such
+ # variable expansion in actions would not work due to quotes getting treated
+ # as regular characters.
+ USER_TIME_SECONDS on $(target) += $(src-string)$(user)" seconds" ;
+ SYSTEM_TIME_SECONDS on $(target) += $(src-string)$(system)" seconds" ;
 }
 
 
@@ -576,6 +586,6 @@
     echo user: $(USER_TIME)
     echo system: $(SYSTEM_TIME)
 
- echo user: $(USER_TIME)" seconds" > "$(<)"
- echo system: $(SYSTEM_TIME)" seconds" >> "$(<)"
+ echo user: $(USER_TIME_SECONDS) > "$(<)"
+ echo system: $(SYSTEM_TIME_SECONDS) >> "$(<)"
 }


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