Boost logo

Boost-Commit :

From: bdawes_at_[hidden]
Date: 2008-06-18 14:20:44


Author: bemandawes
Date: 2008-06-18 14:20:43 EDT (Wed, 18 Jun 2008)
New Revision: 46486
URL: http://svn.boost.org/trac/boost/changeset/46486

Log:
Restore functionality broken by reorganization. Fixes ticket #1995
Text files modified:
   trunk/tools/regression/src/compiler_status.cpp | 147 +++++++++++++++++++++++++++++----------
   trunk/tools/regression/src/process_jam_log.cpp | 136 +++++++++++++++++++++++-------------
   2 files changed, 192 insertions(+), 91 deletions(-)

Modified: trunk/tools/regression/src/compiler_status.cpp
==============================================================================
--- trunk/tools/regression/src/compiler_status.cpp (original)
+++ trunk/tools/regression/src/compiler_status.cpp 2008-06-18 14:20:43 EDT (Wed, 18 Jun 2008)
@@ -19,8 +19,11 @@
 
 *******************************************************************************/
 
+#include <boost/config/warning_disable.hpp>
+
 #include "boost/config.hpp"
 #include "boost/filesystem/operations.hpp"
+#include "boost/filesystem/convenience.hpp"
 #include "boost/filesystem/fstream.hpp"
 #include "detail/tiny_xml.hpp"
 namespace fs = boost::filesystem;
@@ -90,10 +93,10 @@
   std::vector<int> error_count;
 
   // prefix for library and test hyperlink prefix
- string cvs_root ( "http://boost.cvs.sourceforge.net/" );
- string url_prefix_dir_view( cvs_root + "boost/boost" );
- string url_prefix_checkout_view( cvs_root + "*checkout*/boost/boost" );
- string url_suffix_text_view( "?view=markup&rev=HEAD" );
+ string svn_root ( "http://svn.boost.org/trac/boost/browser/trunk/" );
+ string url_prefix_dir_view( svn_root );
+ string url_prefix_checkout_view( svn_root );
+ string url_suffix_text_view( "" );
 
 // get revision number (as a string) if boost_root is svn working copy -----//
 
@@ -349,7 +352,14 @@
   fs::path bin_path;
   if (boost_build_v2)
   {
- bin_path = locate_root / "bin.v2" / relative;
+ if ( relative == "status" )
+ bin_path = locate_root / "bin.v2" / "libs";
+ else
+ {
+ bin_path = locate_root / "bin.v2" / relative;
+ if (!fs::exists(bin_path))
+ bin_path = locate_root / "bin" / relative;
+ }
     if (!fs::exists(bin_path))
     {
       std::cerr << "warning: could not find build results for '"
@@ -732,6 +742,32 @@
     }
   }
 
+// find_compilers ------------------------------------------------------------//
+
+ void find_compilers(const fs::path & bin_dir)
+ {
+ fs::directory_iterator compiler_itr( bin_dir );
+ if ( specific_compiler.empty() )
+ std::clog << "Using " << bin_dir.string() << " to determine compilers\n";
+ for (; compiler_itr != end_itr; ++compiler_itr )
+ {
+ if ( fs::is_directory( *compiler_itr ) // check just to be sure
+ && compiler_itr->leaf() != "test" ) // avoid strange directory (Jamfile bug?)
+ {
+ if ( specific_compiler.size() != 0
+ && specific_compiler != compiler_itr->leaf() ) continue;
+ toolsets.push_back( compiler_itr->leaf() );
+ string desc( compiler_desc( compiler_itr->leaf() ) );
+ string vers( version_desc( compiler_itr->leaf() ) );
+ report << "<td>"
+ << (desc.size() ? desc : compiler_itr->leaf())
+ << (vers.size() ? (string( "<br>" ) + vers ) : string( "" ))
+ << "</td>\n";
+ error_count.push_back( 0 );
+ }
+ }
+ }
+
 // do_table_body -----------------------------------------------------------//
 
   void do_table_body( const fs::path & bin_dir )
@@ -746,30 +782,56 @@
     jamfile.clear();
     jamfile.seekg(0);
     string line;
