Răsfoiți Sursa

sane-testing merged

[SVN r16674]
Beman Dawes 23 ani în urmă
părinte
comite
a23395fce3
3 a modificat fișierele cu 83 adăugiri și 62 ștergeri
  1. 1 1
      tools/build
  2. 30 53
      tools/regression/compiler_status.cpp
  3. 52 8
      tools/regression/process_jam_log.cpp

+ 1 - 1
tools/build

@@ -1 +1 @@
-Subproject commit 1ba180a74edffd094babc8c1d091a18522d954e9
+Subproject commit f05bacab618fa77295df90419a37bcc0ed6e469d

+ 30 - 53
tools/regression/compiler_status.cpp

@@ -277,6 +277,19 @@ namespace
     return itr != root->elements.end() ? (*itr)->content : empty_string;
   }
 
+//  find_attribute  ----------------------------------------------------------//
+
+const string & attribute_value( const xml::element_ptr & element,
+                                const string & attribute_name )
+{
+  static const string empty_string;
+  xml::attribute_list::iterator atr;
+  for ( atr = element->attributes.begin();
+        atr != element->attributes.end() && atr->name != attribute_name;
+        ++atr ) {}
+  return atr == element->attributes.end() ? empty_string : atr->value;
+}
+
 //  generate_report  ---------------------------------------------------------//
   
   // return 0 if nothing generated, 1 otherwise, except 2 if compiler msgs
