$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r83612 - trunk/tools/regression/src
From: steven_at_[hidden]
Date: 2013-03-27 16:59:53
Author: steven_watanabe
Date: 2013-03-27 16:59:52 EDT (Wed, 27 Mar 2013)
New Revision: 83612
URL: http://svn.boost.org/trac/boost/changeset/83612
Log:
Fix target directory calculation for libraries that have test sources in a subdirectory.  The compile actions were (incorrectly) being separated from the link and run actions in regex, spirit and others.
Text files modified: 
   trunk/tools/regression/src/process_jam_log.cpp |    32 ++++++++++++++++++++++++++++++++        
   1 files changed, 32 insertions(+), 0 deletions(-)
Modified: trunk/tools/regression/src/process_jam_log.cpp
==============================================================================
--- trunk/tools/regression/src/process_jam_log.cpp	(original)
+++ trunk/tools/regression/src/process_jam_log.cpp	2013-03-27 16:59:52 EDT (Wed, 27 Mar 2013)
@@ -144,6 +144,10 @@
   }
 
 
+  string test_path_to_library_name( string const& path );
+  string test_name( const string & s );
+
+
 //  extract a target directory path from a jam target string  ----------------//
 //  s may be relative to the initial_path:
 //    ..\..\..\libs\foo\build\bin\libfoo.lib\vc7\debug\runtime-link-dynamic\boo.obj
@@ -160,6 +164,34 @@
     temp = split( trim_left( temp ) ).back();
     if ( temp[0] == '.' ) temp.erase( 0, temp.find_first_not_of( "./" ) ); 
     else temp.erase( 0, locate_root.string().size()+1 );
+
+    std::string testid = test_path_to_library_name( temp ) + "/" + test_name( temp );
+    test2info_map::const_iterator info = test2info.find(testid);
+    if ( info != test2info.end() )
+    {
+      // Only keep path components that are part of the
+      // build variant.
+
+      string source_directory = info->second.file_path;
+      string::size_type last = source_directory.find_last_of( "/" );
+      if ( last == string::npos )
+        source_directory.clear();
+      else
+        source_directory.erase( last );
+
+      // find the start of the shared tail
+      string::size_type source_pos = source_directory.size(), temp_pos = temp.size();
+      for ( ; source_pos != 0 && temp_pos != 0; --source_pos, --temp_pos )
+      {
+        if ( source_directory[ source_pos - 1 ] != temp[ temp_pos - 1 ] ) break;
+      }
+
+      // erase all path components in the shared tail
+      temp_pos = temp.find( '/', temp_pos );
+      if ( temp_pos != string::npos )
+        temp.erase( temp_pos );
+    }
+
     if ( echo )
         std::cout << "\ttarget_directory( \"" << s << "\") -> \"" << temp << "\"" << std::endl;
     return temp;