+ bool run_tests = false;
+
     while( std::getline( jamfile, line ) )
     {
       bool v2(false);
- string::size_type pos( line.find( "subinclude" ) );
- if ( pos == string::npos ) {
- pos = line.find( "build-project" );
+ string::size_type sub_pos( line.find( "subinclude" ) );
+ if ( sub_pos == string::npos ) {
+ sub_pos = line.find( "build-project" );
         v2 = true;
       }
- if ( pos != string::npos
- && line.find( '#' ) > pos )
+ if ( sub_pos != string::npos
+ && line.find( '#' ) > sub_pos )
       {
         if (v2)
- pos = line.find_first_not_of( " \t./", pos+13 );
+ sub_pos = line.find_first_not_of( " \t./", sub_pos+13 );
         else
- pos = line.find_first_not_of( " \t./", pos+10 );
+ sub_pos = line.find_first_not_of( " \t./", sub_pos+10 );
       
- if ( pos == string::npos ) continue;
+ if ( sub_pos == string::npos ) continue;
         string subinclude_bin_dir(
- line.substr( pos, line.find_first_of( " \t", pos )-pos ) );
+ line.substr( sub_pos, line.find_first_of( " \t", sub_pos )-sub_pos ) );
 
         fs::path bin_path = find_bin_path(subinclude_bin_dir);
         if (!bin_path.empty())
           do_rows_for_sub_tree( bin_path, results );
       }
+ if ( ! run_tests )
+ {
+ string::size_type run_pos = line.find("run-tests");
+ if ( run_pos != string::npos && line.find_first_not_of(" \t") == run_pos )
+ run_tests = true;
+ }
+ else
+ {
+ if ( line.find(";") != string::npos )
+ run_tests = false;
+ else
+ {
+ string::size_type pos = line.find_first_not_of( " \t" );
+ if ( pos != string::npos && line[pos] != '#' )
+ {
+ string::size_type end_pos = line.find_first_of(" \t#", pos);
+ string::iterator end = end_pos != string::npos ? line.begin() + end_pos : line.end();
+ string run_tests_bin_dir(line.begin() + pos, end);
+ fs::path bin_path = find_bin_path("libs/" + run_tests_bin_dir);
+ if (!bin_path.empty())
+ do_rows_for_sub_tree( bin_path, results );
+ }
+ }
+ }
     }
 
 
@@ -789,7 +851,15 @@
     // - Boost.Build V2 location with top-lelve "build-dir"
     // - Boost.Build V1 location without ALL_LOCATE_TARGET
     string relative( fs::initial_path().string() );
- relative.erase( 0, boost_root.string().size()+1 );
+
+#ifdef BOOST_WINDOWS_API
+ if (relative.size() > 1 && relative[1] == ':') relative[0] = std::tolower(relative[0]);
+#endif
+
+ if ( relative.find(boost_root.string()) != string::npos )
+ relative.erase( 0, boost_root.string().size()+1 );
+ else if ( relative.find(locate_root.string()) != string::npos )
+ relative.erase( 0, locate_root.string().size()+1 );
     fs::path bin_path = find_bin_path(relative);
 
     report << "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n";
@@ -799,32 +869,29 @@
     report << "<tr><td>Library</td><td>Test Name</td>\n"
       "<td><a href=\"compiler_status.html#test-type\">Test Type</a></td>\n";
 
- fs::directory_iterator itr( bin_path );
- while ( itr != end_itr
- && ((itr->string().find( ".test" ) != (itr->string().size()-5))
- || !fs::is_directory( *itr )))
- ++itr; // bypass chaff
- if ( itr != end_itr )
- {
- fs::directory_iterator compiler_itr( *itr );
- if ( specific_compiler.empty() )
- std::clog << "Using " << itr->string() << " to determine compilers\n";
- for (; compiler_itr != end_itr; ++compiler_itr )
+ if ( relative == "status" )
+ {
+ fs::recursive_directory_iterator ritr( bin_path );
+ fs::recursive_directory_iterator end_ritr;
+ while ( ritr != end_ritr
+ && ((ritr->string().find( ".test" ) != (ritr->string().size()-5))
+ || !fs::is_directory( *ritr )))
+ ++ritr; // bypass chaff
+ if ( ritr != end_ritr )
       {
- if ( fs::is_directory( *compiler_itr ) // check just to be sure
- && compiler_itr->leaf() != "test" ) // avoid strange directory (Jamfile bug?)
- {
- if ( specific_compiler.size() != 0
- && specific_compiler != compiler_itr->leaf() ) continue;
- toolsets.push_back( compiler_itr->leaf() );
- string desc( compiler_desc( compiler_itr->leaf() ) );
- string vers( version_desc( compiler_itr->leaf() ) );
- report << "<td>"
- << (desc.size() ? desc : compiler_itr->leaf())
- << (vers.size() ? (string( "<br>" ) + vers ) : string( "" ))
- << "</td>\n";
- error_count.push_back( 0 );
- }
+ find_compilers( *ritr );
+ }
+ }
+ else
+ {
+ fs::directory_iterator itr( bin_path );
+ while ( itr != end_itr
+ && ((itr->string().find( ".test" ) != (itr->string().size()-5))
+ || !fs::is_directory( *itr )))
+ ++itr; // bypass chaff
+ if ( itr != end_itr )
+ {
+ find_compilers( *itr );
       }
     }
 

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 2008-06-18 14:20:43 EDT (Wed, 18 Jun 2008)
@@ -6,6 +6,8 @@
 
 // See http://www.boost.org/tools/regression for documentation.
 
+#include <boost/config/warning_disable.hpp>
+
 #include "detail/tiny_xml.hpp"
 #include "boost/filesystem/operations.hpp"
 #include "boost/filesystem/fstream.hpp"
@@ -155,7 +157,7 @@
     temp.erase( temp.find_last_of( "/" ) ); // remove leaf
     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 );
+ else if ( temp[0] == '/' ) temp.erase( 0, locate_root.string().size()+1 );
     if ( echo )
         std::cout << "\ttarget_directory( \"" << s << "\") -> \"" << temp << "\"" << std::endl;
     return temp;
