|
Boost-Commit : |
From: grafikrobot_at_[hidden]
Date: 2007-10-15 10:53:29
Author: grafik
Date: 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
New Revision: 40052
URL: http://svn.boost.org/trac/boost/changeset/40052
Log:
Rework of regression scripts for branch independent testing -- complete.
Added:
trunk/tools/regression/build/Jamroot.jam (contents, props changed)
trunk/tools/regression/src/boost_svn_export_archive.sh
- copied unchanged from r39977, /trunk/tools/regression/boost_svn_export_archive.sh
trunk/tools/regression/src/compiler_status.cpp
- copied unchanged from r39977, /trunk/tools/regression/compiler_status.cpp
trunk/tools/regression/src/detail/
- copied from r39977, /trunk/tools/regression/detail/
trunk/tools/regression/src/detail/tiny_xml.cpp
- copied unchanged from r40050, /trunk/tools/regression/detail/tiny_xml.cpp
trunk/tools/regression/src/detail/tiny_xml.hpp
- copied unchanged from r40050, /trunk/tools/regression/detail/tiny_xml.hpp
trunk/tools/regression/src/detail/tiny_xml_test.cpp
- copied unchanged from r40050, /trunk/tools/regression/detail/tiny_xml_test.cpp
trunk/tools/regression/src/detail/tiny_xml_test.txt
- copied unchanged from r40050, /trunk/tools/regression/detail/tiny_xml_test.txt
trunk/tools/regression/src/library_status.cpp
- copied unchanged from r39977, /trunk/tools/regression/library_status.cpp
trunk/tools/regression/src/library_test.bat
- copied unchanged from r39977, /trunk/tools/regression/library_test.bat
trunk/tools/regression/src/library_test.sh
- copied unchanged from r39977, /trunk/tools/regression/library_test.sh
trunk/tools/regression/src/library_test_all.sh
- copied unchanged from r39977, /trunk/tools/regression/library_test_all.sh
trunk/tools/regression/src/process_jam_log.cpp
- copied unchanged from r39977, /trunk/tools/regression/process_jam_log.cpp
trunk/tools/regression/src/regression-logs.pl
- copied unchanged from r39977, /trunk/tools/regression/regression-logs.pl
trunk/tools/regression/src/run_tests.sh
- copied unchanged from r39977, /trunk/tools/regression/run_tests.sh
Removed:
trunk/tools/regression/boost_svn_export_archive.sh
trunk/tools/regression/build/Jamfile.v2
trunk/tools/regression/compiler_status.cpp
trunk/tools/regression/detail/
trunk/tools/regression/library_status.cpp
trunk/tools/regression/library_test.bat
trunk/tools/regression/library_test.sh
trunk/tools/regression/library_test_all.sh
trunk/tools/regression/process_jam_log.cpp
trunk/tools/regression/regression-logs.pl
trunk/tools/regression/run_tests.sh
Deleted: trunk/tools/regression/boost_svn_export_archive.sh
==============================================================================
--- trunk/tools/regression/boost_svn_export_archive.sh 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,70 +0,0 @@
-#!/bin/sh
-
-#~ Copyright Redshift Software, Inc. 2007
-#~ Distributed under the Boost Software License, Version 1.0.
-#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-
-export PATH=/bin:/usr/bin:${PATH}
-
-timestamp=`date +%F-%H-%M-%S-%Z`
-branch=$1
-revision=`svn info file:///home/subversion/boost/${branch} | grep '^Revision:' | cut --byte=11-`
-tag=boost-${1/\/*}-${timestamp}
-export_dir=boost-$$
-
-# Remove files as listed in stdin, the assumption is that processing
-# of the file is complete and can be removed.
-rm_c()
-{
- while read f; do
- rm -f ${f}
- done
-}
-# Generate the export file tree, and incrementally output the files
-# created.
-svn_export()
-{
- svn export -r ${revision} file:///home/subversion/boost/${branch} ${tag}
- echo "Revision: ${revision}" > ${tag}/svn_info.txt
- echo "---- ${tag}/svn_info.txt"
-}
-# Create the archive incrementally, deleting files as we are done
-# adding them to the archive.
-make_archive()
-{
- svn_export \
- | cut --bytes=6- \
- | star -c -D -to-stdout -d artype=pax list=- 2>/dev/null \
- | bzip2 -6 -c \
- | tee $1 \
- | tar -jtf - \
- | rm_c
-}
-
-run()
-{
- cd /tmp
- rm -rf ${export_dir}
- mkdir ${export_dir}
- cd ${export_dir}
- mkfifo out.tbz2
- make_archive out.tbz2 &
- cat out.tbz2
- cd /tmp
- rm -rf ${export_dir}
-}
-
-run_debug()
-{
- rm -rf ${export_dir}
- mkdir ${export_dir}
- cd ${export_dir}
- mkfifo out.tbz2
- make_archive out.tbz2 &
- cat out.tbz2 > ../${tag}.tar.bz2
- cd ..
- rm -rf ${export_dir}
-}
-
-run
-#run_debug
Deleted: trunk/tools/regression/build/Jamfile.v2
==============================================================================
--- trunk/tools/regression/build/Jamfile.v2 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,53 +0,0 @@
-# Regression test status reporting tools build Jamfile
-
-exe process_jam_log
- :
- ../process_jam_log.cpp ../detail/tiny_xml.cpp
- /boost/filesystem//boost_filesystem
- :
- :
- release
- ;
-
-exe compiler_status
- :
- ../compiler_status.cpp ../detail/tiny_xml.cpp
- /boost/filesystem//boost_filesystem
- :
- :
- release
- ;
-
-exe library_status
- :
- ../library_status.cpp ../detail/tiny_xml.cpp
- /boost/filesystem//boost_filesystem
- :
- :
- release
- ;
-explicit library_status ;
-
-install dist-bin
- :
- process_jam_log
- compiler_status
- library_status
- :
- <install-type>EXE
- <location>../../../dist/bin
- :
- release
- ;
-
-install dist-lib
- :
- process_jam_log
- compiler_status
- library_status
- :
- <install-type>LIB
- <location>../../../dist/lib
- :
- release
- ;
Added: trunk/tools/regression/build/Jamroot.jam
==============================================================================
--- (empty file)
+++ trunk/tools/regression/build/Jamroot.jam 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
@@ -0,0 +1,59 @@
+# Regression test status reporting tools build Jamfile
+
+if [ glob ../../../boost-build.jam ]
+{
+ use-project /boost : ../../.. ;
+}
+else
+{
+ import modules ;
+ use-project /boost : [ MATCH --boost=(.*) : [ modules.peek : ARGV ] ] ;
+}
+
+if ! [ glob ../src/process_jam_log.cpp ]
+{
+ project boost/regression
+ :
+ source-location ..
+ ;
+}
+else
+{
+ project boost/regression
+ :
+ source-location ../src
+ ;
+}
+
+exe process_jam_log
+ :
+ process_jam_log.cpp detail/tiny_xml.cpp
+ /boost/filesystem//boost_filesystem/<link>static
+ :
+ <define>BOOST_ALL_NO_LIB=1
+ :
+ release
+ ;
+#~ explicit process_jam_log ;
+
+exe compiler_status
+ :
+ compiler_status.cpp detail/tiny_xml.cpp
+ /boost/filesystem//boost_filesystem/<link>static
+ :
+ <define>BOOST_ALL_NO_LIB=1
+ :
+ release
+ ;
+explicit compiler_status ;
+
+exe library_status
+ :
+ library_status.cpp detail/tiny_xml.cpp
+ /boost/filesystem//boost_filesystem/<link>static
+ :
+ <define>BOOST_ALL_NO_LIB=1
+ :
+ release
+ ;
+explicit library_status ;
Deleted: trunk/tools/regression/compiler_status.cpp
==============================================================================
--- trunk/tools/regression/compiler_status.cpp 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,1017 +0,0 @@
-// Generate Compiler Status HTML from jam regression test output -----------//
-
-// Copyright Beman Dawes 2002. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/tools/regression/ for documentation.
-
-/*******************************************************************************
-
- This program was designed to work unchanged on all platforms and
- configurations. All output which is platform or configuration dependent
- is obtained from external sources such as the .xml file from
- process_jam_log execution, the tools/build/xxx-tools.jam files, or the
- output of the config_info tests.
-
- Please avoid adding platform or configuration dependencies during
- program maintenance.
-
-*******************************************************************************/
-
-#include "boost/config.hpp"
-#include "boost/filesystem/operations.hpp"
-#include "boost/filesystem/fstream.hpp"
-#include "detail/tiny_xml.hpp"
-namespace fs = boost::filesystem;
-namespace xml = boost::tiny_xml;
-
-#include <cstdlib> // for abort, exit
-#include <cctype> // for toupper
-#include <string>
-#include <vector>
-#include <set>
-#include <map>
-#include <algorithm>
-#include <iostream>
-#include <fstream>
-#include <ctime>
-#include <stdexcept>
-#include <cassert>
-
-using std::string;
-
-const string pass_msg( "Pass" );
-const string warn_msg( "<i>Warn</i>" );
-const string fail_msg( "<font color=\"#FF0000\"><i>Fail</i></font>" );
-const string note_msg( "<sup>*</sup>" );
-const string missing_residue_msg( "<i>Missing</i>" );
-
-const std::size_t max_compile_msg_size = 10000;
-
-namespace
-{
- fs::path boost_root; // boost-root complete path
- fs::path locate_root; // locate-root (AKA ALL_LOCATE_TARGET) complete path
-
- bool compile_time;
- bool run_time;
- bool ignore_pass;
- bool no_warn;
- bool no_links;
- bool boost_build_v2 = true;
-
- fs::path jamfile_path;
-
- fs::directory_iterator end_itr;
-
- // It's immportant for reliability that we find the same compilers for each
- // test, and that they match the column header. So save the names at the
- // time column headings are generated.
- std::vector<string> toolsets;
-
- fs::ifstream jamfile;
- fs::ofstream report;
- fs::ofstream links_file;
- string links_name;
-
- fs::path notes_path;
- string notes_html;
-
- fs::path notes_map_path;
- typedef std::multimap< string, string > notes_map; // key is test_name-toolset,
- // value is note bookmark
- notes_map notes;
-
- string specific_compiler; // if running on one toolset only
-
- const string empty_string;
-
- // 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" );
-
-// get revision number (as a string) if boost_root is svn working copy -----//
-
- string revision( const fs::path & boost_root )
- {
- string rev;
- fs::path entries( boost_root / ".svn" / "entries" );
- fs::ifstream entries_file( entries );
- if ( entries_file )
- {
- std::getline( entries_file, rev );
- std::getline( entries_file, rev );
- std::getline( entries_file, rev );
- std::getline( entries_file, rev ); // revision number as a string
- }
- return rev;
- }
-
-
-// build notes_bookmarks from notes HTML -----------------------------------//
-
- void build_notes_bookmarks()
- {
- if ( notes_map_path.empty() ) return;
- fs::ifstream notes_map_file( notes_map_path );
- if ( !notes_map_file )
- {
- std::cerr << "Could not open --notes-map input file: " << notes_map_path.string() << std::endl;
- std::exit( 1 );
- }
- string line;
- while( std::getline( notes_map_file, line ) )
- {
- string::size_type pos = 0;
- if ( (pos = line.find( ',', pos )) == string::npos ) continue;
- string key(line.substr( 0, pos ) );
- string bookmark( line.substr( pos+1 ) );
-
-// std::cout << "inserting \"" << key << "\",\"" << bookmark << "\"\n";
- notes.insert( notes_map::value_type( key, bookmark ) );
- }
- }
-
-// load_notes_html ---------------------------------------------------------//
-
- bool load_notes_html()
- {
- if ( notes_path.empty() ) return false;
- fs::ifstream notes_file( notes_path );
- if ( !notes_file )
- {
- std::cerr << "Could not open --notes input file: " << notes_path.string() << std::endl;
- std::exit( 1 );
- }
- string line;
- bool in_body( false );
- while( std::getline( notes_file, line ) )
- {
- if ( in_body && line.find( "</body>" ) != string::npos ) in_body = false;
- if ( in_body ) notes_html += line;
- else if ( line.find( "<body>" ) ) in_body = true;
- }
- return true;
- }
-
-// relative path between two paths -----------------------------------------//
-
- void relative_path( const fs::path & from, const fs::path & to,
- fs::path & target )
- {
- if ( from.string().size() <= to.string().size() ) return;
- target /= "..";
- relative_path( from.branch_path(), to, target );
- return;
- }
-
-// extract object library name from target directory string ----------------//
-
- string extract_object_library_name( const string & s )
- {
- string t( s );
- string::size_type pos = t.find( "/build/" );
- if ( pos != string::npos ) pos += 7;
- else if ( (pos = t.find( "/test/" )) != string::npos ) pos += 6;
- else return "";
- return t.substr( pos, t.find( "/", pos ) - pos );
- }
-
-// find_file ---------------------------------------------------------------//
-// given a directory to recursively search
-
- bool find_file( const fs::path & dir_path, const string & name,
- fs::path & path_found, const string & ignore_dir_named="" )
- {
- if ( !fs::exists( dir_path ) ) return false;
- for ( fs::directory_iterator itr( dir_path ); itr != end_itr; ++itr )
- if ( fs::is_directory( *itr )
- && itr->leaf() != ignore_dir_named )
- {
- if ( find_file( *itr, name, path_found ) ) return true;
- }
- else if ( itr->leaf() == name )
- {
- path_found = *itr;
- return true;
- }
- return false;
- }
-
-// platform_desc -----------------------------------------------------------//
-
- string platform_desc()
- {
- string result = BOOST_PLATFORM;
- result[0] = std::toupper( result[0] );
- return result;
- }
-
-// version_desc ------------------------------------------------------------//
-// from locate-root/status/bin/config_info.test/xxx/.../config_info.output
-
- string version_desc( const string & compiler_name )
- {
- string result;
- fs::path dot_output_path;
- if ( find_file( locate_root / "bin/boost/status/config_info.test"
- / compiler_name, "config_info.output", dot_output_path )
- || find_file( locate_root / "status/bin/config_info.test"
- / compiler_name, "config_info.output", dot_output_path ) )
- {
- fs::ifstream file( dot_output_path );
- if ( file )
- {
- if( std::getline( file, result ) )
- {
- string::size_type pos = result.find( "version " );
- if ( pos != string::npos )
- {
- result.erase( 0, pos+8 );
- }
- else result.clear();
- }
- }
- }
- return result;
- }
-
-// compiler_desc -----------------------------------------------------------//
-// from boost-root/tools/build/xxx-tools.jam
-
- string compiler_desc( const string & compiler_name )
- {
- string result;
- fs::path tools_path( boost_root / "tools/build/v1" / (compiler_name
- + "-tools.jam") );
- if ( !fs::exists( tools_path ) )
- tools_path = boost_root / "tools/build" / (compiler_name + "-tools.jam");
- fs::ifstream file( tools_path );
- if ( file )
- {
- while( std::getline( file, result ) )
- {
- if ( result.substr( 0, 3 ) == "#//" )
- {
- result.erase( 0, 3 );
- return result;
- }
- }
- result.clear();
- }
- return result;
- }
-
-// target_directory --------------------------------------------------------//
-// this amounts to a request to find a unique leaf directory
-
- fs::path target_directory( const fs::path & root )
- {
- if ( !fs::exists( root ) ) return fs::path("no-such-path");
- fs::path child;
- for ( fs::directory_iterator itr( root ); itr != end_itr; ++itr )
- {
- if ( fs::is_directory( *itr ) )
- {
- // SunCC creates an internal subdirectory everywhere it writes
- // object files. This confuses the target_directory() algorithm.
- // This patch ignores the SunCC internal directory. Jens Maurer
- if ( (*itr).leaf() == "SunWS_cache" ) continue;
- // SGI does something similar for template instantiations. Jens Maurer
- if( (*itr).leaf() == "ii_files" ) continue;
-
- if ( child.empty() ) child = *itr;
- else
- {
- std::cout << "Warning: only first of two target possibilities will be reported for: \n "
- << root.string() << ": " << child.leaf()
- << " and " << (*itr).leaf() << "\n";
- }
- }
- }
- if ( child.empty() ) return root; // this dir has no children
- return target_directory( child );
- }
-
-// element_content ---------------------------------------------------------//
-
- const string & element_content(
- const xml::element & root, const string & name )
- {
- static string empty_string;
- xml::element_list::const_iterator itr;
- for ( itr = root.elements.begin();
- itr != root.elements.end() && (*itr)->name != name;
- ++itr ) {}
- return itr != root.elements.end() ? (*itr)->content : empty_string;
- }
-
-// find_element ------------------------------------------------------------//
-
- const xml::element empty_element;
-
- const xml::element & find_element(
- const xml::element & root, const string & name )
- {
- xml::element_list::const_iterator itr;
- for ( itr = root.elements.begin();
- itr != root.elements.end() && (*itr)->name != name;
- ++itr ) {}
- return itr != root.elements.end() ? *((*itr).get()) : empty_element;
- }
-
-// attribute_value ----------------------------------------------------------//
-
-const string & attribute_value( const xml::element & element,
- const string & attribute_name )
-{
- static const string empty_string;
- xml::attribute_list::const_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;
-}
-
-// find_bin_path -----------------------------------------------------------//
-
-// Takes a relative path from boost root to a Jamfile.
-// Returns the directory where the build targets from
-// that Jamfile are located. If not found, emits a warning
-// and returns empty path.
-const fs::path find_bin_path(const string& relative)
-{
- fs::path bin_path;
- if (boost_build_v2)
- {
- bin_path = locate_root / "bin.v2" / relative;
- if (!fs::exists(bin_path))
- {
- std::cerr << "warning: could not find build results for '"
- << relative << "'.\n";
- std::cerr << "warning: tried directory "
- << bin_path.native_directory_string() << "\n";
- bin_path = "";
- }
- }
- else
- {
- bin_path = locate_root / "bin/boost" / relative;
- if (!fs::exists(bin_path))
- {
- bin_path = locate_root / "bin" / relative / "bin";
- if (!fs::exists(bin_path))
- {
- bin_path = fs::path( locate_root / relative / "bin" );
- if (!fs::exists(bin_path))
- {
- bin_path = fs::path( locate_root / "bin/boost/libs" /
- relative.substr( relative.find( '/' )+1 ) );
- }
- }
- }
- if (!fs::exists(bin_path))
- {
- std::cerr << "warning: could not find build results for '"
- << relative << "'.\n";
- bin_path = "";
- }
- }
- return bin_path;
-}
-
-
-// generate_report ---------------------------------------------------------//
-
- // return 0 if nothing generated, 1 otherwise, except 2 if compiler msgs
- int generate_report( const xml::element & db,
- const string & source_library_name,
- const string & test_type,
- const string & test_name, // possibly object library name
- const string & toolset,
- bool pass,
- bool always_show_run_output = false )
- {
- // compile msgs sometimes modified, so make a local copy
- string compile( ((pass && no_warn)
- ? empty_string : element_content( db, "compile" )) );
-
- const string & link( pass ? empty_string : element_content( db, "link" ) );
- const string & run( (pass && !always_show_run_output)
- ? empty_string : element_content( db, "run" ) );
- string lib( (pass ? empty_string : element_content( db, "lib" )) );
-
- // 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.
- string::size_type pos = compile.find( '\n', 1 );
- if ( pos != string::npos && compile.size()-pos <= 2
- && compile.find( ' ' ) == string::npos ) compile.clear();
-
- if ( lib.empty()
- && (compile.empty() || test_type == "compile_fail")
- && link.empty() && run.empty() ) return 0;
-
- int result = 1; // some kind of msg for sure
-
- // limit compile message length
- if ( compile.size() > max_compile_msg_size )
- {
- compile.erase( max_compile_msg_size );
- compile += "...\n (remainder deleted because of excessive size)\n";
- }
-
- links_file << "<h2><a name=\""
- << source_library_name << "-" << test_name << "-" << toolset << "\">"
- << source_library_name << " - " << test_name << " - " << toolset << "</a></h2>\n";
-
- if ( !compile.empty() )
- {
- ++result;
- links_file << "<h3>Compiler output:</h3><pre>"
- << compile << "</pre>\n";
- }
- if ( !link.empty() )
- links_file << "<h3>Linker output:</h3><pre>" << link << "</pre>\n";
- if ( !run.empty() )
- links_file << "<h3>Run output:</h3><pre>" << run << "</pre>\n";
-
- // for an object library failure, generate a reference to the object
- // library failure message, and (once only) generate the object
- // library failure message itself
- static std::set< string > failed_lib_target_dirs; // only generate once
- if ( !lib.empty() )
- {
- if ( lib[0] == '\n' ) lib.erase( 0, 1 );
- string object_library_name( extract_object_library_name( lib ) );
-
- // changing the target directory naming scheme breaks
- // extract_object_library_name()
- assert( !object_library_name.empty() );
- if ( object_library_name.empty() )
- std::cerr << "Failed to extract object library name from " << lib << "\n";
-
- links_file << "<h3>Library build failure: </h3>\n"
- "See <a href=\"#"
- << source_library_name << "-"
- << object_library_name << "-" << toolset << "\">"
- << source_library_name << " - "
- << object_library_name << " - " << toolset << "</a>";
-
- if ( failed_lib_target_dirs.find( lib ) == failed_lib_target_dirs.end() )
- {
- failed_lib_target_dirs.insert( lib );
- fs::path pth( locate_root / lib / "test_log.xml" );
- fs::ifstream file( pth );
- if ( file )
- {
- xml::element_ptr db = xml::parse( file, pth.string() );
- generate_report( *db, source_library_name, test_type, object_library_name, toolset, false );
- }
- else
- {
- links_file << "<h2><a name=\""
- << object_library_name << "-" << toolset << "\">"
- << object_library_name << " - " << toolset << "</a></h2>\n"
- "test_log.xml not found\n";
- }
- }
- }
- return result;
- }
-
- // add_notes --------------------------------------------------------------//
-
- void add_notes( const string & key, bool fail, string & sep, string & target )
- {
- notes_map::const_iterator itr = notes.lower_bound( key );
- if ( itr != notes.end() && itr->first == key )
- {
- for ( ; itr != notes.end() && itr->first == key; ++itr )
- {
- string note_desc( itr->second[0] == '-'
- ? itr->second.substr( 1 ) : itr->second );
- if ( fail || itr->second[0] == '-' )
- {
- target += sep;
- sep = ",";
- target += "<a href=\"";
- target += "#";
- target += note_desc;
- target += "\">";
- target += note_desc;
- target += "</a>";
- }
- }
- }
- }
-
- // get_notes -------------------------------------------------------------//
-
- string get_notes( const string & toolset,
- const string & library, const string & test, bool fail )
- {
- string sep;
- string target( "<sup>" );
- add_notes( toolset + "/" + library + "/" + test, fail, sep, target );
- add_notes( "*/" + library + "/" + test, fail, sep, target );
- add_notes( toolset + "/" + library + "/*", fail, sep, target );
- add_notes( "*/" + library + "/*", fail, sep, target );
- if ( target == "<sup>" ) target.clear();
- else target += "</sup>";
- return target;
- }
-
- // do_cell ---------------------------------------------------------------//
-
- bool do_cell( const string & lib_name,
- const fs::path & test_dir,
- const string & test_type,
- const string & test_name,
- const string & toolset,
- string & target,
- bool always_show_run_output )
- // return true if any results except simple pass_msg
- {
- fs::path target_dir( target_directory( test_dir / toolset ) );
- bool pass = false;
-
- if ( !fs::exists( target_dir / "test_log.xml" ) )
- {
- std::cerr << "Missing jam_log.xml in target:\n "
- << target_dir.string() << "\n";
- target += "<td>" + missing_residue_msg + "</td>";
- return true;
- }
-
- int anything_generated = 0;
- bool note = false;
-
- fs::path pth( target_dir / "test_log.xml" );
- fs::ifstream file( pth );
- if ( !file ) // could not open jam_log.xml
- {
- std::cerr << "Can't open jam_log.xml in target:\n "
- << target_dir.string() << "\n";
- target += "<td>" + missing_residue_msg + "</td>";
- return false;
- }
-
- xml::element_ptr dbp = xml::parse( file, pth.string() );
- const xml::element & db( *dbp );
-
- std::string test_type_base( test_type );
- if ( test_type_base == "run_pyd" ) test_type_base = "run";
- else if ( test_type_base.size() > 5 )
- {
- const string::size_type trailer = test_type_base.size() - 5;
- if ( test_type_base.substr( trailer ) == "_fail" )
- {
- test_type_base.erase( trailer );
- }
- }
- const xml::element & test_type_element( find_element( db, test_type_base ) );
-
- pass = !test_type_element.name.empty()
- && attribute_value( test_type_element, "result" ) != "fail";
-
- if ( !no_links )
- {
- note = attribute_value( test_type_element, "result" ) == "note";
-
- // generate bookmarked report of results, and link to it
- anything_generated
- = generate_report( db, lib_name, test_type, test_name, toolset, pass,
- always_show_run_output || note );
- }
-
- target += "<td>";
-
- // generate the status table cell pass/warn/fail HTML
- if ( anything_generated != 0 )
- {
- target += "<a href=\"";
- target += links_name;
- target += "#";
- target += lib_name;
- target += "-";
- target += test_name;
- target += "-";
- target += toolset;
- target += "\">";
- target += pass
- ? (anything_generated < 2 ? pass_msg : warn_msg)
- : fail_msg;
- target += "</a>";
- if ( pass && note ) target += note_msg;
- }
- else target += pass ? pass_msg : fail_msg;
-
- // if notes, generate the superscript HTML
- if ( !notes.empty() )
- target += get_notes( toolset, lib_name, test_name, !pass );
-
- // generate compile-time if requested
- if ( compile_time )
- {
- const xml::element & compile_element( find_element( db, "compile" ) );
-
- if ( !compile_element.name.empty() )
- {
- string times = attribute_value( compile_element, "timings" );
- if ( !times.empty() )
- {
- target += "<br>";
- target += times.substr( 0, times.find( " " ) );
- }
- }
- }
-
- // generate run-time if requested
- if ( run_time )
- {
- const xml::element & run_element( find_element( db, "run" ) );
-
- if ( !run_element.name.empty() )
- {
- string times = attribute_value( run_element, "timings" );
- if ( !times.empty() )
- {
- target += "<br>";
- target += times.substr( 0, times.find( " " ) );
- }
- }
- }
-
- target += "</td>";
- return (anything_generated != 0) || !pass;
- }
-
-// do_row ------------------------------------------------------------------//
-
- void do_row(
- const fs::path & test_dir, // locate_root / "status/bin/any_test.test"
- const string & test_name, // "any_test"
- string & target )
- {
- // get library name, test-type, test-program path, etc., from the .xml file
- string lib_name;
- string test_path( test_name ); // test_name is default if missing .test
- string test_type( "unknown" );
- bool always_show_run_output( false );
- fs::path xml_file_path;
- if ( find_file( test_dir, "test_log.xml", xml_file_path ) )
- {
- fs::ifstream file( xml_file_path );
- if ( file )
- {
- xml::element_ptr dbp = xml::parse( file, xml_file_path.string() );
- const xml::element & db( *dbp );
- test_path = attribute_value( db, "test-program" );
- lib_name = attribute_value( db, "library" );
- test_type = attribute_value( db, "test-type" );
- always_show_run_output
- = attribute_value( db, "show-run-output" ) == "true";
- }
- }
-
- // generate the library name, test name, and test type table data
- string::size_type row_start_pos = target.size();
- target += "<tr><td><a href=\"" + url_prefix_dir_view + "/libs/" + lib_name
- + "\">" + lib_name + "</a></td>";
- target += "<td><a href=\"" + url_prefix_checkout_view + "/" + test_path
- + url_suffix_text_view + "\">" + test_name + "</a>";
-
- if ( compile_time ) target += "<br> Compile time:";
- if ( run_time ) target += "<br> Run time:";
-
- target += "</td>";
- target += "<td>" + test_type + "</td>";
-
- bool no_warn_save = no_warn;
- //if ( test_type.find( "fail" ) != string::npos ) no_warn = true;
-
- // for each compiler, generate <td>...</td> html
- bool anything_to_report = false;
- for ( std::vector<string>::const_iterator itr=toolsets.begin();
- itr != toolsets.end(); ++itr )
- {
- anything_to_report |= do_cell( lib_name, test_dir, test_type, test_name, *itr, target,
- always_show_run_output );
- }
-
- target += "</tr>";
- if ( ignore_pass && !anything_to_report ) target.erase( row_start_pos );
- no_warn = no_warn_save;
- }
-
-// do_rows_for_sub_tree ----------------------------------------------------//
-
- void do_rows_for_sub_tree(
- const fs::path & bin_dir, std::vector<string> & results )
- {
- for ( fs::directory_iterator itr( bin_dir ); itr != end_itr; ++itr )
- {
- if ( fs::is_directory( *itr )
- && itr->string().find( ".test" ) == (itr->string().size()-5) )
- {
- results.push_back( std::string() );
- do_row( *itr,
- itr->leaf().substr( 0, itr->leaf().size()-5 ),
- results[results.size()-1] );
- }
- }
- }
-
-// do_table_body -----------------------------------------------------------//
-
- void do_table_body( const fs::path & bin_dir )
- {
- // rows are held in a vector so they can be sorted, if desired.
- std::vector<string> results;
-
- // do primary bin directory
- do_rows_for_sub_tree( bin_dir, results );
-
- // do subinclude bin directories
- jamfile.clear();
- jamfile.seekg(0);
- string line;
- while( std::getline( jamfile, line ) )
- {
- bool v2(false);
- string::size_type pos( line.find( "subinclude" ) );
- if ( pos == string::npos ) {
- pos = line.find( "build-project" );
- v2 = true;
- }
- if ( pos != string::npos
- && line.find( '#' ) > pos )
- {
- if (v2)
- pos = line.find_first_not_of( " \t./", pos+13 );
- else
- pos = line.find_first_not_of( " \t./", pos+10 );
-
- if ( pos == string::npos ) continue;
- string subinclude_bin_dir(
- line.substr( pos, line.find_first_of( " \t", pos )-pos ) );
-
- fs::path bin_path = find_bin_path(subinclude_bin_dir);
- if (!bin_path.empty())
- do_rows_for_sub_tree( bin_path, results );
- }
- }
-
-
- std::sort( results.begin(), results.end() );
-
- for ( std::vector<string>::iterator v(results.begin());
- v != results.end(); ++v )
- { report << *v << "\n"; }
- }
-
-// do_table ----------------------------------------------------------------//
-
- void do_table()
- {
- // Find test result locations, trying:
- // - Boost.Build V1 location with ALL_LOCATE_TARGET
- // - 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 );
- fs::path bin_path = find_bin_path(relative);
-
- report << "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n";
-
- // generate the column headings
-
- 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 ( 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";
- }
- }
- }
-
- report << "</tr>\n";
-
- // now the rest of the table body
-
- do_table_body( bin_path );
-
- report << "</table>\n";
- }
-
-} // unnamed namespace
-
-// main --------------------------------------------------------------------//
-
-#define BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE
-#include <boost/test/included/prg_exec_monitor.hpp>
-
-int cpp_main( int argc, char * argv[] ) // note name!
-{
- fs::path comment_path;
- while ( argc > 1 && *argv[1] == '-' )
- {
- if ( argc > 2 && std::strcmp( argv[1], "--compiler" ) == 0 )
- { specific_compiler = argv[2]; --argc; ++argv; }
- else if ( argc > 2 && std::strcmp( argv[1], "--locate-root" ) == 0 )
- { locate_root = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( argc > 2 && std::strcmp( argv[1], "--comment" ) == 0 )
- { comment_path = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( argc > 2 && std::strcmp( argv[1], "--notes" ) == 0 )
- { notes_path = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( argc > 2 && std::strcmp( argv[1], "--notes-map" ) == 0 )
- { notes_map_path = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( std::strcmp( argv[1], "--ignore-pass" ) == 0 ) ignore_pass = true;
- else if ( std::strcmp( argv[1], "--no-warn" ) == 0 ) no_warn = true;
- else if ( std::strcmp( argv[1], "--v1" ) == 0 ) boost_build_v2 = false;
- else if ( std::strcmp( argv[1], "--v2" ) == 0 ) boost_build_v2 = true;
- else if ( argc > 2 && std::strcmp( argv[1], "--jamfile" ) == 0)
- { jamfile_path = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( std::strcmp( argv[1], "--compile-time" ) == 0 ) compile_time = true;
- else if ( std::strcmp( argv[1], "--run-time" ) == 0 ) run_time = true;
- else { std::cerr << "Unknown option: " << argv[1] << "\n"; argc = 1; }
- --argc;
- ++argv;
- }
-
- if ( argc != 3 && argc != 4 )
- {
- std::cerr <<
- "Usage: compiler_status [options...] boost-root status-file [links-file]\n"
- " boost-root is the path to the boost tree root directory.\n"
- " status-file and links-file are paths to the output files.\n"
- "Must be run from directory containing Jamfile\n"
- " options: --compiler name Run for named compiler only\n"
- " --ignore-pass Do not report tests which pass all compilers\n"
- " --no-warn Warnings not reported if test passes\n"
- " --locate-root path Path to ALL_LOCATE_TARGET for bjam;\n"
- " default boost-root.\n"
- " --comment path Path to file containing HTML\n"
- " to be copied into status-file.\n"
- " --notes path Path to file containing HTML\n"
- " to be copied into status-file.\n"
- " --notes-map path Path to file of toolset/test,n lines, where\n"
- " n is number of note bookmark in --notes file.\n"
- " --jamfile path Path to Jamfile. By default \"Jamfile\".\n"
- " --v1 Assume Boost.Build version 1.\n"
- " --v2 Assume Boost.Build version 2. (default)\n"
- " --ignore-pass Ignore passing tests.\n"
- " --no-warn Do not report warnings.\n"
- " --compile-time Show compile time.\n"
- " --run-time Show run time.\n"
- "Example: compiler_status --compiler gcc /boost-root cs.html cs-links.html\n"
- "Note: Only the leaf of the links-file path and --notes file string are\n"
- "used in status-file HTML links. Thus for browsing, status-file,\n"
- "links-file, and --notes file must all be in the same directory.\n"
- ;
- return 1;
- }
-
- boost_root = fs::path( argv[1], fs::native );
- if ( locate_root.empty() ) locate_root = boost_root;
-
- if (jamfile_path.empty())
- if (boost_build_v2)
- jamfile_path = "Jamfile.v2";
- else
- jamfile_path = "Jamfile";
- jamfile_path = fs::complete( jamfile_path, fs::initial_path() );
- jamfile.open( jamfile_path );
- if ( !jamfile )
- {
- std::cerr << "Could not open Jamfile: " << jamfile_path.native_file_string() << std::endl;
- return 1;
- }
-
- report.open( fs::path( argv[2], fs::native ) );
- if ( !report )
- {
- std::cerr << "Could not open report output file: " << argv[2] << std::endl;
- return 1;
- }
-
- if ( argc == 4 )
- {
- fs::path links_path( argv[3], fs::native );
- links_name = links_path.leaf();
- links_file.open( links_path );
- if ( !links_file )
- {
- std::cerr << "Could not open links output file: " << argv[3] << std::endl;
- return 1;
- }
- }
- else no_links = true;
-
- build_notes_bookmarks();
-
- char run_date[128];
- std::time_t tod;
- std::time( &tod );
- std::strftime( run_date, sizeof(run_date),
- "%X UTC, %A %d %B %Y", std::gmtime( &tod ) );
-
- std::string rev = revision( boost_root );
-
- report << "<html>\n"
- "<head>\n"
- "<title>Boost Test Results</title>\n"
- "</head>\n"
- "<body bgcolor=\"#ffffff\" text=\"#000000\">\n"
- "<table border=\"0\">\n"
- "<tr>\n"
- "<td><img border=\"0\" src=\"http://www.boost.org/boost.png\" width=\"277\" "
- "height=\"86\"></td>\n"
- "<td>\n"
- "<h1>Boost Test Results - " + platform_desc() + "</h1>\n"
- "<b>Run</b> "
- << run_date;
- if ( !rev.empty() ) report << ", <b>Revision</b> " << rev;
- report << "\n";
-
-
- if ( compile_time )
- report << "<p>Times reported are elapsed wall clock time in seconds.</p>\n";
-
-
- if ( !comment_path.empty() )
- {
- fs::ifstream comment_file( comment_path );
- if ( !comment_file )
- {
- std::cerr << "Could not open \"--comment\" input file: " << comment_path.string() << std::endl;
- return 1;
- }
- char c;
- while ( comment_file.get( c ) ) { report.put( c ); }
- }
-
- report << "</td>\n</table>\n<br>\n";
-
- if ( !no_links )
- {
- links_file
- << "<html>\n"
- "<head>\n"
- "<title>Boost Test Details</title>\n"
- "</head>\n"
- "<body bgcolor=\"#ffffff\" text=\"#000000\">\n"
- "<table border=\"0\">\n"
- "<tr>\n"
- "<td><img border=\"0\" src=\"http://www.boost.org/boost.png\" width=\"277\" "
- "height=\"86\"></td>\n"
- "<td>\n"
- "<h1>Boost Test Details - " + platform_desc() + "</h1>\n"
- "<b>Run Date:</b> "
- << run_date;
- if ( !rev.empty() ) links_file << ", <b>Revision</b> " << rev;
- links_file << "\n</td>\n</table>\n<br>\n";
- }
-
- do_table();
-
- if ( load_notes_html() ) report << notes_html << "\n";
-
- report << "</body>\n"
- "</html>\n"
- ;
-
- if ( !no_links )
- {
- links_file
- << "</body>\n"
- "</html>\n"
- ;
- }
- return 0;
-}
Deleted: trunk/tools/regression/library_status.cpp
==============================================================================
--- trunk/tools/regression/library_status.cpp 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,983 +0,0 @@
-// Generate Compiler Status HTML from jam regression test output -----------//
-
-// Copyright Beman Dawes 2002. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/tools/regression/ for documentation.
-
-//Note: This version of the original program builds a large table
-//which includes all build variations such as build/release, static/dynamic, etc.
-
-
-/*******************************************************************************
-
-This program was designed to work unchanged on all platforms and
-configurations. All output which is platform or configuration dependent
-is obtained from external sources such as the .xml file from
-process_jam_log execution, the tools/build/xxx-tools.jam files, or the
-output of the config_info tests.
-
-Please avoid adding platform or configuration dependencies during
-program maintenance.
-
-*******************************************************************************/
-
-#include "boost/filesystem/operations.hpp"
-#include "boost/filesystem/fstream.hpp"
-
-namespace fs = boost::filesystem;
-
-#include "detail/tiny_xml.hpp"
-namespace xml = boost::tiny_xml;
-
-#include "boost/iterator/transform_iterator.hpp"
-
-#include <cstdlib> // for abort, exit
-#include <string>
-#include <vector>
-#include <set>
-#include <utility> // for make_pair on STLPort
-#include <map>
-#include <algorithm>
-#include <iostream>
-#include <fstream>
-#include <ctime>
-#include <stdexcept>
-#include <cassert>
-#include <utility>
-
-using std::string;
-
-const string pass_msg( "Pass" );
-const string warn_msg( "<i>Warn</i>" );
-const string fail_msg( "<font color=\"#FF0000\"><i>Fail</i></font>" );
-const string note_msg( "<sup>*</sup>" );
-const string missing_residue_msg( "<i>Missing</i>" );
-
-const std::size_t max_compile_msg_size = 10000;
-
-namespace
-{
- fs::path boost_root; // boost-root complete path
- fs::path locate_root; // locate-root (AKA ALL_LOCATE_TARGET) complete path
- bool ignore_pass = false;
- bool no_warn = false;
- bool no_links = false;
-
- fs::directory_iterator end_itr;
-
- // transform pathname to something html can accept
- struct char_xlate {
- typedef char result_type;
- result_type operator()(char c) const{
- if(c == '/')
- return '-';
- return c;
- }
- };
- typedef boost::transform_iterator<char_xlate, std::string::const_iterator> html_from_path;
-
- template<class I1, class I2>
- std::ostream & operator<<(
- std::ostream &os,
- std::pair<I1, I2> p
- ){
- while(p.first != p.second)
- os << *p.first++;
- return os;
- }
-
- struct col_node {
- int rows, cols;
- bool has_leaf;
- typedef std::map<std::string, col_node> subcolumns_t;
- subcolumns_t m_subcolumns;
- bool operator<(const col_node &cn) const;
- col_node() :
- has_leaf(false)
- {}
- std::pair<int, int> get_spans();
- };
-
- std::pair<int, int> col_node::get_spans(){
- rows = 1;
- cols = 0;
- if(has_leaf){
- cols = 1;
- }
- if(! m_subcolumns.empty()){
- subcolumns_t::iterator itr;
- for(itr = m_subcolumns.begin(); itr != m_subcolumns.end(); ++itr){
- std::pair<int, int> spans;
- spans = itr->second.get_spans();
- rows = std::max(rows, spans.first);
- cols += spans.second;
- }
- ++rows;
- }
- return std::make_pair(rows, cols);
- }
-
- void build_node_tree(const fs::path & dir_root, col_node & node){
- fs::path xml_file_path( dir_root / "test_log.xml" );
- if (fs::exists( xml_file_path ) )
- {
- node.has_leaf = true;
- }
- fs::directory_iterator itr(dir_root);
- while(itr != end_itr){
- if(fs::is_directory(*itr)){
- std::pair<col_node::subcolumns_t::iterator, bool> result
- = node.m_subcolumns.insert(
- std::make_pair(itr->leaf(), col_node())
- );
- build_node_tree(*itr, result.first->second);
- }
- ++itr;
- }
- }
-
- fs::ofstream report;
- fs::ofstream links_file;
- string links_name;
-
- fs::path notes_path;
- string notes_html;
-
- fs::path notes_map_path;
- typedef std::multimap< string, string > notes_map; // key is test_name-toolset,
- // value is note bookmark
- notes_map notes;
-
- string specific_compiler; // if running on one toolset only
-
- const string empty_string;
-
- // build notes_bookmarks from notes HTML -----------------------------------//
-
- void build_notes_bookmarks()
- {
- if ( notes_map_path.empty() ) return;
- fs::ifstream notes_map_file( notes_map_path );
- if ( !notes_map_file )
- {
- std::cerr << "Could not open --notes-map input file: " << notes_map_path.string() << std::endl;
- std::exit( 1 );
- }
- string line;
- while( std::getline( notes_map_file, line ) )
- {
- string::size_type pos = 0;
- if ( (pos = line.find( ',', pos )) == string::npos ) continue;
- string key(line.substr( 0, pos ) );
- string bookmark( line.substr( pos+1 ) );
-
- // std::cout << "inserting \"" << key << "\",\"" << bookmark << "\"\n";
- notes.insert( notes_map::value_type( key, bookmark ) );
- }
- }
-
- // load_notes_html ---------------------------------------------------------//
-
- bool load_notes_html()
- {
- if ( notes_path.empty() ) return false;
- fs::ifstream notes_file( notes_path );
- if ( !notes_file )
- {
- std::cerr << "Could not open --notes input file: " << notes_path.string() << std::endl;
- std::exit( 1 );
- }
- string line;
- bool in_body( false );
- while( std::getline( notes_file, line ) )
- {
- if ( in_body && line.find( "</body>" ) != string::npos ) in_body = false;
- if ( in_body ) notes_html += line;
- else if ( line.find( "<body>" ) ) in_body = true;
- }
- return true;
- }
-
- // extract object library name from target directory string ----------------//
-
- string extract_object_library_name( const string & s )
- {
- string t( s );
- string::size_type pos = t.find( "/build/" );
- if ( pos != string::npos ) pos += 7;
- else if ( (pos = t.find( "/test/" )) != string::npos ) pos += 6;
- else return "";
- return t.substr( pos, t.find( "/", pos ) - pos );
- }
-
- // element_content ---------------------------------------------------------//
-
- const string & element_content(
- const xml::element & root, const string & name )
- {
- const static string empty_string;
- xml::element_list::const_iterator itr;
- for ( itr = root.elements.begin();
- itr != root.elements.end() && (*itr)->name != name;
- ++itr ) {}
- return itr != root.elements.end() ? (*itr)->content : empty_string;
- }
-
- // find_element ------------------------------------------------------------//
-
- const xml::element & find_element(
- const xml::element & root, const string & name )
- {
- static const xml::element empty_element;
- xml::element_list::const_iterator itr;
- for ( itr = root.elements.begin();
- itr != root.elements.end() && (*itr)->name != name;
- ++itr ) {}
- return itr != root.elements.end() ? *((*itr).get()) : empty_element;
- }
-
- // attribute_value ----------------------------------------------------------//
-
- const string & attribute_value(
- const xml::element & element,
- const string & attribute_name
- ){
- xml::attribute_list::const_iterator atr;
- for(
- atr = element.attributes.begin();
- atr != element.attributes.end();
- ++atr
- ){
- if(atr->name == attribute_name)
- return atr->value;
- }
- static const string empty_string;
- return empty_string;
- }
-
- // generate_report ---------------------------------------------------------//
-
- // return 0 if nothing generated, 1 otherwise, except 2 if compiler msgs
- int generate_report(
- const xml::element & db,
- const std::string source_library_name,
- const string & test_type,
- const fs::path & target_dir,
- bool pass,
- bool always_show_run_output
- )
- {
- // compile msgs sometimes modified, so make a local copy
- string compile( ((pass && no_warn)
- ? empty_string : element_content( db, "compile" )) );
-
- const string & link( pass ? empty_string : element_content( db, "link" ) );
- const string & run( (pass && !always_show_run_output)
- ? empty_string : element_content( db, "run" ) );
- string lib( (pass ? empty_string : element_content( db, "lib" )) );
-
- // 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.
- string::size_type pos = compile.find( '\n', 1 );
- if ( pos != string::npos && compile.size()-pos <= 2
- && compile.find( ' ' ) == string::npos ) compile.clear();
-
- if ( lib.empty()
- && (
- compile.empty() || test_type == "compile_fail"
- )
- && link.empty()
- && run.empty()
- )
- return 0;
-
- int result = 1; // some kind of msg for sure
-
- // limit compile message length
- if ( compile.size() > max_compile_msg_size )
- {
- compile.erase( max_compile_msg_size );
- compile += "...\n (remainder deleted because of excessive size)\n";
- }
-
- links_file << "<h2><a name=\"";
- links_file << std::make_pair(
- html_from_path(target_dir.string().begin()),
- html_from_path(target_dir.string().end())
- )
- << "\">"
- << std::make_pair(
- html_from_path(target_dir.string().begin()),
- html_from_path(target_dir.string().end())
- )
- ;
- links_file << "</a></h2>\n";;
-
- if ( !compile.empty() )
- {
- ++result;
- links_file << "<h3>Compiler output:</h3><pre>"
- << compile << "</pre>\n";
- }
- if ( !link.empty() )
- links_file << "<h3>Linker output:</h3><pre>" << link << "</pre>\n";
- if ( !run.empty() )
- links_file << "<h3>Run output:</h3><pre>" << run << "</pre>\n";
-
- // for an object library failure, generate a reference to the object
- // library failure message, and (once only) generate the object
- // library failure message itself
- static std::set< string > failed_lib_target_dirs; // only generate once
- if ( !lib.empty() )
- {
- if ( lib[0] == '\n' ) lib.erase( 0, 1 );
- string object_library_name( extract_object_library_name( lib ) );
-
- // changing the target directory naming scheme breaks
- // extract_object_library_name()
- assert( !object_library_name.empty() );
- if ( object_library_name.empty() )
- std::cerr << "Failed to extract object library name from " << lib << "\n";
-
- links_file << "<h3>Library build failure: </h3>\n"
- "See <a href=\"#"
- << source_library_name << "-"
- << object_library_name << "-"
- << std::make_pair(
- html_from_path(target_dir.string().begin()),
- html_from_path(target_dir.string().end())
- )
- << source_library_name << " - "
- << object_library_name << " - "
- << std::make_pair(
- html_from_path(target_dir.string().begin()),
- html_from_path(target_dir.string().end())
- )
- << "</a>";
- if ( failed_lib_target_dirs.find( lib ) == failed_lib_target_dirs.end() )
- {
- failed_lib_target_dirs.insert( lib );
- fs::path pth( locate_root / lib / "test_log.xml" );
- fs::ifstream file( pth );
- if ( file )
- {
- xml::element_ptr db = xml::parse( file, pth.string() );
- generate_report(
- *db,
- source_library_name,
- test_type,
- target_dir,
- false,
- false
- );
- }
- else
- {
- links_file << "<h2><a name=\""
- << object_library_name << "-"
- << std::make_pair(
- html_from_path(target_dir.string().begin()),
- html_from_path(target_dir.string().end())
- )
- << "\">"
- << object_library_name << " - "
- << std::make_pair(
- html_from_path(target_dir.string().begin()),
- html_from_path(target_dir.string().end())
- )
- << "</a></h2>\n"
- << "test_log.xml not found\n";
- }
- }
- }
- return result;
- }
-
- // add_notes --------------------------------------------------------------//
-
- void add_notes( const string & key, bool fail, string & sep, string & target )
- {
- notes_map::const_iterator itr = notes.lower_bound( key );
- if ( itr != notes.end() && itr->first == key )
- {
- for ( ; itr != notes.end() && itr->first == key; ++itr )
- {
- string note_desc( itr->second[0] == '-'
- ? itr->second.substr( 1 ) : itr->second );
- if ( fail || itr->second[0] == '-' )
- {
- target += sep;
- sep = ",";
- target += "<a href=\"";
- target += "#";
- target += note_desc;
- target += "\">";
- target += note_desc;
- target += "</a>";
- }
- }
- }
- }
-
- // do_cell ---------------------------------------------------------------//
- bool do_cell(
- const fs::path & target_dir,
- const string & lib_name,
- string & target,
- bool profile
- ){
- // return true if any results except pass_msg
- bool pass = false;
-
- fs::path xml_file_path( target_dir / "test_log.xml" );
- if ( !fs::exists( xml_file_path ) )
- {
- // suppress message because there are too many of them.
- // "missing" is a legitmate result as its not a requirement
- // that every test be run in every figuration.
- //std::cerr << "Missing jam_log.xml in target:\n "
- // << target_dir.string() << "\n";
- target += "<td align=\"right\">" + missing_residue_msg + "</td>";
- return true;
- }
-
- int anything_generated = 0;
- bool note = false;
-
- fs::ifstream file( xml_file_path );
- if ( !file ) // could not open jam_log.xml
- {
- std::cerr << "Can't open jam_log.xml in target:\n "
- << target_dir.string() << "\n";
- target += "<td>" + missing_residue_msg + "</td>";
- return false;
- }
-
- string test_type( "unknown" );
- bool always_show_run_output( false );
-
- xml::element_ptr dbp = xml::parse( file, xml_file_path.string() );
- const xml::element & db( *dbp );
- test_type = attribute_value( db, "test-type" );
- always_show_run_output
- = attribute_value( db, "show-run-output" ) == "true";
-
- std::string test_type_base( test_type );
- if ( test_type_base.size() > 5 )
- {
- const string::size_type trailer = test_type_base.size() - 5;
- if ( test_type_base.substr( trailer ) == "_fail" )
- {
- test_type_base.erase( trailer );
- }
- }
- if ( test_type_base.size() > 4 )
- {
- const string::size_type trailer = test_type_base.size() - 4;
- if ( test_type_base.substr( trailer ) == "_pyd" )
- {
- test_type_base.erase( trailer );
- }
- }
- const xml::element & test_type_element( find_element( db, test_type_base ) );
-
- pass = !test_type_element.name.empty()
- && attribute_value( test_type_element, "result" ) != "fail";
-
- if (!no_links){
- if(!test_type_element.name.empty())
- note = attribute_value( test_type_element, "result" ) == "note";
- anything_generated =
- generate_report(
- db,
- lib_name,
- test_type,
- target_dir,
- pass,
- always_show_run_output || note
- );
- }
-
- // generate the status table cell pass/warn/fail HTML
- target += "<td align=\"right\">";
- if ( anything_generated != 0 )
- {
- target += "<a href=\"";
- target += links_name;
- target += "#";
- std::copy(
- html_from_path(target_dir.string().begin()),
- html_from_path(target_dir.string().end()),
- std::back_inserter(target)
- );
- target += "\">";
- target += pass
- ? (anything_generated < 2 ? pass_msg : warn_msg)
- : fail_msg;
- target += "</a>";
- if ( pass && note ) target += note_msg;
- }
- else target += pass ? pass_msg : fail_msg;
-
- // if profiling
- if(profile && pass){
- // add link to profile
- target += " <a href=\"";
- target += (target_dir / "profile.txt").string();
- target += "\"><i>Profile</i></a>";
- }
-
- // if notes, generate the superscript HTML
-// if ( !notes.empty() )
-// target += get_notes( toolset, lib_name, test_name, !pass );
-
- target += "</td>";
- return (anything_generated != 0) || !pass;
- }
-
- bool visit_node_tree(
- const col_node & node,
- fs::path dir_root,
- const string & lib_name,
- string & target,
- bool profile
- ){
- bool retval = false;
- if(node.has_leaf){
- retval = do_cell(
- dir_root,
- lib_name,
- target,
- profile
- );
- }
-
- col_node::subcolumns_t::const_iterator col_itr;
- for(
- col_itr = node.m_subcolumns.begin();
- col_itr != node.m_subcolumns.end();
- ++col_itr
- ){
- fs::path subdir = dir_root / col_itr->first;
- retval |= visit_node_tree(
- col_itr->second,
- subdir,
- lib_name,
- target,
- col_itr->first == "profile"
- );
- }
- return retval;
- }
-
- // emit results for each test
- void do_row(
- col_node test_node,
- const fs::path & test_dir,
- const string & lib_name,
- const string & test_name,
- string & target
- ){
- string::size_type row_start_pos = target.size();
-
- target += "<tr>";
-
- target += "<td>";
- //target += "<a href=\"" + url_prefix_dir_view + "/libs/" + lib_name + "\">";
- target += test_name;
- target += "</a>";
- target += "</td>";
-
-// target += "<td>" + test_type + "</td>";
-
- bool no_warn_save = no_warn;
-
-// if ( test_type.find( "fail" ) != string::npos ) no_warn = true;
-
- // emit cells on this row
- bool anything_to_report = visit_node_tree(
- test_node,
- test_dir,
- lib_name,
- target,
- false
- );
-
- target += "</tr>";
-
- if ( ignore_pass
- && ! anything_to_report )
- target.erase( row_start_pos );
-
- no_warn = no_warn_save;
- }
-
- // do_table_body -----------------------------------------------------------//
-
- void do_table_body(
- col_node root_node,
- const string & lib_name,
- const fs::path & test_lib_dir
- ){
- // rows are held in a vector so they can be sorted, if desired.
- std::vector<string> results;
-
- for ( fs::directory_iterator itr( test_lib_dir ); itr != end_itr; ++itr )
- {
- if(! fs::is_directory(*itr))
- continue;
-
- string test_name = itr->leaf();
- // strip off the ".test" is there is one
- string::size_type s = test_name.find( ".test" );
- if(string::npos != s)
- test_name.resize(s);
-
- results.push_back( std::string() );
- do_row(
- root_node, //*test_node_itr++,
- *itr, // test dir
- lib_name,
- test_name,
- results[results.size()-1]
- );
- }
-
- std::sort( results.begin(), results.end() );
-
- for (
- std::vector<string>::iterator v(results.begin());
- v != results.end();
- ++v
- ){
- report << *v << "\n";
- }
- }
-
- // column header-----------------------------------------------------------//
- int header_depth(const col_node & root){
- col_node::subcolumns_t::const_iterator itr;
- int max_depth = 1;
- for(itr = root.m_subcolumns.begin(); itr != root.m_subcolumns.end(); ++itr){
- max_depth = std::max(max_depth, itr->second.rows);
- }
- return max_depth;
- }
-
- void header_cell(int rows, int cols, const std::string & name){
- // add row cells
- report << "<td align=\"center\" " ;
- if(1 < cols)
- report << "colspan=\"" << cols << "\" " ;
- if(1 < rows)
- // span rows to the end the header
- report << "rowspan=\"" << rows << "\" " ;
- report << ">" ;
- report << name;
- report << "</td>\n";
- }
-
- void emit_column_headers(
- const col_node & node,
- int display_row,
- int current_row,
- int row_count
- ){
- if(current_row < display_row){
- if(! node.m_subcolumns.empty()){
- col_node::subcolumns_t::const_iterator itr;
- for(itr = node.m_subcolumns.begin(); itr != node.m_subcolumns.end(); ++itr){
- emit_column_headers(itr->second, display_row, current_row + 1, row_count);
- }
- }
- return;
- }
- if(node.has_leaf && ! node.m_subcolumns.empty()){
- header_cell(row_count - current_row, 1, std::string(""));
- }
-
- col_node::subcolumns_t::const_iterator itr;
- for(itr = node.m_subcolumns.begin(); itr != node.m_subcolumns.end(); ++itr){
- if(1 == itr->second.rows)
- header_cell(row_count - current_row, itr->second.cols, itr->first);
- else
- header_cell(1, itr->second.cols, itr->first);
- }
- }
-
- fs::path find_lib_test_dir(){
- // walk up from the path were we started until we find
- // bin or bin.v2
-
- fs::path::const_iterator leaf_itr = fs::initial_path().end();
- fs::path test_lib_dir = fs::initial_path();
- for(;;){
- if(fs::is_directory( test_lib_dir / "bin.v2")){
- test_lib_dir /= "bin.v2";
- break;
- }
- if(fs::is_directory( test_lib_dir / "bin")){
- // v1 includes the word boost
- test_lib_dir /= "bin";
- test_lib_dir /= "boost";
- break;
- }
- if(test_lib_dir.empty())
- throw std::string("binary path not found");
- if(*leaf_itr != "libs")
- --leaf_itr;
- test_lib_dir.remove_leaf();
- }
-
- if(leaf_itr == fs::initial_path().end())
- throw std::string("must be run from within a library directory");
-
- while(leaf_itr != fs::initial_path().end()){
- test_lib_dir /= *leaf_itr++; // append "libs"
- }
- return test_lib_dir;
- }
-
- // note : uncomment the #if/#endif and what this compile !!!
- string find_lib_name(fs::path lib_test_dir){
- unsigned int count;
- fs::path::iterator e_itr = lib_test_dir.end();
- for(count = 0;; ++count){
- if(*--e_itr == "libs")
- break;
- if(lib_test_dir.empty())
- throw std::string("must be run from within a library directory");
- }
- string library_name;
- for(;;){
- library_name.append(*++e_itr);
- if(1 == --count)
- break;
- library_name.append("/");
- }
- return library_name;
- }
-
- fs::path find_boost_root(){
- fs::path boost_root = fs::initial_path();
- for(;;){
- if(fs::is_directory( boost_root / "boost")){
- break;
- }
- if(boost_root.empty())
- throw std::string("boost root not found");
- boost_root.remove_leaf();
- }
-
- return boost_root;
- }
-
- // do_table ----------------------------------------------------------------//
- void do_table(const string & lib_name)
- {
- col_node root_node;
-
- fs::path lib_test_dir = find_lib_test_dir();
-
- for ( fs::directory_iterator itr(lib_test_dir); itr != end_itr; ++itr )
- {
- if(! fs::is_directory(*itr))
- continue;
- build_node_tree(*itr, root_node);
- }
-
- // visit directory nodes and record nodetree
- report << "<table border=\"1\" cellspacing=\"0\" cellpadding=\"5\">\n";
-
- // emit
- root_node.get_spans();
- int row_count = header_depth(root_node);
- report << "<tr>\n";
- report << "<td rowspan=\"" << row_count << "\">Test Name</td>\n";
-
- // emit column headers
- int row_index = 0;
- for(;;){
- emit_column_headers(root_node, row_index, 0, row_count);
- report << "</tr>" ;
- if(++row_index == row_count)
- break;
- report << "<tr>\n";
- }
-
- // now the rest of the table body
- do_table_body(root_node, lib_name, lib_test_dir);
-
- report << "</table>\n";
- }
-}// unnamed namespace
-
-// main --------------------------------------------------------------------//
-
-#define BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE
-#include <boost/test/included/prg_exec_monitor.hpp>
-
-int cpp_main( int argc, char * argv[] ) // note name!
-{
- fs::path comment_path;
- while ( argc > 1 && *argv[1] == '-' )
- {
- if ( argc > 2 && std::strcmp( argv[1], "--compiler" ) == 0 )
- { specific_compiler = argv[2]; --argc; ++argv; }
- else if ( argc > 2 && std::strcmp( argv[1], "--locate-root" ) == 0 )
- { locate_root = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( argc > 2 && std::strcmp( argv[1], "--boost-root" ) == 0 )
- { boost_root = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( argc > 2 && std::strcmp( argv[1], "--comment" ) == 0 )
- { comment_path = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( argc > 2 && std::strcmp( argv[1], "--notes" ) == 0 )
- { notes_path = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( argc > 2 && std::strcmp( argv[1], "--notes-map" ) == 0 )
- { notes_map_path = fs::path( argv[2], fs::native ); --argc; ++argv; }
- else if ( std::strcmp( argv[1], "--ignore-pass" ) == 0 ) ignore_pass = true;
- else if ( std::strcmp( argv[1], "--no-warn" ) == 0 ) no_warn = true;
- else if ( std::strcmp( argv[1], "--v2" ) == 0 )
- {--argc; ++argv ;} // skip
- else if ( argc > 2 && std::strcmp( argv[1], "--jamfile" ) == 0)
- {--argc; ++argv;} // skip
- else { std::cerr << "Unknown option: " << argv[1] << "\n"; argc = 1; }
- --argc;
- ++argv;
- }
-
- if ( argc != 2 && argc != 3 )
- {
- std::cerr <<
- "Usage: library_status [options...] status-file [links-file]\n"
- " boost-root is the path to the boost tree root directory.\n"
- " status-file and links-file are paths to the output files.\n"
- " options: --compiler name Run for named compiler only\n"
- " --ignore-pass Do not report tests which pass all compilers\n"
- " --no-warn Warnings not reported if test passes\n"
- " --boost-root path default derived from current path.\n"
- " --locate-root path Path to ALL_LOCATE_TARGET for bjam;\n"
- " default boost-root.\n"
- " --comment path Path to file containing HTML\n"
- " to be copied into status-file.\n"
- " --notes path Path to file containing HTML\n"
- " to be copied into status-file.\n"
- " --notes-map path Path to file of toolset/test,n lines, where\n"
- " n is number of note bookmark in --notes file.\n"
- "Example: compiler_status --compiler gcc /boost-root cs.html cs-links.html\n"
- "Note: Only the leaf of the links-file path and --notes file string are\n"
- "used in status-file HTML links. Thus for browsing, status-file,\n"
- "links-file, and --notes file must all be in the same directory.\n"
- ;
- return 1;
- }
-
- if(boost_root.empty())
- boost_root = find_boost_root();
- if ( locate_root.empty() )
- locate_root = boost_root;
-
- report.open( fs::path( argv[1], fs::native ) );
- if ( !report )
- {
- std::cerr << "Could not open report output file: " << argv[2] << std::endl;
- return 1;
- }
-
- if ( argc == 3 )
- {
- fs::path links_path( argv[2], fs::native );
- links_name = links_path.leaf();
- links_file.open( links_path );
- if ( !links_file )
- {
- std::cerr << "Could not open links output file: " << argv[3] << std::endl;
- return 1;
- }
- }
- else no_links = true;
-
- build_notes_bookmarks();
-
- const string library_name = find_lib_name(fs::initial_path());
-
- char run_date[128];
- std::time_t tod;
- std::time( &tod );
- std::strftime( run_date, sizeof(run_date),
- "%X UTC, %A %d %B %Y", std::gmtime( &tod ) );
-
- report
- << "<html>\n"
- << "<head>\n"
- << "<title>Boost Library Status Automatic Test</title>\n"
- << "</head>\n"
- << "<body bgcolor=\"#ffffff\" text=\"#000000\">\n"
- << "<table border=\"0\">\n"
- << "<tr>\n"
- << "<td><img border=\"0\" "
- << "src=\""
- << boost_root / "boost.png"
- << "\" width=\"277\" "
- << "height=\"86\"></td>\n"
- << "<td>\n"
- << "<h1>Library Status: " + library_name + "</h1>\n"
- << "<b>Run Date:</b> "
- << run_date
- << "\n"
- ;
-
- if ( !comment_path.empty() )
- {
- fs::ifstream comment_file( comment_path );
- if ( !comment_file )
- {
- std::cerr << "Could not open \"--comment\" input file: " << comment_path.string() << std::endl;
- return 1;
- }
- char c;
- while ( comment_file.get( c ) ) { report.put( c ); }
- }
-
- report << "</td>\n</table>\n<br>\n";
-
- if ( !no_links )
- {
- links_file
- << "<html>\n"
- << "<head>\n"
- << "<title>Boost Library Status Error Log</title>\n"
- << "</head>\n"
- << "<body bgcolor=\"#ffffff\" text=\"#000000\">\n"
- << "<table border=\"0\">\n"
- << "<tr>\n"
- << "<td><img border=\"0\" src=\""
- << boost_root / "boost.png"
- << "\" width=\"277\" "
- << "height=\"86\"></td>\n"
- << "<td>\n"
- << "<h1>Library Status: " + library_name + "</h1>\n"
- << "<b>Run Date:</b> "
- << run_date
- << "\n</td>\n</table>\n<br>\n"
- ;
- }
-
- do_table(library_name);
-
- if ( load_notes_html() ) report << notes_html << "\n";
-
- report << "</body>\n"
- "</html>\n"
- ;
-
- if ( !no_links )
- {
- links_file
- << "</body>\n"
- "</html>\n"
- ;
- }
- return 0;
-}
Deleted: trunk/tools/regression/library_test.bat
==============================================================================
--- trunk/tools/regression/library_test.bat 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,15 +0,0 @@
-_at_echo off
-if not "%1" == "" goto bjam
- echo Usage: %0 "<bjam arguments>"
- echo where typical bjam arguements are:
- echo --toolset=msvc-7.1,gcc
- echo variant=debug,release,profile
- echo link=static,shared
- echo threading=single,multi
- echo -sBOOST_ARCHIVE_LIST="<archive name>"
- goto end
-:bjam
- bjam --dump-tests %* >bjam.log 2>&1
- process_jam_log --v2 <bjam.log
- library_status library_status.html links.html
-:end
Deleted: trunk/tools/regression/library_test.sh
==============================================================================
--- trunk/tools/regression/library_test.sh 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,14 +0,0 @@
-if test $# -eq 0
-then
- echo "Usage: $0 <bjam arguments>"
- echo "Typical bjam arguements are:"
- echo " --toolset=msvc-7.1,gcc"
- echo " variant=debug,release,profile"
- echo " link=static,shared"
- echo " threading=single,multi"
- echo " -sBOOST_ARCHIVE_LIST=<archive name>"
-else
- bjam --dump-tests $@ >bjam.log 2>&1
- process_jam_log --v2 <bjam.log
- library_status library_status.html links.html
-fi
Deleted: trunk/tools/regression/library_test_all.sh
==============================================================================
--- trunk/tools/regression/library_test_all.sh 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,85 +0,0 @@
-if test $# -eq 0
-then
- echo "Usage: $0 <bjam arguments>"
- echo "Typical bjam arguments are:"
- echo " --toolset=msvc-7.1,gcc"
- echo " variant=debug,release,profile"
- echo " link=static,shared"
- echo " threading=single,multi"
- echo
- echo "note: make sure this script is run from boost root directory !!!"
- exit 1
-fi
-
-if ! test -e libs
-then
- echo No libs directory found. Run from boost root directory !!!
- exit 1
-fi
-
-#html header
-cat <<end >status/library_status_contents.html
-<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<!--
-(C) Copyright 2007 Robert Ramey - http://www.rrsd.com .
-Use, modification and distribution is subject to the Boost Software
-License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-http://www.boost.org/LICENSE_1_0.txt)
--->
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<link rel="stylesheet" type="text/css" href="../boost.css">
-<title>Library Status Contents</title>
-<body>
-end
-
-cd >nul libs
-
-# runtests, create library pages, and body of summary page
-for lib_name in *
-do
- if test -d $lib_name
- then
- cd >nul $lib_name
-
- if test -e "test/Jamfile.v2"
- then
- cd >nul test
- echo $lib_name
- echo >>../../../status/library_status_contents.html "<a target=\"detail\" href=\"../libs/$lib_name/test/library_status.html\">$lib_name</a><br>"
- ../../../tools/regression/library_test $@
- cd >nul ..
- fi
-
- for sublib_name in *
- do
- if test -d $sublib_name
- then
- cd >nul $sublib_name
- if test -e "test/Jamfile.v2"
- then
- cd >nul test
- echo $lib_name/$sublib_name
- echo >>../../../../status/library_status_contents.html "<a target=\"detail\" href=\"../libs/$lib_name/$sublib_name/test/library_status.html\">$lib_name/$sublib_name</a><br>"
- ../../../../tools/regression/library_test $@
- cd >nul ..
- fi
- cd >nul ..
- fi
- done
-
- cd >nul ..
- fi
-done
-
-
-cd >nul ..
-
-#html trailer
-cat <<end >>status/library_status_contents.html
-</body>
-</html>
-end
-
-
Deleted: trunk/tools/regression/process_jam_log.cpp
==============================================================================
--- trunk/tools/regression/process_jam_log.cpp 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,809 +0,0 @@
-// process jam regression test output into XML -----------------------------//
-
-// Copyright Beman Dawes 2002. Distributed under the Boost
-// Software License, Version 1.0. (See accompanying file
-// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-// See http://www.boost.org/tools/regression for documentation.
-
-#include "detail/tiny_xml.hpp"
-#include "boost/filesystem/operations.hpp"
-#include "boost/filesystem/fstream.hpp"
-#include "boost/filesystem/exception.hpp"
-#include "boost/filesystem/convenience.hpp"
-
-#include <iostream>
-#include <string>
-#include <cstring>
-#include <map>
-#include <utility> // for make_pair
-#include <ctime>
-#include <cctype> // for tolower
-
-using std::string;
-namespace xml = boost::tiny_xml;
-namespace fs = boost::filesystem;
-
-#define BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE
-#include <boost/test/included/prg_exec_monitor.hpp>
-
-// options
-
-static bool echo = false;
-static bool create_dirs = false;
-static bool boost_build_v2 = false;
-
-namespace
-{
- struct test_info
- {
- string file_path; // relative boost-root
- string type;
- bool always_show_run_output;
- };
- typedef std::map< string, test_info > test2info_map; // key is test-name
- test2info_map test2info;
-
- fs::path boost_root;
- fs::path locate_root; // ALL_LOCATE_TARGET (or boost_root if none)
-
-// append_html -------------------------------------------------------------//
-
- void append_html( const string & src, string & target )
- {
- // there are a few lines we want to ignore
- if ( src.find( "th target..." ) != string::npos
- || src.find( "cc1plus.exe: warning: changing search order for system directory" ) != string::npos
- || src.find( "cc1plus.exe: warning: as it has already been specified as a non-system directory" ) != string::npos
- ) return;
-
- // on some platforms (e.g. tru64cxx) the following line is a real performance boost
- target.reserve(src.size() * 2 + target.size());
-
- for ( string::size_type pos = 0; pos < src.size(); ++pos )
- {
- if ( src[pos] == '<' ) target += "<";
- else if ( src[pos] == '>' ) target += ">";
- else if ( src[pos] == '&' ) target += "&";
- else target += src[pos];
- }
- }
-
- // timestamp ---------------------------------------------------------------//
-
- string timestamp()
- {
- char run_date[128];
- std::time_t tod;
- std::time( &tod );
- std::strftime( run_date, sizeof(run_date),
- "%Y-%m-%d %X UTC", std::gmtime( &tod ) );
- return string( run_date );
- }
-
-// convert path separators to forward slashes ------------------------------//
-
- void convert_path_separators( string & s )
- {
- for ( string::iterator itr = s.begin(); itr != s.end(); ++itr )
- if ( *itr == '\\' || *itr == '!' ) *itr = '/';
- }
-
-// trim_left ----------------------------------------------------------------//
-
- std::string trim_left( std::string const& s )
- {
- std::string::size_type const pos( s.find_first_not_of(' ') );
- return pos != std::string::npos
- ? s.substr( pos, s.size() - pos + 1 )
- : ""
- ;
- }
-
-
-// split --------------------------------------------------------------------//
-
- std::vector<std::string> split( std::string const& s )
- {
- std::string::size_type const pos( s.find_first_of(' ') );
- std::vector<std::string> result( 1, s.substr( 0, pos ) );
- if ( pos == std::string::npos )
- return result;
-
- std::vector<std::string> const rest( split( trim_left( s.substr( pos, s.size() - pos + 1 ) ) ) );
- result.insert( result.end(), rest.begin(), rest.end() );
- return result;
- }
-
-
-// extract a target directory path from a jam target string ----------------//
-// s may be relative to the initial_path:
-// ..\..\..\libs\foo\build\bin\libfoo.lib\vc7\debug\runtime-link-dynamic\boo.obj
-// s may be absolute:
-// d:\myboost\libs\foo\build\bin\libfoo.lib\vc7\debug\runtime-link-dynamic\boo.obj
-// return path is always relative to the boost directory tree:
-// libs/foo/build/bin/libfs.lib/vc7/debug/runtime-link-dynamic
-
- string target_directory( const string & s )
- {
- string temp( s );
- convert_path_separators( temp );
- 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 );
- if ( echo )
- std::cout << "\ttarget_directory( \"" << s << "\") -> \"" << temp << "\"" << std::endl;
- return temp;
- }
-
- string::size_type target_name_end( const string & s )
- {
- string::size_type pos = s.find( ".test/" );
- if ( pos == string::npos ) pos = s.find( ".dll/" );
- if ( pos == string::npos ) pos = s.find( ".so/" );
- if ( pos == string::npos ) pos = s.find( ".lib/" );
- if ( pos == string::npos ) pos = s.find( ".pyd/" );
- if ( pos == string::npos ) pos = s.find( ".a/" );
- return pos;
- }
-
- string toolset( const string & s )
- {
- string::size_type pos = target_name_end( s );
- if ( pos == string::npos ) pos = s.find( "build/" );
- if ( pos == string::npos ) return "";
- pos = s.find( "/", pos ) + 1;
- return s.substr( pos, s.find( "/", pos ) - pos );
- }
-
- string test_name( const string & s )
- {
- string::size_type pos = target_name_end( s );
- if ( pos == string::npos ) return "";
- string::size_type pos_start = s.rfind( '/', pos ) + 1;
- return s.substr( pos_start,
- (s.find( ".test/" ) != string::npos
- ? pos : s.find( "/", pos )) - pos_start );
- }
-
- // Take a path to a target directory of test, and
- // returns library name corresponding to that path.
- string test_path_to_library_name( string const& path )
- {
- std::string result;
- string::size_type start_pos( path.find( "libs/" ) );
- if ( start_pos != string::npos )
- {
- // The path format is ...libs/functional/hash/test/something.test/....
- // So, the part between "libs" and "test/something.test" can be considered
- // as library name. But, for some libraries tests are located too deep,
- // say numeric/ublas/test/test1 directory, and some libraries have tests
- // in several subdirectories (regex/example and regex/test). So, nested
- // directory may belong to several libraries.
-
- // To disambituate, it's possible to place a 'sublibs' file in
- // a directory. It means that child directories are separate libraries.
- // It's still possible to have tests in the directory that has 'sublibs'
- // file.
-
- std::string interesting;
- start_pos += 5;
- string::size_type end_pos( path.find( ".test/", start_pos ) );
- end_pos = path.rfind('/', end_pos);
- if (path.substr(end_pos - 5, 5) == "/test")
- interesting = path.substr( start_pos, end_pos - 5 - start_pos );
- else
- interesting = path.substr( start_pos, end_pos - start_pos );
-
- // Take slash separate elements until we have corresponding 'sublibs'.
- end_pos = 0;
- for(;;)
- {
- end_pos = interesting.find('/', end_pos);
- if (end_pos == string::npos) {
- result = interesting;
- break;
- }
- result = interesting.substr(0, end_pos);
-
- if ( fs::exists( ( boost_root / "libs" ) / result / "sublibs" ) )
- {
- end_pos = end_pos + 1;
- }
- else
- break;
- }
- }
-
- return result;
- }
-
- // Tries to find target name in the string 'msg', starting from
- // position start.
- // If found, extract the directory name from the target name and
- // stores it in 'dir', and return the position after the target name.
- // Otherwise, returns string::npos.
- string::size_type parse_skipped_msg_aux(const string& msg,
- string::size_type start,
- string& dir)
- {
- dir.clear();
- string::size_type start_pos = msg.find( '<', start );
- if ( start_pos == string::npos ) return string::npos;
- ++start_pos;
- string::size_type end_pos = msg.find( '>', start_pos );
- dir += msg.substr( start_pos, end_pos - start_pos );
- if ( boost_build_v2 )
- {
- // The first letter is a magic value indicating
- // the type of grist.
- convert_path_separators( dir );
- dir.erase( 0, 1 );
- // We need path from root, not from 'status' dir.
- if (dir.find("../") == 0)
- dir.erase(0,3);
- else // dir is always relative to the boost directory tree
- dir.erase( 0, locate_root.string().size()+1 );
- }
- else
- {
- if ( dir[0] == '@' )
- {
- // new style build path, rooted build tree
- convert_path_separators( dir );
- dir.replace( 0, 1, "bin/" );
- }
- else
- {
- // old style build path, integrated build tree
- start_pos = dir.rfind( '!' );
- convert_path_separators( dir );
- string::size_type path_sep_pos = dir.find( '/', start_pos + 1 );
- if ( path_sep_pos != string::npos )
- dir.insert( path_sep_pos, "/bin" );
- else
- {
- // see http://article.gmane.org/gmane.comp.lib.boost.devel/146688;
- // the following code assumes that: a) 'dir' is not empty,
- // b) 'end_pos != string::npos' and c) 'msg' always ends with '...'
- if ( dir[dir.size() - 1] == '@' )
- dir += "/" + msg.substr( end_pos + 1, msg.size() - end_pos - 1 - 3 );
- }
- }
- }
- return end_pos;
- }
-
- // the format of paths is really kinky, so convert to normal form
- // first path is missing the leading "..\".
- // first path is missing "\bin" after "status".
- // second path is missing the leading "..\".
- // second path is missing "\bin" after "build".
- // second path uses "!" for some separators.
- void parse_skipped_msg( const string & msg,
- string & first_dir, string & second_dir )
- {
- string::size_type pos = parse_skipped_msg_aux(msg, 0, first_dir);
- if (pos == string::npos)
- return;
- parse_skipped_msg_aux(msg, pos, second_dir);
- }
-
-// test_log hides database details -----------------------------------------//
-
- class test_log
- : boost::noncopyable
- {
- const string & m_target_directory;
- xml::element_ptr m_root;
- public:
- test_log( const string & target_directory,
- const string & test_name,
- const string & toolset,
- bool force_new_file )
- : m_target_directory( target_directory )
- {
- if ( !force_new_file )
- {
- fs::path pth( locate_root / target_directory / "test_log.xml" );
- fs::ifstream file( pth );
- if ( file ) // existing file
- {
- try
- {
- m_root = xml::parse( file, pth.string() );
- return;
- }
- catch(...)
- {
- // unable to parse existing XML file, fall through
- }
- }
- }
-
- string library_name( test_path_to_library_name( target_directory ) );
-
- test_info info;
- test2info_map::iterator itr( test2info.find( library_name + "/" + test_name ) );
- if ( itr != test2info.end() )
- info = itr->second;
-
- if ( !info.file_path.empty() )
- library_name = test_path_to_library_name( info.file_path );
-
- if ( info.type.empty() )
- {
- if ( target_directory.find( ".lib/" ) != string::npos
- || target_directory.find( ".dll/" ) != string::npos
- || target_directory.find( ".so/" ) != string::npos
- || target_directory.find( ".dylib/" ) != string::npos
- || target_directory.find( "/build/" ) != string::npos
- )
- {
- info.type = "lib";
- }
- else if ( target_directory.find( ".pyd/" ) != string::npos )
- info.type = "pyd";
- }
-
- m_root.reset( new xml::element( "test-log" ) );
- m_root->attributes.push_back(
- xml::attribute( "library", library_name ) );
- m_root->attributes.push_back(
- xml::attribute( "test-name", test_name ) );
- m_root->attributes.push_back(
- xml::attribute( "test-type", info.type ) );
- m_root->attributes.push_back(
- xml::attribute( "test-program", info.file_path ) );
- m_root->attributes.push_back(
- xml::attribute( "target-directory", target_directory ) );
- m_root->attributes.push_back(
- xml::attribute( "toolset", toolset ) );
- m_root->attributes.push_back(
- xml::attribute( "show-run-output",
- info.always_show_run_output ? "true" : "false" ) );
- }
-
- ~test_log()
- {
- fs::path pth( locate_root / m_target_directory / "test_log.xml" );
- if ( create_dirs && !fs::exists( pth.branch_path() ) )
- fs::create_directories( pth.branch_path() );
- fs::ofstream file( pth );
- if ( !file )
- {
- std::cout << "*****Warning - can't open output file: "
- << pth.string() << "\n";
- }
- else xml::write( *m_root, file );
- }
-
- const string & target_directory() const { return m_target_directory; }
-
- void remove_action( const string & action_name )
- // no effect if action_name not found
- {
- xml::element_list::iterator itr;
- for ( itr = m_root->elements.begin();
- itr != m_root->elements.end() && (*itr)->name != action_name;
- ++itr ) {}
- if ( itr != m_root->elements.end() ) m_root->elements.erase( itr );
- }
-
- void add_action( const string & action_name,
- const string & result,
- const string & timestamp,
- const string & content )
- {
- remove_action( action_name );
- xml::element_ptr action( new xml::element(action_name) );
- m_root->elements.push_back( action );
- action->attributes.push_back( xml::attribute( "result", result ) );
- action->attributes.push_back( xml::attribute( "timestamp", timestamp ) );
- action->content = content;
- }
- };
-
-// message_manager maps input messages into test_log actions ---------------//
-
- class message_manager
- : boost::noncopyable
- {
- string m_action_name; // !empty() implies action pending
- // IOW, a start_message awaits stop_message
- string m_target_directory;
- string m_test_name;
- string m_toolset;
-
- bool m_note; // if true, run result set to "note"
- // set false by start_message()
-
- // data needed to stop further compile action after a compile failure
- // detected in the same target directory
- string m_previous_target_directory;
- bool m_compile_failed;
-
- public:
- message_manager() : m_note(false) {}
- ~message_manager() { /*assert( m_action_name.empty() );*/ }
-
- bool note() const { return m_note; }
- void note( bool value ) { m_note = value; }
-
- void start_message( const string & action_name,
- const string & target_directory,
- const string & test_name,
- const string & toolset,
- const string & prior_content )
- {
- assert( !target_directory.empty() );
-
- if ( !m_action_name.empty() ) stop_message( prior_content );
- m_action_name = action_name;
- m_target_directory = target_directory;
- m_test_name = test_name;
- m_toolset = toolset;
- m_note = false;
-
- if ( m_previous_target_directory != target_directory )
- {
- m_previous_target_directory = target_directory;
- m_compile_failed = false;
- }
- }
-
- void stop_message( const string & content )
- {
- if ( m_action_name.empty() ) return;
- stop_message( m_action_name, m_target_directory,
- "succeed", timestamp(), content );
- }
-
- void stop_message( const string & action_name,
- const string & target_directory,
- const string & result,
- const string & timestamp,
- const string & content )
- // the only valid action_names are "compile", "link", "run", "lib"
- {
- // My understanding of the jam output is that there should never be
- // a stop_message that was not preceeded by a matching start_message.
- // That understanding is built into message_manager code.
- assert( m_action_name == action_name );
- assert( m_target_directory == target_directory );
- assert( result == "succeed" || result == "fail" );
-
- // if test_log.xml entry needed
- if ( !m_compile_failed
- || action_name != "compile"
- || m_previous_target_directory != target_directory )
- {
- if ( action_name == "compile"
- && result == "fail" ) m_compile_failed = true;
-
- test_log tl( target_directory,
- m_test_name, m_toolset, action_name == "compile" );
- tl.remove_action( "lib" ); // always clear out lib residue
-
- // dependency removal
- if ( action_name == "lib" )
- {
- tl.remove_action( "compile" );
- tl.remove_action( "link" );
- tl.remove_action( "run" );
- }
- else if ( action_name == "compile" )
- {
- tl.remove_action( "link" );
- tl.remove_action( "run" );
- if ( result == "fail" ) m_compile_failed = true;
- }
- else if ( action_name == "link" )
- {
- tl.remove_action( "run" );
- }
-
- // dependency removal won't work right with random names, so assert
- else { assert( action_name == "run" ); }
-
- // add the "run" stop_message action
- tl.add_action( action_name,
- result == "succeed" && note() ? std::string("note") : result,
- timestamp, content );
- }
-
- m_action_name = ""; // signal no pending action
- m_previous_target_directory = target_directory;
- }
- };
-}
-
-
-// main --------------------------------------------------------------------//
-
-
-int cpp_main( int argc, char ** argv )
-{
- // Turn off synchronization with corresponding C standard library files. This
- // gives a significant speed improvement on platforms where the standard C++
- // streams are implemented using standard C files.
- std::ios::sync_with_stdio(false);
-
- if ( argc <= 1 )
- std::cout << "Usage: bjam [bjam-args] | process_jam_log [--echo] [--create-directories] [--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";
-
- boost_root = fs::initial_path();
-
- while ( !boost_root.empty()
- && !fs::exists( boost_root / "libs" ) )
- {
- boost_root /= "..";
- }
-
- if ( boost_root.empty() )
- {
- std::cout << "must be run from within the boost-root directory tree\n";
- return 1;
- }
-
- boost_root.normalize();
-
- if ( argc > 1 && std::strcmp( argv[1], "--echo" ) == 0 )
- {
- echo = true;
- --argc; ++argv;
- }
-
-
- if (argc > 1 && std::strcmp( argv[1], "--create-directories" ) == 0 )
- {
- create_dirs = true;
- --argc; ++argv;
- }
-
- if ( argc > 1 && std::strcmp( argv[1], "--v2" ) == 0 )
- {
- boost_build_v2 = true;
- --argc; ++argv;
- }
-
-
- if (argc > 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
- {
- locate_root = boost_root;
- }
-
- std::cout << "boost_root: " << boost_root.string() << '\n'
- << "locate_root: " << locate_root.string() << '\n';
-
- message_manager mgr;
-
- string line;
- 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.)
- // * Calls stop_message() to stop capturing lines.
- // * Capture lines if line capture on.
-
- int line_num = 0;
- while ( std::getline( *input, line ) )
- {
- ++line_num;
-
- std::vector<std::string> const line_parts( split( line ) );
- std::string const line_start( line_parts[0] != "...failed"
- ? line_parts[0]
- : line_parts[0] + " " + line_parts[1]
- );
-
- if ( echo )
- {
- std::cout
- << "line " << line_num << ": " << line << "\n"
- << "\tline_start: " << line_start << "\n";
- }
-
- // create map of test-name to test-info
- if ( line_start.find( "boost-test(" ) == 0 )
- {
- string::size_type pos = line.find( '"' );
- string test_name( line.substr( pos+1, line.find( '"', pos+1)-pos-1 ) );
- test_info info;
- info.always_show_run_output
- = line.find( "\"always_show_run_output\"" ) != string::npos;
- info.type = line.substr( 11, line.find( ')' )-11 );
- for (unsigned int i = 0; i!=info.type.size(); ++i )
- { info.type[i] = std::tolower( info.type[i] ); }
- pos = line.find( ':' );
- // the rest of line is missing if bjam didn't know how to make target
- if ( pos + 1 != line.size() )
- {
- info.file_path = line.substr( pos+3,
- line.find( "\"", pos+3 )-pos-3 );
- convert_path_separators( info.file_path );
- if ( info.file_path.find( "libs/libs/" ) == 0 ) info.file_path.erase( 0, 5 );
- if ( test_name.find( "/" ) == string::npos )
- test_name = "/" + test_name;
- test2info.insert( std::make_pair( test_name, info ) );
- // std::cout << test_name << ", " << info.type << ", " << info.file_path << "\n";
- }
- else
- {
- std::cout << "*****Warning - missing test path: " << line << "\n"
- << " (Usually occurs when bjam doesn't know how to make a target)\n";
- }
- continue;
- }
-
- // these actions represent both the start of a new action
- // and the end of a failed action
- else if ( line_start.find( "C++-action" ) != string::npos
- || line_start.find( "vc-C++" ) != string::npos
- || line_start.find( "C-action" ) != string::npos
- || line_start.find( "Cc-action" ) != string::npos
- || line_start.find( "vc-Cc" ) != string::npos
- || line_start.find( ".compile.") != string::npos
- || line_start.find( "compile-") != string::npos
- || line_start.find( "-compile") != string::npos
- || line_start.find( "Link-action" ) != string::npos
- || line_start.find( "vc-Link" ) != string::npos
- || line_start.find( "Archive-action" ) != string::npos
- || line_start.find( ".archive") != string::npos
- || ( line_start.find( ".link") != string::npos &&
- // .linkonce is present in gcc linker messages about
- // unresolved symbols. We don't have to parse those
- line_start.find( ".linkonce" ) == string::npos )
- )
- {
- if ( !test2info.size() )
- {
- std::cout << "*****Error - No \"boost-test\" lines encountered.\n"
- " (Usually occurs when bjam was envoked without the --dump-tests option\n"
- " or bjam was envoked in the wrong directory)\n";
- return 1;
- }
-
- string action( ( line_start.find( "Link-action" ) != string::npos
- || line_start.find( "vc-Link" ) != string::npos
- || line_start.find( "Archive-action" ) != string::npos
- || line_start.find( ".archive") != string::npos
- || line_start.find( ".link") != string::npos
- )
- ? "link" : "compile"
- );
-
- if ( line_start.find( "...failed " ) != string::npos )
- {
- mgr.stop_message( action, target_directory( line ),
- "fail", timestamp(), content );
- }
- else
- {
- string target_dir( target_directory( line ) );
- mgr.start_message( action, target_dir,
- test_name( target_dir ), toolset( target_dir ), content );
- }
- content = "\n";
- capture_lines = true;
- }
-
- // these actions are only used to stop the previous action
- else if ( line_start.find( "-Archive" ) != string::npos
- || line_start.find( "MkDir" ) == 0 )
- {
- mgr.stop_message( content );
- content.clear();
- capture_lines = false;
- }
-
- else if ( line_start.find( "execute-test" ) != string::npos
- || line_start.find( "capture-output" ) != string::npos )
- {
- if ( line_start.find( "...failed " ) != string::npos )
- {
- mgr.stop_message( "run", target_directory( line ),
- "fail", timestamp(), content );
- content = "\n";
- capture_lines = true;
- }
- else
- {
- string target_dir( target_directory( line ) );
- mgr.start_message( "run", target_dir,
- test_name( target_dir ), toolset( target_dir ), content );
-
- // contents of .output file for content
- capture_lines = false;
- content = "\n";
- fs::ifstream file( locate_root / target_dir
- / (test_name(target_dir) + ".output") );
- if ( file )
- {
- string ln;
- while ( std::getline( file, ln ) )
- {
- if ( ln.find( "<note>" ) != string::npos ) mgr.note( true );
- append_html( ln, content );
- content += "\n";
- }
- }
- }
- }
-
- // bjam indicates some prior dependency failed by a "...skipped" message
- else if ( line_start.find( "...skipped" ) != string::npos
- && line.find( "<directory-grist>" ) == string::npos
- )
- {
- mgr.stop_message( content );
- content.clear();
- capture_lines = false;
-
- if ( line.find( " for lack of " ) != string::npos )
- {
- capture_lines = ( line.find( ".run for lack of " ) == string::npos );
-
- string target_dir;
- string lib_dir;
-
- parse_skipped_msg( line, target_dir, lib_dir );
-
- if ( target_dir != lib_dir ) // it's a lib problem
- {
- mgr.start_message( "lib", target_dir,
- test_name( target_dir ), toolset( target_dir ), content );
- content = lib_dir;
- mgr.stop_message( "lib", target_dir, "fail", timestamp(), content );
- content = "\n";
- }
- }
-
- }
-
- else if ( line_start.find( "**passed**" ) != string::npos
- || line_start.find( "failed-test-file" ) != string::npos
- || line_start.find( "command-file-dump" ) != string::npos )
- {
- mgr.stop_message( content );
- content = "\n";
- capture_lines = true;
- }
-
- else if ( capture_lines ) // hang onto lines for possible later use
- {
- append_html( line, content );;
- content += "\n";
- }
- }
-
- mgr.stop_message( content );
- if (input != &std::cin)
- delete input;
- return 0;
-}
Deleted: trunk/tools/regression/regression-logs.pl
==============================================================================
--- trunk/tools/regression/regression-logs.pl 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,197 +0,0 @@
-#!/usr/bin/perl
-
-#~ Copyright 2003, Rene Rivera.
-#~ Use, modification and distribution are subject to the Boost Software
-#~ License Version 1.0. (See accompanying file LICENSE_1_0.txt or
-#~ http://www.boost.org/LICENSE_1_0.txt)
-
-use FileHandle;
-use Time::Local;
-
-# Get the whle percent value
-#
-sub percent_value
-{
- my ($count,$total) = @_;
- my $percent = int (($count/$total)*100+0.5);
- if ($count > 0 && $percent == 0) { $percent = 1; }
- if ($count < $total && $percent == 100) { $percent = 99; }
- return $percent;
-}
-
-# Generate item html for the pass column.
-#
-sub result_info_pass
-{
- my ($color,$pass,$warn,$fail,$missing) = @_;
- my $percent = 100-percent_value($fail+$missing,$pass+$warn+$fail+$missing);
- return "<font color=\"$color\"><font size=\"+1\">$percent%</font><br>($warn warnings)</font>";
-}
-
-# Generate item html for the fail column.
-#
-sub result_info_fail
-{
- my ($color,$pass,$warn,$fail,$missing) = @_;
- my $percent = percent_value($fail+$missing,$pass+$warn+$fail+$missing);
- return "<font color=\"$color\"><font size=\"+1\">$percent%</font><br>($fail)</font>";
-}
-
-# Generate an age highlighted run date string.
-# Use as: data_info(run-date-html)
-#
-sub date_info
-{
- my %m = ('January',0,'February',1,'March',2,'April',3,'May',4,'June',5,
- 'July',6,'August',7,'September',8,'October',9,'November',10,'December',11);
- my @d = split(/ |:/,$_[0]);
- my ($hour,$min,$sec,$day,$month,$year) = ($d[0],$d[1],$d[2],$d[4],$m{$d[5]},$d[6]);
- #print "<!-- $hour.$min.$sec.$day.$month.$year -->\n";
- my $test_t = timegm($sec,$min,$hour,$day,$month,$year);
- my $age = time-$test_t;
- my $age_days = $age/(60*60*24);
- #print "<!-- $age_days days old -->\n";
- my $age_html = "<font>";
- if ($age_days <= 2) { }
- elsif ($age_days <= 14) { $age_html = "<font color=\"#FF9900\">"; }
- else { $age_html = "<font color=\"#FF0000\">"; }
- return $age_html.$_[0]."</font>";
-}
-
-# Generate an age string based on the run date.
-# Use as: age_info(run-date-html)
-#
-sub age_info
-{
- my %m = ('January',0,'February',1,'March',2,'April',3,'May',4,'June',5,
- 'July',6,'August',7,'September',8,'October',9,'November',10,'December',11);
- my @d = split(/ |:/,$_[0]);
- my ($hour,$min,$sec,$day,$month,$year) = ($d[0],$d[1],$d[2],$d[4],$m{$d[5]},$d[6]);
- #print "<!-- $hour.$min.$sec.$day.$month.$year -->\n";
- my $test_t = timegm($sec,$min,$hour,$day,$month,$year);
- my $age = time-$test_t;
- my $age_days = $age/(60*60*24);
- #print "<!-- $age_days days old -->\n";
- my $age_html = "<font>";
- if ($age_days <= 2) { }
- elsif ($age_days <= 14) { $age_html = "<font color=\"#FF9900\">"; }
- else { $age_html = "<font color=\"#FF0000\">"; }
- if ($age_days <= 1) { $age_html = $age_html."today"; }
- elsif ($age_days <= 2) { $age_html = $age_html."yesterday"; }
- elsif ($age_days < 14) { my $days = int $age_days; $age_html = $age_html.$days." days"; }
- elsif ($age_days < 7*8) { my $weeks = int $age_days/7; $age_html = $age_html.$weeks." weeks"; }
- else { my $months = int $age_days/28; $age_html = $age_html.$months." months"; }
- return $age_html."</font>";
-}
-
-#~ foreach my $k (sort keys %ENV)
-#~ {
- #~ print "<!-- $k = $ENV{$k} -->\n";
-#~ }
-my $logdir = "$ENV{PWD}";
-#~ my $logdir = "C:\\CVSROOTs\\Boost\\boost\\status";
-opendir LOGS, "$logdir";
-my @logs = grep /.*links[^.]*\.html$/, readdir LOGS;
-closedir LOGS;
-my @bgcolor = ( "bgcolor=\"#EEEEFF\"", "" );
-my $row = 0;
-print "<table>\n";
-print "<tr>\n",
- "<th align=\"left\" bgcolor=\"#DDDDDD\">Platform</th>\n",
- "<th align=\"left\" bgcolor=\"#DDDDDD\">Run Date</th>\n",
- "<th align=\"left\" bgcolor=\"#DDDDDD\">Age</th>\n",
- "<th align=\"left\" bgcolor=\"#DDDDDD\">Compilers</th>\n",
- "<th align=\"left\" bgcolor=\"#DDDDDD\">Pass</th>\n",
- "<th align=\"left\" bgcolor=\"#DDDDDD\">Fail</th>\n",
- "</tr>\n";
-foreach $l (sort { lc($a) cmp lc($b) } @logs)
-{
- my $log = $l;
- $log =~ s/-links//s;
- my ($spec) = ($log =~ /cs-([^\.]+)/);
- my $fh = new FileHandle;
- if ($fh->open("<$logdir/$log"))
- {
- my $content = join('',$fh->getlines());
- $fh->close;
- my ($status) = ($content =~ /(<h1>Compiler(.(?!<\/td>))+.)/si);
- my ($platform) = ($status =~ /Status: ([^<]+)/si);
- my ($run_date) = ($status =~ /Date:<\/b> ([^<]+)/si);
- $run_date =~ s/, /<br>/g;
- my ($compilers) = ($content =~ /Test Type<\/a><\/t[dh]>((.(?!<\/tr>))+.)/si);
- if ($compilers eq "") { next; }
- $compilers =~ s/-<br>//g;
- $compilers =~ s/<\/td>//g;
- my @compiler = ($compilers =~ /<td>(.*)$/gim);
- my $count = @compiler;
- my @results = ($content =~ /(>Pass<|>Warn<|>Fail<|>Missing<)/gi);
- my $test_count = (scalar @results)/$count;
- my @pass = map { 0 } (1..$count);
- my @warn = map { 0 } (1..$count);
- my @fail = map { 0 } (1..$count);
- my @missing = map { 0 } (1..$count);
- my @total = map { 0 } (1..$count);
- #~ print "<!-- ",
- #~ "pass = ",join(',',@pass)," ",
- #~ "warn = ",join(',',@warn)," ",
- #~ "fail = ",join(',',@fail)," ",
- #~ "missing = ",join(',',@missing)," ",
- #~ "total = ",join(',',@total)," ",
- #~ " -->\n";
- for my $t (1..$test_count)
- {
- my $r0 = (($t-1)*$count);
- my $r1 = (($t-1)*$count+$count-1);
- my @r = @results[(($t-1)*$count)..(($t-1)*$count+$count-1)];
- #~ print "<!-- ",
- #~ "result = ",join(',',@r)," ",
- #~ "range = ",$r0,"..",$r1," (",(scalar @results),")",
- #~ " -->\n";
- for my $c (1..$count)
- {
- if ($r[$c-1] =~ /Pass/i) { ++$pass[$c-1]; }
- elsif ($r[$c-1] =~ /Warn/i) { ++$warn[$c-1]; }
- elsif ($r[$c-1] =~ /Fail/i) { ++$fail[$c-1]; }
- elsif ($r[$c-1] =~ /Missing/i) { ++$missing[$c-1]; }
- ++$total[$c-1];
- }
- }
- #~ print "<!-- ",
- #~ "pass = ",join(',',@pass)," ",
- #~ "warn = ",join(',',@warn)," ",
- #~ "fail = ",join(',',@fail)," ",
- #~ "missing = ",join(',',@missing)," ",
- #~ "total = ",join(',',@total)," ",
- #~ " -->\n";
- for my $comp (1..(scalar @compiler))
- {
- my @lines = split(/<br>/,$compiler[$comp-1]);
- if (@lines > 2) { $compiler[$comp-1] = join(' ',@lines[0..(scalar @lines)-2])."<br>".$lines[(scalar @lines)-1]; }
- }
- print
- "<tr>\n",
- "<td rowspan=\"$count\" valign=\"top\"><font size=\"+1\">$platform</font><br>(<a href=\"./$log\">$spec</a>)</td>\n",
- "<td rowspan=\"$count\" valign=\"top\">",$run_date,"</td>\n",
- "<td rowspan=\"$count\" valign=\"top\">",age_info($run_date),"</td>\n",
- "<td valign=\"top\" ",$bgcolor[$row],">",$compiler[0],"</td>\n",
- "<td valign=\"top\" ",$bgcolor[$row],">",result_info_pass("#000000",$pass[0],$warn[0],$fail[0],$missing[0]),"</td>\n",
- "<td valign=\"top\" ",$bgcolor[$row],">",result_info_fail("#FF0000",$pass[0],$warn[0],$fail[0],$missing[0]),"</td>\n",
- "</tr>\n";
- $row = ($row+1)%2;
- foreach my $c (1..($count-1))
- {
- print
- "<tr>\n",
- "<td valign=\"top\" ",$bgcolor[$row],">",$compiler[$c],"</td>\n",
- "<td valign=\"top\" ",$bgcolor[$row],">",result_info_pass("#000000",$pass[$c],$warn[$c],$fail[$c],$missing[$c]),"</td>\n",
- "<td valign=\"top\" ",$bgcolor[$row],">",result_info_fail("#FF0000",$pass[$c],$warn[$c],$fail[$c],$missing[$c]),"</td>\n",
- "</tr>\n";
- $row = ($row+1)%2;
- }
- print
- "<tr>\n",
- "<td colspan=\"7\"><hr size=\"1\" noshade></td>\n",
- "</tr>\n";
- }
-}
-print "</table>\n";
Deleted: trunk/tools/regression/run_tests.sh
==============================================================================
--- trunk/tools/regression/run_tests.sh 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
+++ (empty file)
@@ -1,191 +0,0 @@
-#!/bin/sh
-#
-# shell script for running the boost regression test suite and generating
-# a html table of results.
-
-# Set the following variables to configure the operation. Variables you
-# should set, i.e. usually required are listed first. Optional variables
-# have reasonable defaults for most situations.
-
-
-### THESE SHOULD BE CHANGED!
-
-#
-# "boost_root" points to the root of you boost installation:
-# This can be either a non-exitent directory or an already complete Boost
-# source tree.
-#
-boost_root="$HOME/CVSROOTs/Boost/boost_regression"
-
-#
-# Wether to fetch the most current Boost code from CVS (yes/no):
-# There are two contexts to use this script in: on an active Boost CVS
-# tree, and on a fresh Boost CVS tree. If "yes" is specified here an attempt
-# to fetch the latest CVS Boost files is made. For an active Boost CVS
-# the CVS connection information is used. If an empty tree is detected
-# the code is fetched with the anonymous read only information.
-#
-cvs_update=no
-
-#
-# "test_tools" are the Boost.Build toolsets to use for building and running the
-# regression tests. Specify a space separated list, of the Boost.Build toolsets.
-# Each will be built and tested in sequence.
-#
-test_tools=gcc
-
-#
-# "toolset" is the Boost.Build toolset to use for building the helper programs.
-# This is usually different than the toolsets one is testing. And this is
-# normally a toolset that corresponds to the compiler built into your platform.
-#
-toolset=gcc
-
-#
-# "comment_path" is the path to an html-file describing the test environment.
-# The content of this file will be embedded in the status pages being produced.
-#
-comment_path="$boost_root/../regression_comment.html"
-#
-# "test_dir" is the relative path to the directory to run the tests in,
-# defaults to "status" and runs all the tests, but could be a sub-directory
-# for example "libs/regex/test" to run the regex tests alone.
-#
-test_dir="status"
-
-
-### DEFAULTS ARE OK FOR THESE.
-
-#
-# "exe_suffix" the suffix used by exectable files:
-# In case your platform requires use of a special suffix for executables specify
-# it here, including the "." if needed. This should not be needed even in Windows
-# like platforms as they will execute without the suffix anyway.
-#
-exe_suffix=
-
-#
-# "bjam" points to your built bjam executable:
-# The location of the binary for running bjam. The default should work
-# under most circumstances.
-#
-bjam="$boost_root/tools/jam/src/bin/bjam$exe_suffix"
-
-#
-# "process_jam_log", and "compiler_status" paths to built helper programs:
-# The location of the executables of the regression help programs. These
-# are built locally so the default should work in most situations.
-#
-process_jam_log="$boost_root/dist/bin/process_jam_log$exe_suffix"
-compiler_status="$boost_root/dist/bin/compiler_status$exe_suffix"
-
-#
-# "boost_build_path" can point to additional locations to find toolset files.
-#
-boost_build_path="$HOME/.boost-build"
-
-
-### NO MORE CONFIGURABLE PARTS.
-
-#
-# Some setup.
-#
-boost_dir=`basename "$boost_root"`
-if test -n "${BOOST_BUILD_PATH}" ; then
- BOOST_BUILD_PATH="$boost_build_path:$BOOST_BUILD_PATH"
-else
- BOOST_BUILD_PATH="$boost_build_path"
-fi
-export BOOST_BUILD_PATH
-
-#
-# STEP 0:
-#
-# Get the source code:
-#
-if test ! -d "$boost_root" ; then
- mkdir -p "$boost_root"
- if test $? -ne 0 ; then
- echo "creation of $boost_root directory failed."
- exit 256
- fi
-fi
-if test $cvs_update = yes ; then
- echo fetching Boost:
- echo "/1 :pserver:anonymous_at_[hidden]:2401/cvsroot/boost A" >> "$HOME/.cvspass"
- cat "$HOME/.cvspass" | sort | uniq > "$HOME/.cvspass"
- cd `dirname "$boost_root"`
- if test -f boost/CVS/Root ; then
- cvs -z3 -d `cat "$boost_dir/CVS/Root"` co -d "$boost_dir" boost
- else
- cvs -z3 -d :pserver:anonymous_at_[hidden]:2401/cvsroot/boost co -d "$boost_dir" boost
- fi
-fi
-
-#
-# STEP 1:
-# rebuild bjam if required:
-#
-echo building bjam:
-cd "$boost_root/tools/jam/src" && \
-LOCATE_TARGET=bin sh ./build.sh
-if test $? != 0 ; then
- echo "bjam build failed."
- exit 256
-fi
-
-#
-# STEP 2:
-# rebuild the regression test helper programs if required:
-#
-echo building regression test helper programs:
-cd "$boost_root/tools/regression/build" && \
-"$bjam" $toolset release
-if test $? != 0 ; then
- echo "helper program build failed."
- exit 256
-fi
-
-#
-# STEP 5:
-# repeat steps 3 and 4 for each additional toolset:
-#
-for tool in $test_tools ; do
-
-#
-# STEP 3:
-# run the regression tests:
-#
-echo running the $tool regression tests:
-cd "$boost_root/$test_dir"
-"$bjam" $tool --dump-tests 2>&1 | tee regress.log
-
-#
-# STEP 4:
-# post process the results:
-#
-echo processing the regression test results for $tool:
-cat regress.log | "$process_jam_log" --v2
-if test $? != 0 ; then
- echo "Failed regression log post processing."
- exit 256
-fi
-
-done
-
-#
-# STEP 6:
-# create the html table:
-#
-uname=`uname`
-echo generating html tables:
-"$compiler_status" --v2 --comment "$comment_path" "$boost_root" cs-$uname.html cs-$uname-links.html
-if test $? != 0 ; then
- echo "Failed HTML result table generation."
- exit 256
-fi
-
-echo "done!"
-
-
-
Modified: trunk/tools/regression/src/regression.py
==============================================================================
--- trunk/tools/regression/src/regression.py (original)
+++ trunk/tools/regression/src/regression.py 2007-10-15 10:53:28 EDT (Mon, 15 Oct 2007)
@@ -25,22 +25,22 @@
repo_path = {
'trunk' : 'trunk',
'release' : 'branches/release',
- 'build' : 'branches/release-tools/build/v2',
- 'jam' : 'branches/release-tools/jam/src',
- 'regression' : 'branches/release-tools/regression'
+ 'build' : 'trunk/tools/build/v2',
+ 'jam' : 'tags/tools/jam/Boost_Jam_3_1_15/src',
+ 'regression' : 'trunk/tools/regression'
}
class runner:
def __init__(self,root):
- commands = "commands: %s" % ', '.join(
- map(
- lambda m: m[8:].replace('_','-'),
- filter(
- lambda m: m.startswith('command_'),
- runner.__dict__.keys())
- )
+ commands = map(
+ lambda m: m[8:].replace('_','-'),
+ filter(
+ lambda m: m.startswith('command_'),
+ runner.__dict__.keys())
)
+ commands.sort()
+ commands = "commands: %s" % ', '.join(commands)
opt = optparse.OptionParser(
usage="%prog [options] [commands]",
@@ -101,17 +101,32 @@
opt.add_option( '--skip-tests',
help="do not run bjam; used for testing script changes" )
+ #~ Defaults
+ self.runner = None
self.comment='comment.html'
self.tag='trunk'
+ self.toolsets=None
self.incremental=False
self.timeout=5
+ self.bjam_options=''
+ self.bjam_toolset=''
+ self.pjl_toolset=''
self.platform=self.platform_name()
+ self.user='anonymous'
+ self.local=None
+ self.force_update=False
+ self.have_source=False
+ self.proxy=None
+ self.ftp_proxy=None
+ self.dart_server=None
self.debug_level=0
self.send_bjam_log=False
- self.bjam_toolset=''
- self.pjl_toolset=''
+ self.mail=None
+ self.smtp_login=None
+ self.skip_tests=False
( _opt_, self.actions ) = opt.parse_args(None,self)
+ #~ Initialize option dependent values.
self.regression_root = root
self.boost_root = os.path.join( self.regression_root, 'boost' )
self.regression_results = os.path.join( self.regression_root, 'results' )
@@ -123,28 +138,28 @@
self.timestamp_path = os.path.join( self.regression_root, 'timestamp' )
if sys.platform == 'win32':
self.patch_boost = 'patch_boost.bat'
- self.bjam = {
- 'name' : 'bjam.exe',
- #~ 'build_cmd' : 'build.bat %s' % self.bjam_toolset,
- 'path' : os.path.join(self.regression_root,'bjam.exe'),
- 'source_dir' : self.tools_bjam_root
- }
- self.process_jam_log = {
- 'name' : 'process_jam_log.exe',
- 'source_dir' : os.path.join(self.tools_regression_root,'build')
- }
+ self.bjam = { 'name' : 'bjam.exe' }
+ self.process_jam_log = { 'name' : 'process_jam_log.exe' }
else:
self.patch_boost = 'patch_boost'
- self.bjam = {
- 'name' : 'bjam',
- #~ 'build_cmd' : './build.sh %s' % self.bjam_toolset,
- 'path' : os.path.join(self.regression_root,'bjam'),
- 'source_dir' : self.tools_bjam_root
- }
- self.process_jam_log = {
- 'name' : 'process_jam_log',
- 'source_dir' : os.path.join(self.tools_regression_root,'build')
- }
+ self.bjam = { 'name' : 'bjam' }
+ self.process_jam_log = { 'name' : 'process_jam_log' }
+ self.bjam = {
+ 'name' : self.bjam['name'],
+ 'build_cmd' : self.bjam_build_cmd,
+ 'path' : os.path.join(self.regression_root,self.bjam['name']),
+ 'source_dir' : self.tools_bjam_root,
+ 'build_dir' : self.tools_bjam_root,
+ 'build_args' : ''
+ }
+ self.process_jam_log = {
+ 'name' : self.process_jam_log['name'],
+ 'build_cmd' : self.bjam_cmd,
+ 'path' : os.path.join(self.regression_root,self.process_jam_log['name']),
+ 'source_dir' : os.path.join(self.tools_regression_root,'build'),
+ 'build_dir' : os.path.join(self.tools_regression_root,'build'),
+ 'build_args' : 'process_jam_log -d2'
+ }
if self.debug_level > 0:
self.log('Regression root = %s'%self.regression_root)
@@ -163,7 +178,7 @@
#~ The various commands that make up the testing sequence...
def command_cleanup(self,*args):
- if args == []: args = [ 'source', 'bin' ]
+ if not args or args == None or args == []: args = [ 'source', 'bin' ]
if 'source' in args:
self.log( 'Cleaning up "%s" directory ...' % self.boost_root )
@@ -171,8 +186,8 @@
if 'bin' in args:
boost_bin_dir = os.path.join( self.boost_root, 'bin' )
- self.log( 'Cleaning up "%s" directory ...' % self.boost_bin_dir )
- self.rmtree( self.boost_bin_dir )
+ self.log( 'Cleaning up "%s" directory ...' % boost_bin_dir )
+ self.rmtree( boost_bin_dir )
boost_binv2_dir = os.path.join( self.boost_root, 'bin.v2' )
self.log( 'Cleaning up "%s" directory ...' % boost_binv2_dir )
@@ -183,16 +198,19 @@
def command_get_tools(self):
#~ Get Boost.Build v2...
+ self.log( 'Getting Boost.Build v2...' )
os.chdir( os.path.dirname(self.tools_bb_root) )
self.svn_command( 'co %s %s' % (
self.svn_repository_url(repo_path['build']),
os.path.basename(self.tools_bb_root) ) )
#~ Get Boost.Jam...
+ self.log( 'Getting Boost.Jam...' )
os.chdir( os.path.dirname(self.tools_bjam_root) )
self.svn_command( 'co %s %s' % (
self.svn_repository_url(repo_path['jam']),
os.path.basename(self.tools_bjam_root) ) )
#~ Get the regression tools and utilities...
+ self.log( 'Getting regression tools an utilities...' )
os.chdir( os.path.dirname(self.tools_regression_root) )
self.svn_command( 'co %s %s' % (
self.svn_repository_url(repo_path['regression']),
@@ -222,29 +240,186 @@
def command_patch(self):
self.import_utils()
patch_boost_path = os.path.join( self.regression_root, self.patch_boost )
- if os.path.exists( self.patch_boost ):
- self.log( 'Found patch file "%s". Executing it.' % self.patch_boost )
+ if os.path.exists( patch_boost_path ):
+ self.log( 'Found patch file "%s". Executing it.' % patch_boost_path )
os.chdir( self.regression_root )
- utils.system( [ self.patch_boost ] )
+ utils.system( [ patch_boost_path ] )
pass
def command_setup(self):
- pass
+ self.command_patch()
+ self.build_if_needed(self.bjam,self.bjam_toolset)
+ self.build_if_needed(self.process_jam_log,self.pjl_toolset)
- def command_install(self):
- pass
+ def command_test(self, *args):
+ if not args or args == None or args == []: args = [ "test", "process" ]
+ self.import_utils()
+
+ self.log( 'Making "%s" directory...' % self.regression_results )
+ utils.makedirs( self.regression_results )
+
+ results_libs = os.path.join( self.regression_results, 'libs' )
+ results_status = os.path.join( self.regression_results, 'status' )
+
+ if "clean" in args:
+ self.command_test_clean()
+
+ if "test" in args:
+ self.command_test_run()
+
+ if "process" in args:
+ self.command_test_process()
- def command_test(self):
- pass
+ def command_test_clean(self):
+ results_libs = os.path.join( self.regression_results, 'libs' )
+ results_status = os.path.join( self.regression_results, 'status' )
+ self.rmtree( results_libs )
+ self.rmtree( results_status )
- def command_collect_logs(self):
- pass
+ def command_test_run(self):
+ self.import_utils()
+ test_cmd = '%s -d2 --dump-tests %s "--build-dir=%s" >>"%s" 2>&1' % (
+ self.bjam_cmd( self.toolsets ),
+ self.bjam_options,
+ self.regression_results,
+ self.regression_log )
+ self.log( 'Starting tests (%s)...' % test_cmd )
+ cd = os.getcwd()
+ os.chdir( os.path.join( self.boost_root, 'status' ) )
+ utils.system( [ test_cmd ] )
+ os.chdir( cd )
+
+ def command_test_process(self):
+ self.import_utils()
+ self.log( 'Getting test case results out of "%s"...' % self.regression_log )
+ cd = os.getcwd()
+ os.chdir( os.path.join( self.boost_root, 'status' ) )
+ utils.checked_system( [
+ '"%s" "%s" <"%s"' % (
+ self.tool_path(self.process_jam_log),
+ self.regression_results,
+ self.regression_log )
+ ] )
+ os.chdir( cd )
- def command_upoad_logs(self):
- pass
+ def command_collect_logs(self):
+ self.import_utils()
+ comment_path = os.path.join( self.regression_root, self.comment )
+ if not os.path.exists( comment_path ):
+ self.log( 'Comment file "%s" not found; creating default comment.' % comment_path )
+ f = open( comment_path, 'w' )
+ f.write( '<p>Tests are run on %s platform.</p>' % self.platform_name() )
+ f.close()
+
+ if self.incremental:
+ run_type = 'incremental'
+ else:
+ run_type = 'full'
+
+ source = 'tarball'
+ revision = ''
+ svn_root_file = os.path.join( self.boost_root, '.svn' )
+ svn_info_file = os.path.join( self.boost_root, 'svn_info.txt' )
+ if os.path.exists( svn_root_file ):
+ source = 'SVN'
+ self.svn_command( 'info --xml "%s" >%s' % (self.boost_root,svn_info_file) )
+
+ if os.path.exists( svn_info_file ):
+ f = open( svn_info_file, 'r' )
+ svn_info = f.read()
+ f.close()
+ i = svn_info.find( 'Revision:' )
+ if i < 0: i = svn_info.find( 'revision=' ) # --xml format
+ if i >= 0:
+ i += 10
+ while svn_info[i] >= '0' and svn_info[i] <= '9':
+ revision += svn_info[i]
+ i += 1
+
+ from collect_and_upload_logs import collect_logs
+ collect_logs(
+ self.regression_results,
+ self.runner, self.tag, self.platform, comment_path,
+ self.timestamp_path,
+ self.user,
+ source, run_type,
+ self.dart_server, self.proxy,
+ revision )
+
+ def command_upload_logs(self):
+ self.import_utils()
+ from collect_and_upload_logs import upload_logs
+ self.retry(
+ lambda:
+ upload_logs(
+ self.regression_results,
+ self.runner, self.tag,
+ self.user,
+ self.ftp_proxy,
+ self.debug_level, self.send_bjam_log,
+ self.timestamp_path,
+ self.dart_server )
+ )
def command_regression(self):
- pass
+ import socket
+ import string
+ try:
+ mail_subject = 'Boost regression for %s on %s' % ( self.tag,
+ string.split(socket.gethostname(), '.')[0] )
+ start_time = time.localtime()
+ if self.mail:
+ self.log( 'Sending start notification to "%s"' % self.mail )
+ self.send_mail(
+ '%s started at %s.' % ( mail_subject, format_time( start_time ) )
+ )
+
+ self.command_get_tools()
+
+ if self.local is not None:
+ self.log( 'Using local file "%s"' % self.local )
+ b = os.path.basename( self.local )
+ tag = b[ 0: b.find( '.' ) ]
+ self.log( 'Tag: "%s"' % tag )
+ self.unpack_tarball( local )
+
+ elif self.have_source:
+ if not self.incremental: self.command_cleanup( [ 'bin' ] )
+
+ else:
+ if self.incremental or self.force_update:
+ if not self.incremental: self.command_cleanup( [ 'bin' ] )
+ else:
+ self.command_cleanup()
+ self.command_get_source()
+
+ self.command_setup()
+
+ # Not specifying --toolset in command line is not enough
+ # that would mean to use Boost.Build default ones
+ # We can skip test only we were explictly
+ # told to have no toolsets in command line "--toolset="
+ if self.toolsets != '': # --toolset=,
+ if not self.skip_tests:
+ self.command_test()
+ self.command_collect_logs()
+ self.command_upload_logs()
+
+ if self.mail:
+ self.log( 'Sending report to "%s"' % self.mail )
+ end_time = time.localtime()
+ self.send_mail(
+ '%s completed successfully at %s.' % ( mail_subject, format_time( end_time ) )
+ )
+ except:
+ if self.mail:
+ self.log( 'Sending report to "%s"' % self.mail )
+ traceback_ = '\n'.join( apply( traceback.format_exception, sys.exc_info() ) )
+ end_time = time.localtime()
+ self.send_mail(
+ '%s failed at %s.' % ( mail_subject, format_time( end_time ) ),
+ traceback_ )
+ raise
def command_show_revision(self):
modified = '$Date$'
@@ -279,11 +454,13 @@
def rmtree(self,path):
if os.path.exists( path ):
- if sys.platform == 'win32':
- os.system( 'del /f /s /q "%s" >nul 2>&1' % path )
- shutil.rmtree( unicode( path ) )
- else:
- os.system( 'rm -f -r "%s"' % path )
+ import shutil
+ shutil.rmtree( unicode( path ) )
+ #~ if sys.platform == 'win32':
+ #~ os.system( 'del /f /s /q "%s" >nul 2>&1' % path )
+ #~ shutil.rmtree( unicode( path ) )
+ #~ else:
+ #~ os.system( 'rm -f -r "%s"' % path )
def refresh_timestamp( self ):
if os.path.exists( self.timestamp_path ):
@@ -333,46 +510,107 @@
import utils as utils_module
utils = utils_module
- def build_if_needed( tool, toolset, toolsets ):
+ def build_if_needed( self, tool, toolset ):
+ self.import_utils()
if os.path.exists( tool[ 'path' ] ):
- log( 'Found preinstalled "%s"; will use it.' % tool[ 'path' ] )
+ self.log( 'Found preinstalled "%s"; will use it.' % tool[ 'path' ] )
return
- log( 'Preinstalled "%s" is not found; building one...' % tool[ 'path' ] )
+ self.log( 'Preinstalled "%s" is not found; building one...' % tool[ 'path' ] )
if toolset is None:
- if toolsets is not None:
- toolset = string.split( toolsets, ',' )[0]
- if not tool[ 'is_supported_toolset' ]( toolset ):
- log( 'Warning: Specified toolset (%s) cannot be used to bootstrap "%s".'\
- % ( toolset, tool[ 'name' ] ) )
-
- toolset = tool[ 'default_toolset' ](v2)
- log( ' Using default toolset for the platform (%s).' % toolset )
+ if self.toolsets is not None:
+ toolset = string.split( self.toolsets, ',' )[0]
else:
- toolset = tool[ 'default_toolset' ](v2)
- log( 'Warning: No bootstrap toolset for "%s" was specified.' % tool[ 'name' ] )
- log( ' Using default toolset for the platform (%s).' % toolset )
+ toolset = tool[ 'default_toolset' ]
+ self.log( 'Warning: No bootstrap toolset for "%s" was specified.' % tool[ 'name' ] )
+ self.log( ' Using default toolset for the platform (%s).' % toolset )
if os.path.exists( tool[ 'source_dir' ] ):
- log( 'Found "%s" source directory "%s"' % ( tool[ 'name' ], tool[ 'source_dir' ] ) )
- build_cmd = tool[ 'build_cmd' ]( toolset, v2 )
- log( 'Building "%s" (%s)...' % ( tool[ 'name'], build_cmd ) )
- utils.system( [
- 'cd "%s"' % tool[ 'source_dir' ]
- , build_cmd
- ] )
+ self.log( 'Found "%s" source directory "%s"' % ( tool[ 'name' ], tool[ 'source_dir' ] ) )
+ build_cmd = tool[ 'build_cmd' ]( toolset, tool['build_args'] )
+ self.log( 'Building "%s" (%s)...' % ( tool[ 'name'], build_cmd ) )
+ utils.system( [ 'cd "%s"' % tool[ 'source_dir' ], build_cmd ] )
else:
raise 'Could not find "%s" source directory "%s"' % ( tool[ 'name' ], tool[ 'source_dir' ] )
if not tool.has_key( 'build_path' ):
- tool[ 'build_path' ] = tool_path( tool, v2 )
+ tool[ 'build_path' ] = self.tool_path( tool )
if not os.path.exists( tool[ 'build_path' ] ):
raise 'Failed to find "%s" after build.' % tool[ 'build_path' ]
- log( '%s succesfully built in "%s" location' % ( tool[ 'name' ], tool[ 'build_path' ] ) )
+ self.log( '%s succesfully built in "%s" location' % ( tool[ 'name' ], tool[ 'build_path' ] ) )
+
+ def tool_path( self, name_or_spec ):
+ if isinstance( name_or_spec, basestring ):
+ return os.path.join( self.regression_root, name_or_spec )
+
+ if os.path.exists( name_or_spec[ 'path' ] ):
+ return name_or_spec[ 'path' ]
+
+ if name_or_spec.has_key( 'build_path' ):
+ return name_or_spec[ 'build_path' ]
+
+ build_dir = name_or_spec[ 'build_dir' ]
+ self.log( 'Searching for "%s" in "%s"...' % ( name_or_spec[ 'name' ], build_dir ) )
+ for root, dirs, files in os.walk( build_dir ):
+ if name_or_spec[ 'name' ] in files:
+ return os.path.join( root, name_or_spec[ 'name' ] )
+
+ raise Exception( 'Cannot find "%s" in any of the following locations:\n%s' % (
+ name_or_spec[ 'name' ]
+ , '\n'.join( [ name_or_spec[ 'path' ], build_dir ] )
+ ) )
+ def bjam_build_cmd( self, *rest ):
+ if sys.platform == 'win32':
+ cmd = 'build.bat %s' % self.bjam_toolset
+ else:
+ cmd = './build.sh %s' % self.bjam_toolset
+ env_setup_key = 'BJAM_ENVIRONMENT_SETUP'
+ if os.environ.has_key( env_setup_key ):
+ return '%s & %s' % ( os.environ[env_setup_key], cmd )
+ return cmd
+
+ def bjam_cmd( self, toolsets, args = '', *rest ):
+ build_path = self.regression_root
+ if build_path[-1] == '\\': build_path += '\\'
+
+ if self.timeout > 0:
+ args += ' -l%s' % (self.timeout*60)
+
+ cmd = '"%(bjam)s" "-sBOOST_BUILD_PATH=%(bb)s" "-sBOOST_ROOT=%(boost)s" "--boost=%(boost)s" %(arg)s' % {
+ 'bjam' : self.tool_path( self.bjam ),
+ 'bb' : os.pathsep.join([build_path,self.tools_bb_root]),
+ 'boost' : self.boost_root,
+ 'arg' : args }
+
+ if toolsets:
+ import string
+ cmd += ' ' + string.join(string.split( toolsets, ',' ), ' ' )
+
+ return cmd
+
+ def send_mail( self, subject, msg = '' ):
+ import smtplib
+ if not self.smtp_login:
+ server_name = 'mail.%s' % mail.split( '@' )[-1]
+ user_name = None
+ password = None
+ else:
+ server_name = self.smtp_login.split( '@' )[-1]
+ ( user_name, password ) = string.split( self.smtp_login.split( '@' )[0], ':' )
+
+ log( ' Sending mail through "%s"...' % server_name )
+ smtp_server = smtplib.SMTP( server_name )
+ smtp_server.set_debuglevel( self.debug_level )
+ if user_name:
+ smtp_server.login( user_name, password )
+
+ smtp_server.sendmail( self.mail, [ self.mail ],
+ 'Subject: %s\nTo: %s\n\n%s' % ( subject, self.mail, msg ) )
+
#~ Dowloading source, from SVN...
def svn_checkout( self ):
@@ -384,7 +622,7 @@
self.svn_command( 'update' )
def svn_command( self, command ):
- svn_anonymous_command_line = 'svn %(command)s'
+ svn_anonymous_command_line = 'svn --non-interactive %(command)s'
svn_command_line = 'svn --non-interactive --username=%(user)s %(command)s'
if not hasattr(self,'user') or self.user is None or self.user == 'anonymous':
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