process_jam_log.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. // process jam regression test output into XML -----------------------------//
  2. // Copyright Beman Dawes 2002. Distributed under the Boost
  3. // Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/tools/regression for documentation.
  6. #include "detail/tiny_xml.hpp"
  7. #include "boost/filesystem/operations.hpp"
  8. #include "boost/filesystem/fstream.hpp"
  9. #include "boost/filesystem/exception.hpp"
  10. #include "boost/filesystem/convenience.hpp"
  11. #include <iostream>
  12. #include <string>
  13. #include <cstring>
  14. #include <map>
  15. #include <utility> // for make_pair
  16. #include <ctime>
  17. #include <cctype> // for tolower
  18. using std::string;
  19. namespace xml = boost::tiny_xml;
  20. namespace fs = boost::filesystem;
  21. #define BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE
  22. #include <boost/test/included/prg_exec_monitor.hpp>
  23. // options
  24. static bool echo = false;
  25. static bool create_dirs = false;
  26. static bool boost_build_v2 = false;
  27. namespace
  28. {
  29. struct test_info
  30. {
  31. string file_path; // relative boost-root
  32. string type;
  33. bool always_show_run_output;
  34. };
  35. typedef std::map< string, test_info > test2info_map; // key is test-name
  36. test2info_map test2info;
  37. fs::path boost_root;
  38. fs::path locate_root; // ALL_LOCATE_TARGET (or boost_root if none)
  39. // append_html -------------------------------------------------------------//
  40. void append_html( const string & src, string & target )
  41. {
  42. // there are a few lines we want to ignore
  43. if ( src.find( "th target..." ) != string::npos
  44. || src.find( "cc1plus.exe: warning: changing search order for system directory" ) != string::npos
  45. || src.find( "cc1plus.exe: warning: as it has already been specified as a non-system directory" ) != string::npos
  46. ) return;
  47. // on some platforms (e.g. tru64cxx) the following line is a real performance boost
  48. target.reserve(src.size() * 2 + target.size());
  49. for ( string::size_type pos = 0; pos < src.size(); ++pos )
  50. {
  51. if ( src[pos] == '<' ) target += "&lt;";
  52. else if ( src[pos] == '>' ) target += "&gt;";
  53. else if ( src[pos] == '&' ) target += "&amp;";
  54. else target += src[pos];
  55. }
  56. }
  57. // timestamp ---------------------------------------------------------------//
  58. string timestamp()
  59. {
  60. char run_date[128];
  61. std::time_t tod;
  62. std::time( &tod );
  63. std::strftime( run_date, sizeof(run_date),
  64. "%Y-%m-%d %X UTC", std::gmtime( &tod ) );
  65. return string( run_date );
  66. }
  67. // convert path separators to forward slashes ------------------------------//
  68. void convert_path_separators( string & s )
  69. {
  70. for ( string::iterator itr = s.begin(); itr != s.end(); ++itr )
  71. if ( *itr == '\\' || *itr == '!' ) *itr = '/';
  72. }
  73. // extract a target directory path from a jam target string ----------------//
  74. // s may be relative to the initial_path:
  75. // ..\..\..\libs\foo\build\bin\libfoo.lib\vc7\debug\runtime-link-dynamic\boo.obj
  76. // s may be absolute:
  77. // d:\myboost\libs\foo\build\bin\libfoo.lib\vc7\debug\runtime-link-dynamic\boo.obj
  78. // return path is always relative to the boost directory tree:
  79. // libs/foo/build/bin/libfs.lib/vc7/debug/runtime-link-dynamic
  80. string target_directory( const string & s )
  81. {
  82. string temp( s );
  83. convert_path_separators( temp );
  84. temp.erase( temp.find_last_of( "/" ) ); // remove leaf
  85. string::size_type pos = temp.find_last_of( " " ); // remove leading spaces
  86. if ( pos != string::npos ) temp.erase( 0, pos+1 );
  87. if ( temp[0] == '.' ) temp.erase( 0, temp.find_first_not_of( "./" ) );
  88. else temp.erase( 0, locate_root.string().size()+1 );
  89. //std::cout << "\"" << s << "\", \"" << temp << "\"" << std::endl;
  90. return temp;
  91. }
  92. string::size_type target_name_end( const string & s )
  93. {
  94. string::size_type pos = s.find( ".test/" );
  95. if ( pos == string::npos ) pos = s.find( ".dll/" );
  96. if ( pos == string::npos ) pos = s.find( ".so/" );
  97. if ( pos == string::npos ) pos = s.find( ".lib/" );
  98. if ( pos == string::npos ) pos = s.find( ".pyd/" );
  99. if ( pos == string::npos ) pos = s.find( ".a/" );
  100. return pos;
  101. }
  102. string toolset( const string & s )
  103. {
  104. string::size_type pos = target_name_end( s );
  105. if ( pos == string::npos ) return "";
  106. pos = s.find( "/", pos ) + 1;
  107. return s.substr( pos, s.find( "/", pos ) - pos );
  108. }
  109. string test_name( const string & s )
  110. {
  111. string::size_type pos = target_name_end( s );
  112. if ( pos == string::npos ) return "";
  113. string::size_type pos_start = s.rfind( '/', pos ) + 1;
  114. return s.substr( pos_start,
  115. (s.find( ".test/" ) != string::npos
  116. ? pos : s.find( "/", pos )) - pos_start );
  117. }
  118. // Take a path to a target directory of test, and
  119. // returns library name corresponding to that path.
  120. string test_path_to_library_name( string const& path )
  121. {
  122. std::string result;
  123. string::size_type start_pos( path.find( "libs/" ) );
  124. if ( start_pos != string::npos )
  125. {
  126. // The path format is ...libs/functional/hash/test/something.test/....
  127. // So, the part between "libs" and "test/something.test" can be considered
  128. // as library name. But, for some libraries tests are located too deep,
  129. // say numeric/ublas/test/test1 directory, and some libraries have tests
  130. // in several subdirectories (regex/example and regex/test). So, nested
  131. // directory may belong to several libraries.
  132. // To disambituate, it's possible to place a 'sublibs' file in
  133. // a directory. It means that child directories are separate libraries.
  134. // It's still possible to have tests in the directory that has 'sublibs'
  135. // file.
  136. std::string interesting;
  137. start_pos += 5;
  138. string::size_type end_pos( path.find( ".test/", start_pos ) );
  139. end_pos = path.rfind('/', end_pos);
  140. if (path.substr(end_pos - 5, 5) == "/test")
  141. interesting = path.substr( start_pos, end_pos - 5 - start_pos );
  142. else
  143. interesting = path.substr( start_pos, end_pos - start_pos );
  144. // Take slash separate elements until we have corresponding 'sublibs'.
  145. end_pos = 0;
  146. for(;;)
  147. {
  148. end_pos = interesting.find('/', end_pos);
  149. if (end_pos == string::npos) {
  150. result = interesting;
  151. break;
  152. }
  153. result = interesting.substr(0, end_pos);
  154. if ( fs::exists( ( boost_root / "libs" ) / result / "sublibs" ) )
  155. {
  156. end_pos = end_pos + 1;
  157. }
  158. else
  159. break;
  160. }
  161. }
  162. return result;
  163. }
  164. // Tries to find target name in the string 'msg', starting from
  165. // position start.
  166. // If found, extract the directory name from the target name and
  167. // stores it in 'dir', and return the position after the target name.
  168. // Otherwise, returns string::npos.
  169. string::size_type parse_skipped_msg_aux(const string& msg,
  170. string::size_type start,
  171. string& dir)
  172. {
  173. dir.clear();
  174. string::size_type start_pos = msg.find( '<', start );
  175. if ( start_pos == string::npos ) return string::npos;
  176. ++start_pos;
  177. string::size_type end_pos = msg.find( '>', start_pos );
  178. dir += msg.substr( start_pos, end_pos - start_pos );
  179. if ( boost_build_v2 )
  180. {
  181. // The first letter is a magic value indicating
  182. // the type of grist.
  183. convert_path_separators( dir );
  184. dir.erase( 0, 1 );
  185. // We need path from root, not from 'status' dir.
  186. if (dir.find("../") == 0)
  187. dir.erase(0,3);
  188. }
  189. else
  190. {
  191. if ( dir[0] == '@' )
  192. {
  193. // new style build path, rooted build tree
  194. convert_path_separators( dir );
  195. dir.replace( 0, 1, "bin/" );
  196. }
  197. else
  198. {
  199. // old style build path, integrated build tree
  200. start_pos = dir.rfind( '!' );
  201. convert_path_separators( dir );
  202. dir.insert( dir.find( '/', start_pos + 1), "/bin" );
  203. }
  204. }
  205. return end_pos;
  206. }
  207. // the format of paths is really kinky, so convert to normal form
  208. // first path is missing the leading "..\".
  209. // first path is missing "\bin" after "status".
  210. // second path is missing the leading "..\".
  211. // second path is missing "\bin" after "build".
  212. // second path uses "!" for some separators.
  213. void parse_skipped_msg( const string & msg,
  214. string & first_dir, string & second_dir )
  215. {
  216. string::size_type pos = parse_skipped_msg_aux(msg, 0, first_dir);
  217. if (pos == string::npos)
  218. return;
  219. parse_skipped_msg_aux(msg, pos, second_dir);
  220. }
  221. // test_log hides database details -----------------------------------------//
  222. class test_log
  223. : boost::noncopyable
  224. {
  225. const string & m_target_directory;
  226. xml::element_ptr m_root;
  227. public:
  228. test_log( const string & target_directory,
  229. const string & test_name,
  230. const string & toolset,
  231. bool force_new_file )
  232. : m_target_directory( target_directory )
  233. {
  234. if ( !force_new_file )
  235. {
  236. fs::path pth( locate_root / target_directory / "test_log.xml" );
  237. fs::ifstream file( pth );
  238. if ( file ) // existing file
  239. {
  240. try
  241. {
  242. m_root = xml::parse( file, pth.string() );
  243. return;
  244. }
  245. catch(...)
  246. {
  247. // unable to parse existing XML file, fall through
  248. }
  249. }
  250. }
  251. string library_name( test_path_to_library_name( target_directory ) );
  252. test_info info;
  253. test2info_map::iterator itr( test2info.find( library_name + "/" + test_name ) );
  254. if ( itr != test2info.end() )
  255. info = itr->second;
  256. if ( !info.file_path.empty() )
  257. library_name = test_path_to_library_name( info.file_path );
  258. if ( info.type.empty() )
  259. {
  260. if ( target_directory.find( ".lib/" ) != string::npos
  261. || target_directory.find( ".dll/" ) != string::npos
  262. || target_directory.find( ".so/" ) != string::npos
  263. || target_directory.find( ".dylib/" ) != string::npos
  264. )
  265. {
  266. info.type = "lib";
  267. }
  268. else if ( target_directory.find( ".pyd/" ) != string::npos )
  269. info.type = "pyd";
  270. }
  271. m_root.reset( new xml::element( "test-log" ) );
  272. m_root->attributes.push_back(
  273. xml::attribute( "library", library_name ) );
  274. m_root->attributes.push_back(
  275. xml::attribute( "test-name", test_name ) );
  276. m_root->attributes.push_back(
  277. xml::attribute( "test-type", info.type ) );
  278. m_root->attributes.push_back(
  279. xml::attribute( "test-program", info.file_path ) );
  280. m_root->attributes.push_back(
  281. xml::attribute( "target-directory", target_directory ) );
  282. m_root->attributes.push_back(
  283. xml::attribute( "toolset", toolset ) );
  284. m_root->attributes.push_back(
  285. xml::attribute( "show-run-output",
  286. info.always_show_run_output ? "true" : "false" ) );
  287. }
  288. ~test_log()
  289. {
  290. fs::path pth( locate_root / m_target_directory / "test_log.xml" );
  291. if ( create_dirs && !fs::exists( pth.branch_path() ) )
  292. fs::create_directories( pth.branch_path() );
  293. fs::ofstream file( pth );
  294. if ( !file )
  295. {
  296. std::cout << "*****Warning - can't open output file: "
  297. << pth.string() << "\n";
  298. }
  299. else xml::write( *m_root, file );
  300. }
  301. const string & target_directory() const { return m_target_directory; }
  302. void remove_action( const string & action_name )
  303. // no effect if action_name not found
  304. {
  305. xml::element_list::iterator itr;
  306. for ( itr = m_root->elements.begin();
  307. itr != m_root->elements.end() && (*itr)->name != action_name;
  308. ++itr ) {}
  309. if ( itr != m_root->elements.end() ) m_root->elements.erase( itr );
  310. }
  311. void add_action( const string & action_name,
  312. const string & result,
  313. const string & timestamp,
  314. const string & content )
  315. {
  316. remove_action( action_name );
  317. xml::element_ptr action( new xml::element(action_name) );
  318. m_root->elements.push_back( action );
  319. action->attributes.push_back( xml::attribute( "result", result ) );
  320. action->attributes.push_back( xml::attribute( "timestamp", timestamp ) );
  321. action->content = content;
  322. }
  323. };
  324. // message_manager maps input messages into test_log actions ---------------//
  325. class message_manager
  326. : boost::noncopyable
  327. {
  328. string m_action_name; // !empty() implies action pending
  329. // IOW, a start_message awaits stop_message
  330. string m_target_directory;
  331. string m_test_name;
  332. string m_toolset;
  333. bool m_note; // if true, run result set to "note"
  334. // set false by start_message()
  335. // data needed to stop further compile action after a compile failure
  336. // detected in the same target directory
  337. string m_previous_target_directory;
  338. bool m_compile_failed;
  339. public:
  340. message_manager() : m_note(false) {}
  341. ~message_manager() { /*assert( m_action_name.empty() );*/ }
  342. bool note() const { return m_note; }
  343. void note( bool value ) { m_note = value; }
  344. void start_message( const string & action_name,
  345. const string & target_directory,
  346. const string & test_name,
  347. const string & toolset,
  348. const string & prior_content )
  349. {
  350. if ( !m_action_name.empty() ) stop_message( prior_content );
  351. m_action_name = action_name;
  352. m_target_directory = target_directory;
  353. m_test_name = test_name;
  354. m_toolset = toolset;
  355. m_note = false;
  356. if ( m_previous_target_directory != target_directory )
  357. {
  358. m_previous_target_directory = target_directory;
  359. m_compile_failed = false;
  360. }
  361. }
  362. void stop_message( const string & content )
  363. {
  364. if ( m_action_name.empty() ) return;
  365. stop_message( m_action_name, m_target_directory,
  366. "succeed", timestamp(), content );
  367. }
  368. void stop_message( const string & action_name,
  369. const string & target_directory,
  370. const string & result,
  371. const string & timestamp,
  372. const string & content )
  373. // the only valid action_names are "compile", "link", "run", "lib"
  374. {
  375. // My understanding of the jam output is that there should never be
  376. // a stop_message that was not preceeded by a matching start_message.
  377. // That understanding is built into message_manager code.
  378. assert( m_action_name == action_name );
  379. assert( m_target_directory == target_directory );
  380. assert( result == "succeed" || result == "fail" );
  381. // if test_log.xml entry needed
  382. if ( !m_compile_failed
  383. || action_name != "compile"
  384. || m_previous_target_directory != target_directory )
  385. {
  386. if ( action_name == "compile"
  387. && result == "fail" ) m_compile_failed = true;
  388. test_log tl( target_directory,
  389. m_test_name, m_toolset, action_name == "compile" );
  390. tl.remove_action( "lib" ); // always clear out lib residue
  391. // dependency removal
  392. if ( action_name == "lib" )
  393. {
  394. tl.remove_action( "compile" );
  395. tl.remove_action( "link" );
  396. tl.remove_action( "run" );
  397. }
  398. else if ( action_name == "compile" )
  399. {
  400. tl.remove_action( "link" );
  401. tl.remove_action( "run" );
  402. if ( result == "fail" ) m_compile_failed = true;
  403. }
  404. else if ( action_name == "link" ) { tl.remove_action( "run" ); }
  405. // dependency removal won't work right with random names, so assert
  406. else { assert( action_name == "run" ); }
  407. // add the "run" stop_message action
  408. tl.add_action( action_name,
  409. result == "succeed" && note() ? "note" : result,
  410. timestamp, content );
  411. }
  412. m_action_name = ""; // signal no pending action
  413. m_previous_target_directory = target_directory;
  414. }
  415. };
  416. }
  417. // main --------------------------------------------------------------------//
  418. int cpp_main( int argc, char ** argv )
  419. {
  420. if ( argc <= 1 )
  421. std::cout << "Usage: bjam [bjam-args] | process_jam_log [--echo] [--create-directories] [--v2] [locate-root]\n"
  422. "locate-root - the same as the bjam ALL_LOCATE_TARGET\n"
  423. " parameter, if any. Default is boost-root.\n"
  424. "create-directories - if the directory for xml file doesn't exists - creates it.\n"
  425. " usually used for processing logfile on different machine\n";
  426. boost_root = fs::initial_path();
  427. while ( !boost_root.empty()
  428. && !fs::exists( boost_root / "libs" ) )
  429. {
  430. boost_root /= "..";
  431. }
  432. if ( boost_root.empty() )
  433. {
  434. std::cout << "must be run from within the boost-root directory tree\n";
  435. return 1;
  436. }
  437. if ( argc > 1 && std::strcmp( argv[1], "--echo" ) == 0 )
  438. {
  439. echo = true;
  440. --argc; ++argv;
  441. }
  442. if (argc > 1 && std::strcmp( argv[1], "--create-directories" ) == 0 )
  443. {
  444. create_dirs = true;
  445. --argc; ++argv;
  446. }
  447. if ( argc > 1 && std::strcmp( argv[1], "--v2" ) == 0 )
  448. {
  449. boost_build_v2 = true;
  450. --argc; ++argv;
  451. }
  452. if (argc > 1)
  453. {
  454. locate_root = fs::path( argv[1], fs::native );
  455. --argc; ++argv;
  456. }
  457. else
  458. {
  459. locate_root = boost_root;
  460. }
  461. std::cout << "boost_root: " << boost_root.string() << '\n'
  462. << "locate_root: " << locate_root.string() << '\n';
  463. message_manager mgr;
  464. string line;
  465. string content;
  466. bool capture_lines = false;
  467. std::istream* input;
  468. if (argc > 1)
  469. {
  470. input = new std::ifstream(argv[1]);
  471. }
  472. else
  473. {
  474. input = &std::cin;
  475. }
  476. // This loop looks at lines for certain signatures, and accordingly:
  477. // * Calls start_message() to start capturing lines. (start_message() will
  478. // automatically call stop_message() if needed.)
  479. // * Calls stop_message() to stop capturing lines.
  480. // * Capture lines if line capture on.
  481. while ( std::getline( *input, line ) )
  482. {
  483. if ( echo ) std::cout << line << "\n";
  484. // create map of test-name to test-info
  485. if ( line.find( "boost-test(" ) == 0 )
  486. {
  487. string::size_type pos = line.find( '"' );
  488. string test_name( line.substr( pos+1, line.find( '"', pos+1)-pos-1 ) );
  489. test_info info;
  490. info.always_show_run_output
  491. = line.find( "\"always_show_run_output\"" ) != string::npos;
  492. info.type = line.substr( 11, line.find( ')' )-11 );
  493. for (unsigned int i = 0; i!=info.type.size(); ++i )
  494. { info.type[i] = std::tolower( info.type[i] ); }
  495. pos = line.find( ':' );
  496. // the rest of line is missing if bjam didn't know how to make target
  497. if ( pos + 1 != line.size() )
  498. {
  499. info.file_path = line.substr( pos+3,
  500. line.find( "\"", pos+3 )-pos-3 );
  501. convert_path_separators( info.file_path );
  502. if ( info.file_path.find( "libs/libs/" ) == 0 ) info.file_path.erase( 0, 5 );
  503. if ( test_name.find( "/" ) == string::npos )
  504. test_name = "/" + test_name;
  505. test2info.insert( std::make_pair( test_name, info ) );
  506. // std::cout << test_name << ", " << info.type << ", " << info.file_path << "\n";
  507. }
  508. else
  509. {
  510. std::cout << "*****Warning - missing test path: " << line << "\n"
  511. << " (Usually occurs when bjam doesn't know how to make a target)\n";
  512. }
  513. continue;
  514. }
  515. // these actions represent both the start of a new action
  516. // and the end of a failed action
  517. else if ( line.find( "C++-action " ) != string::npos
  518. || line.find( "vc-C++ " ) != string::npos
  519. || line.find( "C-action " ) != string::npos
  520. || line.find( "Cc-action " ) != string::npos
  521. || line.find( "vc-Cc " ) != string::npos
  522. || line.find( "Link-action " ) != string::npos
  523. // archive can fail too
  524. || line.find( "Archive-action " ) != string::npos
  525. || line.find( "vc-Link " ) != string::npos
  526. || line.find( ".compile.") != string::npos
  527. || ( line.find( ".link") != string::npos &&
  528. // .linkonce is present in gcc linker messages about
  529. // unresolved symbols. We don't have to parse those
  530. line.find( ".linkonce" ) == string::npos )
  531. )
  532. {
  533. string action( ( line.find( "Link-action " ) != string::npos
  534. || line.find( "vc-Link " ) != string::npos
  535. || line.find( ".link") != string::npos
  536. || line.find( "Archive-action "))
  537. ? "link" : "compile" );
  538. if ( line.find( "...failed " ) != string::npos )
  539. mgr.stop_message( action, target_directory( line ),
  540. "fail", timestamp(), content );
  541. else
  542. {
  543. string target_dir( target_directory( line ) );
  544. mgr.start_message( action, target_dir,
  545. test_name( target_dir ), toolset( target_dir ), content );
  546. }
  547. content = "\n";
  548. capture_lines = true;
  549. }
  550. // these actions are only used to stop the previous action
  551. else if ( line.find( "-Archive" ) != string::npos
  552. || line.find( "MkDir" ) == 0 )
  553. {
  554. mgr.stop_message( content );
  555. content.clear();
  556. capture_lines = false;
  557. }
  558. else if ( line.find( "execute-test" ) != string::npos
  559. || line.find( "capture-output" ) != string::npos )
  560. {
  561. if ( line.find( "...failed " ) != string::npos )
  562. {
  563. mgr.stop_message( "run", target_directory( line ),
  564. "fail", timestamp(), content );
  565. content = "\n";
  566. capture_lines = true;
  567. }
  568. else
  569. {
  570. string target_dir( target_directory( line ) );
  571. mgr.start_message( "run", target_dir,
  572. test_name( target_dir ), toolset( target_dir ), content );
  573. // contents of .output file for content
  574. capture_lines = false;
  575. content = "\n";
  576. fs::ifstream file( locate_root / target_dir
  577. / (test_name(target_dir) + ".output") );
  578. if ( file )
  579. {
  580. string ln;
  581. while ( std::getline( file, ln ) )
  582. {
  583. if ( ln.find( "<note>" ) != string::npos ) mgr.note( true );
  584. append_html( ln, content );
  585. content += "\n";
  586. }
  587. }
  588. }
  589. }
  590. // bjam indicates some prior dependency failed by a "...skipped" message
  591. else if ( line.find( "...skipped <" ) != string::npos && line.find( "<directory-grist>" ) == string::npos)
  592. {
  593. mgr.stop_message( content );
  594. content.clear();
  595. capture_lines = false;
  596. if ( line.find( " for lack of " ) != string::npos
  597. && line.find( ".run for lack of " ) == string::npos )
  598. {
  599. capture_lines = true;
  600. string target_dir;
  601. string lib_dir;
  602. parse_skipped_msg( line, target_dir, lib_dir );
  603. if ( target_dir != lib_dir ) // it's a lib problem
  604. {
  605. mgr.start_message( "lib", target_dir,
  606. test_name( target_dir ), toolset( target_dir ), content );
  607. content = lib_dir;
  608. mgr.stop_message( "lib", target_dir, "fail", timestamp(), content );
  609. content = "\n";
  610. }
  611. }
  612. }
  613. else if ( line.find( "**passed**" ) != string::npos
  614. || line.find( "failed-test-file " ) != string::npos
  615. || line.find( "command-file-dump" ) != string::npos )
  616. {
  617. mgr.stop_message( content );
  618. content = "\n";
  619. capture_lines = true;
  620. }
  621. else if ( capture_lines ) // hang onto lines for possible later use
  622. {
  623. append_html( line, content );;
  624. content += "\n";
  625. }
  626. }
  627. mgr.stop_message( content );
  628. if (input != &std::cin)
  629. delete input;
  630. return 0;
  631. }
粤ICP备19079148号