@@ -555,57 +557,99 @@
   std::ios::sync_with_stdio(false);
 
   fs::initial_path();
+ std::istream* input = 0;
 
   if ( argc <= 1 )
- std::cout << "Usage: bjam [bjam-args] | process_jam_log [--echo] [--create-directories] [--v1|v2] [locate-root]\n"
- "locate-root - the same as the bjam ALL_LOCATE_TARGET\n"
- " parameter, if any. Default is boost-root.\n"
- "create-directories - if the directory for xml file doesn't exists - creates it.\n"
- " usually used for processing logfile on different machine\n"
- "v2 - bjam version 2 used (default).\n"
- "v1 - bjam version 1 used.\n"
- ;
-
- set_boost_root();
-
- boost_root.normalize();
-
- if ( argc > 1 && std::strcmp( argv[1], "--echo" ) == 0 )
- {
- echo = true;
- --argc; ++argv;
- }
-
+ std::cout << "process_jam_log [--echo] [--create-directories] [--v1|--v2]\n"
+ " [--boost-root boost_root] [--locate-root locate_root]\n"
+ " [--input-file input_file]\n"
+ "--echo - verbose diagnostic output.\n"
+ "--create-directories - if the directory for xml file doesn't exists - creates it.\n"
+ " usually used for processing logfile on different machine\n"
+ "--v2 - bjam version 2 used (default).\n"
+ "--v1 - bjam version 1 used.\n"
+ "--boost-root - the root of the boost installation being used. If not defined\n"
+ " assume to run from within it and discover it heuristically.\n"
+ "--locate-root - the same as the bjam ALL_LOCATE_TARGET\n"
+ " parameter, if any. Default is boost-root.\n"
+ "--input-file - the output of a bjam --dump-tests run. Default is std input.\n"
+ ;
 
- if (argc > 1 && std::strcmp( argv[1], "--create-directories" ) == 0 )
+ while ( argc > 1 )
   {
- create_dirs = true;
+ if ( std::strcmp( argv[1], "--echo" ) == 0 )
+ {
+ echo = true;
       --argc; ++argv;
- }
-
- if ( argc > 1 && std::strcmp( argv[1], "--v2" ) == 0 )
- {
- boost_build_v2 = true;
- --argc; ++argv;
- }
-
- if ( argc > 1 && std::strcmp( argv[1], "--v1" ) == 0 )
- {
- boost_build_v2 = false;
- --argc; ++argv;
- }
-
- if (argc > 1)
- {
+ }
+ else if ( std::strcmp( argv[1], "--create-directories" ) == 0 )
+ {
+ create_dirs = true;
+ --argc; ++argv;
+ }
+ else if ( std::strcmp( argv[1], "--v2" ) == 0 )
+ {
+ boost_build_v2 = true;
+ --argc; ++argv;
+ }
+ else if ( std::strcmp( argv[1], "--v1" ) == 0 )
+ {
+ boost_build_v2 = false;
+ --argc; ++argv;
+ }
+ else if ( std::strcmp( argv[1], "--boost-root" ) == 0 )
+ {
+ --argc; ++argv;
+ if ( argc == 1 )
+ {
+ std::cout << "Abort: option --boost-root requires a directory argument\n";
+ std::exit(1);
+ }
+ boost_root = fs::path( argv[1], fs::native );
+ if ( !boost_root.is_complete() )
+ boost_root = ( fs::initial_path() / boost_root ).normalize();
+
+ --argc; ++argv;
+ }
+ else if ( std::strcmp( argv[1], "--locate-root" ) == 0 )
+ {
+ --argc; ++argv;
+ if ( argc == 1 )
+ {
+ std::cout << "Abort: option --locate-root requires a directory argument\n";
+ std::exit(1);
+ }
       locate_root = fs::path( argv[1], fs::native );
       if ( !locate_root.is_complete() )
         locate_root = ( fs::initial_path() / locate_root ).normalize();
       
       --argc; ++argv;
- }
- else
+ }
+ else if ( std::strcmp( argv[1], "--input-file" ) == 0 )
+ {
+ --argc; ++argv;
+ if ( argc == 1 )
+ {
+ std::cout << "Abort: option --input-file requires a filename argument\n";
+ std::exit(1);
+ }
+ input = new std::ifstream(argv[1]);
+ --argc; ++argv;
+ }
+ }
+
+ if ( boost_root.empty() )
+ {
+ set_boost_root();
+ boost_root.normalize();
+ }
+ if ( locate_root.empty() )
+ {
+ locate_root = boost_root;
+ }
+ if ( input == 0 )
   {
- locate_root = boost_root;
+ input = &std::cin;
   }
 
   std::cout << "boost_root: " << boost_root.string() << '\n'
@@ -617,16 +661,6 @@
   string content;
   bool capture_lines = false;
 
- std::istream* input;
- if (argc > 1)
- {
- input = new std::ifstream(argv[1]);
- }
- else
- {
- input = &std::cin;
- }
-
   // This loop looks at lines for certain signatures, and accordingly:
   // * Calls start_message() to start capturing lines. (start_message() will
   // automatically call stop_message() if needed.)


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