void XmlOutput::generate(ostream& os, bool incl_ok_tests, const string& name) { ostringstream ss; header(os); table_header(os, "FailedTests"); for_each(_suites.begin(), _suites.end(), TestSuiteRowFalse(os)); table_footer(os, "FailedTests"); table_header(os, "SuccessfulTests"); for_each(_suites.begin(), _suites.end(), TestSuiteRowTrue(os)); table_footer(os, "SuccessfulTests"); ///> Summary table_header(os, "Statistics"); ss.str(""), ss << _total_tests; table_entry(os, ss.str(), "Tests"); ss.str(""), ss << _total_errors; table_entry(os, ss.str(), "FailuresTotal"); table_entry(os, "0", "Errors"); table_entry(os, ss.str(), "Failures"); table_footer(os, "Statistics"); footer(os); }
static void update_screen_live_counters(struct cstat *client, int *x, int col) { char msg[128]=""; struct cntr_ent *e; struct cntr *cntr=client->cntr; time_t start=(time_t)cntr->ent[(uint8_t)CMD_TIMESTAMP]->count; time_t end=(time_t)cntr->ent[(uint8_t)CMD_TIMESTAMP_END]->count; struct cntr_ent *gtotal=cntr->ent[(uint8_t)CMD_GRAND_TOTAL]; print_line("", (*x)++, col); snprintf(msg, sizeof(msg), "Start time: %s", getdatestr(start)); print_line(msg, (*x)++, col); snprintf(msg, sizeof(msg), " End time: %s", getdatestr(end)); print_line(msg, (*x)++, col); snprintf(msg, sizeof(msg), "Time taken: %s", time_taken(end-start)); print_line(msg, (*x)++, col); table_header(x, col); for(e=client->cntr->list; e; e=e->next) update_screen_live_counter_table(e, x, col); print_line("", (*x)++, col); snprintf(msg, sizeof(msg), "%19s: %"PRIu64"%%", "Percentage complete", ((gtotal->count+gtotal->same+gtotal->changed)*100)/gtotal->phase1); print_line(msg, (*x)++, col); print_line("", (*x)++, col); for(e=client->cntr->list; e; e=e->next) update_screen_live_counter_single(e, x, col); }
void operator()(const SuiteInfo& si) { std::ostringstream ss; sub_title(_os, "Suite: " + si._name, 3, si._name); table_header(_os, TableClass_Suite, "Details for suite " + si._name); table_tr_header(_os); table_entry(_os, Title, "Name"); table_entry(_os, Title, "Errors", 10); table_entry(_os, Title, "Success", 10); table_entry(_os, Title, "Time (s)", 10); table_tr_footer(_os); std::for_each(si._tests.begin(), si._tests.end(), TestRow(_os, _incl_ok_tests)); table_footer(_os); back_ref(_os, "top"); }
void operator()(const Source& s) { const int TitleSize = 15; std::ostringstream ss; table_header(_os, TableClass_Result, "Test Failure"); table_tr_header(_os); table_entry(_os, Title, "Test", TitleSize); table_entry(_os, Success, s.suite() + "::" + s.test()); table_tr_footer(_os); table_tr_header(_os); table_entry(_os, Title, "File", TitleSize); ss << s.file() << ":" << s.line(); table_entry(_os, Success, ss.str()); table_tr_footer(_os); table_tr_header(_os); table_entry(_os, Title, "Message", TitleSize); table_entry(_os, Success, s.message()); table_tr_footer(_os); table_footer(_os); }
/// Generates the HTML table. This function should only be called after /// run(), when all tests have been executed. /// /// \param os Output stream. /// \param incl_ok_tests Set if successful tests should be shown; /// false otherwise. /// \param name Name of generated report. /// void HtmlOutput::generate(std::ostream& os, bool incl_ok_tests, const std::string& name) { ClassType type(_total_errors > 0 ? Error : Success); std::ostringstream ss; header(os, name); // Table: Summary // sub_title(os, "Summary", 2); table_header(os, TableClass_Summary, "Summary of test results"); table_tr_header(os); table_entry(os, Title, "Tests", 30); table_entry(os, Title, "Errors", 30); table_entry(os, Title, "Success", 30); table_entry(os, Title, "Time (s)", 10); table_tr_footer(os); table_tr_header(os); ss.str(""), ss << _total_tests; table_entry(os, type, ss.str(), 30); ss.str(""), ss << _total_errors; table_entry(os, type, ss.str(), 30); ss.str(""), ss << correct(_total_tests, _total_errors) << "%"; table_entry(os, type, ss.str(), 30); ss.str(""), ss << _total_time; table_entry(os, type, ss.str(), 10); table_tr_footer(os); table_footer(os); os << "<hr />\n\n"; // Table: Test suites // sub_title(os, "Test suites", 2); table_header(os, TableClass_Suites, "Test Suites"); table_tr_header(os); table_entry(os, Title, "Name"); table_entry(os, Title, "Tests", 10); table_entry(os, Title, "Errors", 10); table_entry(os, Title, "Success", 10); table_entry(os, Title, "Time (s)", 10); table_tr_footer(os); std::for_each(_suites.begin(), _suites.end(), SuiteRow(os)); table_footer(os); os << "<hr />\n\n"; // Individual tests tables // std::for_each(_suites.begin(), _suites.end(), TestSuiteRow(os, incl_ok_tests)); os << "<hr />\n\n"; // Individual tests result tables // if(_total_errors != 0) { sub_title(os, "Test results", 2); std::for_each(_suites.begin(), _suites.end(), SuiteTestResult(os)); os << "<hr />\n\n"; } // EOF // footer(os); }
static void detail(char *toks[], int t, struct config *conf, int row, int col) { int x=0; char msg[1024]=""; const char *tmp=NULL; if(toks[0]) { snprintf(msg, sizeof(msg), "Client: %s", toks[0]); print_line(msg, x++, col); } if(toks[1]) { switch(*(toks[1])) { case STATUS_IDLE: { print_line("Status: idle", x++, col); show_all_backups(toks, t, &x, col); return; } case STATUS_SERVER_CRASHED: { print_line("Status: server crashed", x++, col); show_all_backups(toks, t, &x, col); return; } case STATUS_CLIENT_CRASHED: { print_line("Status: client crashed", x++, col); show_all_backups(toks, t, &x, col); return; } case STATUS_RUNNING: { if(toks[2]) { char msg[64]=""; if(t<3) return; snprintf(msg, sizeof(msg), "Status: running (%s)", running_status_to_text( *(toks[2]))); print_line(msg, x++, col); } break; } } } print_line("", x++, col); table_header(&x, col); if(t>4) print_detail("Files", toks[4], &x, col, 0); if(t>5) print_detail("Encrypted files", toks[5], &x, col, 0); if(t>6) print_detail("Meta data", toks[6], &x, col, 0); if(t>7) print_detail("Encrypted meta data", toks[7], &x, col, 0); if(t>8) print_detail("Directories", toks[8], &x, col, 0); if(t>9) print_detail("Soft links", toks[9], &x, col, 0); if(t>10) print_detail("Hard links", toks[10], &x, col, 0); if(t>11) print_detail("Special files", toks[11], &x, col, 0); if(t>12) { print_detail("Total", toks[12], &x, col, 1); } print_line("", x++, col); if(t>14) print_detail2("Warnings", toks[14], "", &x, col); if(t>15) { tmp=bytes_to_human_str(toks[15]); print_detail2("Bytes expected", toks[15], tmp, &x, col); } if(t>16) { tmp=bytes_to_human_str(toks[16]); print_detail2("Bytes in backup", toks[16], tmp, &x, col); } if(t>17) { tmp=bytes_to_human_str(toks[17]); print_detail2("Bytes received", toks[17], tmp, &x, col); } if(t>18) { tmp=bytes_to_human_str(toks[18]); print_detail2("Bytes sent", toks[18], tmp, &x, col); } if(t>19) { long start=0; time_t now=0; time_t diff=0; now=time(NULL); start=atol(toks[19]); diff=now-start; print_detail2("Start time", getdatestr(start), " ", &x, col); print_detail2("Time taken", time_taken(diff), " ", &x, col); if(diff>0) { unsigned long long bytesleft=0; unsigned long long byteswant=0; unsigned long long bytesgot=0; float bytespersec=0; byteswant=strtoull(toks[15], NULL, 10); bytesgot=strtoull(toks[16], NULL, 10); bytespersec=(float)(bytesgot/diff); bytesleft=byteswant-bytesgot; if(bytespersec>0) { time_t timeleft=0; timeleft=(time_t)(bytesleft/bytespersec); print_detail2("Time left", time_taken(timeleft), " ", &x, col); } } } if(t>20 && toks[20]) { #ifdef HAVE_NCURSES_H if(actg==ACTION_STATUS) { printw("\n%s\n", toks[20]); return; } #else printf("\n%s\n", toks[20]); #endif } }