@@ -340,10 +353,11 @@ namespace
       if ( failed_lib_target_dirs.find( lib ) == failed_lib_target_dirs.end() )
       {
         failed_lib_target_dirs.insert( lib );
-        fs::ifstream file( boost_root_dir / lib / "test_log.xml" );
+        fs::path pth( boost_root_dir / lib / "test_log.xml" );
+        fs::ifstream file( pth );
         if ( file )
         {
-          xml::element_ptr db = xml::parse( file );
+          xml::element_ptr db = xml::parse( file, pth.string() );
           generate_report( db, lib_test_name, toolset, false );
         }
         else
@@ -371,9 +385,8 @@ namespace
     bool pass = false;
 
     // missing jam residue
-    if ( fs::exists( target_dir / (test_name + ".success") ) ) pass = true;
-    else if ( !fs::exists( target_dir / (test_name + ".failure") )
-      && !fs::exists( target_dir / "test_log.xml" ) )
+    if ( fs::exists( target_dir / (test_name + ".test") ) ) pass = true;
+    else if ( !fs::exists( target_dir / "test_log.xml" ) )
     {
       target += "<td>" + missing_residue_msg + "</td>";
       return true;
@@ -383,7 +396,8 @@ namespace
 
     if ( !no_links )
     {
-      fs::ifstream file( target_dir / "test_log.xml" );
+      fs::path pth( target_dir / "test_log.xml" );
+      fs::ifstream file( pth );
       if ( !file ) // missing jam_log.xml
       {
         std::cerr << "Missing jam_log.xml in target \""
@@ -393,7 +407,7 @@ namespace
         target += "</td>";
         return pass;
       }
-      xml::element_ptr db = xml::parse( file );
+      xml::element_ptr db = xml::parse( file, pth.string() );
 
       // generate bookmarked report of results, and link to it
       anything_generated
@@ -425,60 +439,23 @@ namespace
     const string & test_name, // "any_test"
     string & target )
   {
-    // get the path to the test program from the .test file contents
+    // get the library name and test program path from the .xml file
+    string lib_name;
     string test_path( test_name ); // test_name is default if missing .test
-    fs::path file_path;
-    if ( find_file( test_dir, test_name + ".test", file_path ) )
+    fs::path xml_file_path;
+    if ( find_file( test_dir, "test_log.xml", xml_file_path ) )
     {
-      fs::ifstream file( file_path );
+      fs::ifstream file( xml_file_path );
       if ( file )
       {
-        std::getline( file, test_path );
-        if ( test_path.size() )
-        {
-          if ( test_path[0] == '\"' ) // added for non-Win32 systems
-          {
-            test_path = test_path.erase( 0, 1 ); // strip "
-            test_path.erase( test_path.find( "\"" ) );
-          }
-          // test_path is now a disk path, so convert to URL style path
-          convert_backslashes( test_path );
-          string::size_type pos = test_path.find( "/libs/" );
-          if ( pos != string::npos ) test_path.replace( 0, pos, ".." );
-        }
+        xml::element_ptr db = xml::parse( file, xml_file_path.string() );
+        test_path = attribute_value( db, "test-program" );
+        lib_name = attribute_value( db, "library" );
       }
     }
 
-    // extract the library name from the test_path
-    string lib_name( test_path );
-    string::size_type pos = lib_name.find( "/libs/" );
-    if ( pos != string::npos )
-    {
-      lib_name.erase( 0, pos+6 );
-      pos = lib_name.find( "/" );
-      if ( pos != string::npos ) lib_name.erase( pos );
-    }
-    else lib_name.clear();
-
     // find the library documentation path
-    string lib_docs_path( "../libs/" + lib_name + "/" );
-    fs::path cur_lib_docs_path( boost_root_dir / "libs" / lib_name );
-    if ( fs::exists( cur_lib_docs_path / "index.htm" ) )
-      lib_docs_path += "index.htm";
-    else if ( fs::exists( cur_lib_docs_path / "index.html" ) )
-      lib_docs_path += "index.html";
-    else if ( fs::exists( cur_lib_docs_path / "doc/index.htm" ) )
-      lib_docs_path += "doc/index.htm";
-    else if ( fs::exists( cur_lib_docs_path / "doc/index.html" ) )
-      lib_docs_path += "doc/index.html";
-    else if ( fs::exists( cur_lib_docs_path / (lib_name + ".htm") ) )
-      lib_docs_path += lib_name + ".htm";
-    else if ( fs::exists( cur_lib_docs_path / (lib_name + ".html") ) )
-      lib_docs_path += lib_name + ".html";
-    else if ( fs::exists( cur_lib_docs_path / "doc" / (lib_name + ".htm") ) )
-      lib_docs_path += lib_name + ".htm";
-    else if ( fs::exists( cur_lib_docs_path / "doc" / (lib_name + ".html") ) )
-      lib_docs_path += lib_name + ".html";
+    string lib_docs_path( "../libs/" + lib_name );
 
     // generate the library name, test name, and test type table data
     string::size_type row_start_pos = target.size();

+ 52 - 8
tools/regression/process_jam_log.cpp

@@ -13,6 +13,8 @@
 
 #include <iostream>
 #include <string>
+#include <map>
+#include <utility> // for make_pair
 #include <ctime>
 
 using std::string;
@@ -24,6 +26,9 @@ namespace fs = boost::filesystem;
 
 namespace
 {
+  typedef std::map< string, string > test2prog_map;  // test_name, test_file_path
+  test2prog_map test2prog;
+
 //  append_html  -------------------------------------------------------------//
 
   void append_html( const string & src, string & target )
@@ -144,19 +149,35 @@ namespace
       fs::ifstream file( pth );
       if ( !file )
       {
+        string test_program, library_name;
+        test2prog_map::iterator itr( test2prog.find( test_name ) );
+        if ( itr != test2prog.end() )
+        {
+          test_program = itr->second;
+          string::size_type start_pos( test_program.find( "libs/" ) );
+          if ( start_pos != string::npos )
+          {
+            start_pos += 5;
+            library_name = test_program.substr( start_pos,
+              test_program.find( '/', start_pos )-start_pos );
+          }
+        }
         m_root.reset( new xml::element( "test-log" ) );
         m_root->attributes.push_back(
-          xml::attribute( "target-directory", target_directory ) );
+          xml::attribute( "library", library_name ) );
         m_root->attributes.push_back(
           xml::attribute( "test-name", test_name ) );
+        m_root->attributes.push_back(
+          xml::attribute( "test-program", test_program ) );
+        m_root->attributes.push_back(
+          xml::attribute( "target-directory", target_directory ) );
         m_root->attributes.push_back(
           xml::attribute( "toolset", toolset ) );
       }
       else // existing file
       {
-        m_root = xml::parse( file );
+        m_root = xml::parse( file, pth.string() );
       }
-//std::cout <<     m_root->elements.size() << std::endl;
     }
 
     ~test_log()
@@ -277,12 +298,35 @@ int cpp_main( int argc, char ** argv )
 
   string line;
   string content;
-  bool capture_lines;
+  bool capture_lines = false;
+
+  // 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.)
+  //   * Calls stop_message() to stop capturing lines.
+  //   * Capture lines if line capture on.
 
   while ( std::getline( std::cin, line ) )
   {
-//std::cout << line << "\n";
-    if ( line.find( "C++-action " ) != string::npos
+//      std::cout << line << "\n";
+
+    if ( line.find( "(boost-test " ) == 0 )
+    {
+      string test_name, test_file_path;
+      string::size_type colon = line.find( ":" );
+      if ( colon != string::npos )
+      {
+        test_name = line.substr( 13, colon-15 );
+        test_file_path = line.substr( colon+3,
+          line.find( "\"", colon+3 )-colon-3 );
+        convert_path_separators( test_file_path );
+        test2prog.insert( std::make_pair( test_name, test_file_path ) );
+//        std::cout << test_name << ", " << test_file_path << "\n";
+        continue;
+      }
+    }
+
+    else if ( line.find( "C++-action " ) != string::npos
       || line.find( "vc-C++ " ) != string::npos
       || line.find( "C-action " ) != string::npos
       || line.find( "Cc-action " ) != string::npos
@@ -305,7 +349,7 @@ int cpp_main( int argc, char ** argv )
       capture_lines = true;
     }
 
-    else if ( line.find( "capture-run-output" ) != string::npos )
+    else if ( line.find( "execute-test" ) != string::npos )
     {
       if ( line.find( "...failed " ) != string::npos )
       {
@@ -361,7 +405,7 @@ int cpp_main( int argc, char ** argv )
 
     }
 
-    else if ( line.find( "succeeded-test" ) != string::npos
+    else if ( line.find( "**passed**" ) != string::npos
       || line.find( "failed-test-file " ) != string::npos
       || line.find( "command-file-dump" ) != string::npos )
     {

粤ICP备19079148号