Răsfoiți Sursa

compiler_status.cpp:
- Support testsuites.jam in addition to Jamfile


[SVN r16736]

Douglas Gregor 23 ani în urmă
părinte
comite
dd49dbca0c
1 a modificat fișierele cu 27 adăugiri și 15 ștergeri
  1. 27 15
      tools/regression/compiler_status.cpp

+ 27 - 15
tools/regression/compiler_status.cpp

@@ -62,6 +62,7 @@ namespace
   std::vector<string> toolsets;
   std::vector<string> toolsets;
 
 
   fs::ifstream jamfile;
   fs::ifstream jamfile;
+  fs::ifstream testsuitesfile; // in addition to jamfile
   fs::ofstream report;
   fs::ofstream report;
   fs::ofstream links_file;
   fs::ofstream links_file;
   string links_name;
   string links_name;
@@ -196,9 +197,9 @@ namespace
   }
   }
 
 
 //  test_type_desc  ----------------------------------------------------------//
 //  test_type_desc  ----------------------------------------------------------//
-//  from jamfile
+//  from jamfile or testsuitesfile
 
 
-  string test_type_desc( const string & test_name )
+  string test_type_desc( const string & test_name, fs::ifstream & file)
   {
   {
     // adding "/" and ".c" eliminates a couple of corner cases.
     // adding "/" and ".c" eliminates a couple of corner cases.
     // ".c" rather than ".cpp" because regex library includes some .c tests
     // ".c" rather than ".cpp" because regex library includes some .c tests
@@ -206,12 +207,12 @@ namespace
     string search_name2( " " + test_name + " " );
     string search_name2( " " + test_name + " " );
 
 
     string result;
     string result;
-    if ( jamfile.is_open() )
+    if ( file.is_open() )
     {
     {
-      jamfile.clear();
-      jamfile.seekg(0);
+      file.clear();
+      file.seekg(0);
       string line;
       string line;
-      while( std::getline( jamfile, line ) )
+      while( std::getline( file, line ) )
       {
       {
         if ( line.find( ".c" ) != string::npos )
         if ( line.find( ".c" ) != string::npos )
         {
         {
@@ -241,7 +242,15 @@ namespace
     }
     }
     return result;
     return result;
   }
   }
-  
+
+  string test_type_desc( const string & test_name )
+  {
+    string result = test_type_desc( test_name, jamfile );
+    if ( result.empty() )
+      result = test_type_desc( test_name, testsuitesfile );
+    return result;
+  }
+
 //  target_directory  --------------------------------------------------------//
 //  target_directory  --------------------------------------------------------//
 //  this amounts to a request to find a unique leaf directory
 //  this amounts to a request to find a unique leaf directory
 
 
@@ -291,7 +300,7 @@ const string & attribute_value( const xml::element_ptr & element,
 }
 }
 
 
 //  generate_report  ---------------------------------------------------------//
 //  generate_report  ---------------------------------------------------------//
-  
+
   // return 0 if nothing generated, 1 otherwise, except 2 if compiler msgs
   // return 0 if nothing generated, 1 otherwise, except 2 if compiler msgs
   int generate_report( const xml::element_ptr & db,
   int generate_report( const xml::element_ptr & db,
                        const string & test_name,
                        const string & test_name,
@@ -300,18 +309,18 @@ const string & attribute_value( const xml::element_ptr & element,
                        bool always_show_run_output = false )
                        bool always_show_run_output = false )
   {
   {
     // compile msgs sometimes modified, so make a local copy
     // compile msgs sometimes modified, so make a local copy
-    string compile( (pass && no_warn) 
+    string compile( (pass && no_warn)
       ? empty_string :  element_content( db, "compile" ) );
       ? empty_string :  element_content( db, "compile" ) );
 
 
     const string & link( pass ? empty_string : element_content( db, "link" ) );
     const string & link( pass ? empty_string : element_content( db, "link" ) );
-    const string & run( (pass && !always_show_run_output) 
+    const string & run( (pass && !always_show_run_output)
       ? empty_string : element_content( db, "run" ) );
       ? empty_string : element_content( db, "run" ) );
     string lib( pass ? empty_string : element_content( db, "lib" ) );
     string lib( pass ? empty_string : element_content( db, "lib" ) );
 
 
     // some compilers output the filename even if there are no errors or
     // some compilers output the filename even if there are no errors or
     // warnings; detect this if one line of output and it contains no space.
     // warnings; detect this if one line of output and it contains no space.
     string::size_type pos = compile.find( '\n', 1 );
     string::size_type pos = compile.find( '\n', 1 );
-    if ( pos != string::npos && compile.size()-pos <= 2 
+    if ( pos != string::npos && compile.size()-pos <= 2
         && compile.find( ' ' ) == string::npos ) compile.clear();
         && compile.find( ' ' ) == string::npos ) compile.clear();
 
 
     if ( lib.empty() && compile.empty() && link.empty() && run.empty() )
     if ( lib.empty() && compile.empty() && link.empty() && run.empty() )
@@ -337,7 +346,7 @@ const string & attribute_value( const xml::element_ptr & element,
         << compile << "</pre>\n";
         << compile << "</pre>\n";
     }
     }
     if ( !link.empty() )
     if ( !link.empty() )
-      links_file << "<h3>Linker output:</h3><pre>" << link << "</pre>\n";  
+      links_file << "<h3>Linker output:</h3><pre>" << link << "</pre>\n";
     if ( !run.empty() )
     if ( !run.empty() )
       links_file << "<h3>Run output:</h3><pre>" << run << "</pre>\n";
       links_file << "<h3>Run output:</h3><pre>" << run << "</pre>\n";
 
 
@@ -492,7 +501,7 @@ const string & attribute_value( const xml::element_ptr & element,
   {
   {
     // rows are held in a vector so they can be sorted, if desired.
     // rows are held in a vector so they can be sorted, if desired.
     std::vector<string> results;
     std::vector<string> results;
-    
+
     // each test directory
     // each test directory
     for ( fs::directory_iterator itr( build_dir ); itr != end_itr; ++itr )
     for ( fs::directory_iterator itr( build_dir ); itr != end_itr; ++itr )
     {
     {
@@ -521,7 +530,7 @@ const string & attribute_value( const xml::element_ptr & element,
     fs::path build_dir( fs::initial_path() / "bin" );
     fs::path build_dir( fs::initial_path() / "bin" );
 
 
     report << "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n";
     report << "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n";
-     
+
     // generate the column headings
     // generate the column headings
 
 
     report << "<tr><td>Library</td><td>Test Name</td>\n"
     report << "<tr><td>Library</td><td>Test Name</td>\n"
@@ -550,7 +559,7 @@ const string & attribute_value( const xml::element_ptr & element,
                << (desc.size() ? desc : compiler_itr->leaf())
                << (desc.size() ? desc : compiler_itr->leaf())
                << (vers.size() ? (string( "<br>" ) + vers ) : string( "" ))
                << (vers.size() ? (string( "<br>" ) + vers ) : string( "" ))
                << "</td>\n";
                << "</td>\n";
-        } 
+        }
       }
       }
     }
     }
 
 
@@ -604,6 +613,9 @@ int cpp_main( int argc, char * argv[] ) // note name!
     return 1;
     return 1;
   }
   }
 
 
+  fs::path testsuitesfile_path( fs::initial_path() / "testsuites.jam" );
+  testsuitesfile.open( testsuitesfile_path );
+
   report.open( argv[2] );
   report.open( argv[2] );
   if ( !report )
   if ( !report )
   {
   {

粤ICP备19079148号