⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 library_status.cpp

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 CPP
📖 第 1 页 / 共 3 页
字号:
        // 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";         }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -