Index: compiler_status.cpp =================================================================== --- compiler_status.cpp (revision 46202) +++ compiler_status.cpp (working copy) @@ -21,6 +21,7 @@ #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 +91,10 @@ std::vector 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 +350,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 +740,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 << "" + << (desc.size() ? desc : compiler_itr->leaf()) + << (vers.size() ? (string( "
" ) + vers ) : string( "" )) + << "\n"; + error_count.push_back( 0 ); + } + } + } + // do_table_body -----------------------------------------------------------// void do_table_body( const fs::path & bin_dir ) @@ -746,30 +780,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 +849,10 @@ // - 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 ); + 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 << "\n"; @@ -799,34 +862,31 @@ report << "\n" "\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 ) + if ( relative == "status" ) { - 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 ) + 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 << "\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 ); + } + } report << "\n"; Index: process_jam_log.cpp =================================================================== --- process_jam_log.cpp (revision 46202) +++ process_jam_log.cpp (working copy) @@ -155,7 +155,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,58 +555,100 @@ 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" - ; + 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 euristically.\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" + ; - set_boost_root(); - - boost_root.normalize(); - - if ( argc > 1 && std::strcmp( argv[1], "--echo" ) == 0 ) + while ( argc > 1 ) { - echo = true; - --argc; ++argv; - } - - - if (argc > 1 && std::strcmp( argv[1], "--create-directories" ) == 0 ) - { - 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() ) { - locate_root = boost_root; + set_boost_root(); + boost_root.normalize(); } + if ( locate_root.empty() ) + { + locate_root = boost_root; + } + if ( input == 0 ) + { + input = &std::cin; + } std::cout << "boost_root: " << boost_root.string() << '\n' << "locate_root: " << locate_root.string() << '\n'; @@ -617,16 +659,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.)
LibraryTest NameTest Type" - << (desc.size() ? desc : compiler_itr->leaf()) - << (vers.size() ? (string( "
" ) + vers ) : string( "" )) - << "