ARB
|
#include "UnitTester.hxx"
#include <cstdarg>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cerrno>
#include <climits>
#include <sys/time.h>
#include <sys/stat.h>
#include <arb_simple_assert.h>
#include <arb_backtrace.h>
#include <arb_pathlen.h>
#include <arb_sleep.h>
#include <test_unit.h>
#include <ut_valgrinded.h>
#include <valgrind.h>
#include <SuppressOutput.h>
#include <SigHandler.h>
#include <setjmp.h>
#include <unistd.h>
#include <string>
#include <signal.h>
#include <mod_rlimit.h>
#include "../SOURCE_TOOLS/arb_main.h"
Go to the source code of this file.
Classes | |
struct | Globals |
class | Flag |
class | SimpleTester |
Macros | |
#define | ut_assert(cond) arb_assert(cond) |
#define | TRACE_PREFIX "UnitTester: " |
#define | SECOND 1000000 |
Enumerations | |
enum | TrapCode { TRAP_UNEXPECTED = 668, TRAP_SEGV, TRAP_INT, TRAP_TERM } |
Functions | |
__ATTR__FORMAT (1) static void trace(const char *format | |
fflush (stdout) | |
fflush (stderr) | |
fputs (TRACE_PREFIX, stderr) | |
va_start (parg, format) | |
vfprintf (stderr, format, parg) | |
va_end (parg) | |
fputc ('\n', stderr) | |
static __ATTR__NORETURN void | UNITTEST_sigsegv_handler (int sig) |
static void | terminate_called () |
static UnitTestResult | execute_guarded_ClientCode (UnitTest_function fun, long *duration_usec) |
bool | kill_verbose (pid_t pid, int sig, const char *signame) |
Flag | getLocalFlag (const char *flagname) |
static bool | flag_callback (arb_test::FlagAction action, const char *name) |
bool | been_inside_environment () |
bool | did_valgrinded_syscall () |
void | reset_test_local_flags () |
void | sleepms (long ms) |
UnitTestResult | execute_guarded (UnitTest_function fun, long *duration_usec, long max_allowed_duration_ms, bool detect_environment_calls) |
const char * | as_text (size_t z) |
const char * | as_text (double d) |
void | appendValue (string &report, const char *tag, const char *value) |
void | appendValue (string &report, const char *tag, size_t value) |
void | appendValue (string &report, const char *tag, double value) |
static const char * | generateReport (const char *libname, size_t tests, size_t skipped, size_t passed, double duration_ms, size_t warnings) |
Variables | |
static Globals | GLOBAL |
static const char * | readable_result [] |
static jmp_buf | UNITTEST_return_after_segv |
static bool | terminate_was_called = false |
static char | text_buffer [100] |
const size_t | Mb = 1024*1024 |
const size_t | Gb = 1024*Mb |
#define ut_assert | ( | cond | ) | arb_assert(cond) |
Definition at line 44 of file UnitTester.cxx.
Referenced by execute_guarded_ClientCode(), Flag::lower(), UnitTest_simple::print_error(), and Flag::raise().
#define TRACE_PREFIX "UnitTester: " |
Definition at line 106 of file UnitTester.cxx.
#define SECOND 1000000 |
Definition at line 216 of file UnitTester.cxx.
Referenced by execute_guarded_ClientCode().
enum TrapCode |
Enumerator | |
---|---|
TRAP_UNEXPECTED | |
TRAP_SEGV | |
TRAP_INT | |
TRAP_TERM |
Definition at line 157 of file UnitTester.cxx.
__ATTR__FORMAT | ( | 1 | ) | const |
fflush | ( | stdout | ) |
Referenced by aisc_server_errorf(), ARB_main(), aw_initstatus(), aw_message_and_dump_stderr(), aw_message_timer_listen_event(), aw_question(), aw_status_kill(), aw_status_timer_event(), aw_status_timer_listen_event(), aw_status_wait_for_open(), BasicStatus::close(), decide_passes_to_use(), BackTraceInfo::dump(), dumpError(), ED4_timer(), ED4_trigger_instant_refresh(), execute_guarded(), execute_guarded_ClientCode(), fflush_all(), GB_print_error(), GBK_system(), GBK_terminate(), kill_verbose(), Interpreter::launch(), Flag::lower(), main(), open_aisc_server(), output::point(), PS_Candidate::print(), GBL_IMPL::print_trace(), PS_Candidate::printProbes(), PS_descend(), PS_detect_weak_differences(), PS_detect_weak_differences_stepdown(), PS_find_probe_for_sets(), PS_find_probes(), PS_get_next_candidates(), PS_get_next_candidates_descend(), PS_print_map_ranges(), PS_print_set_ranges(), PS_print_time_diff(), Flag::raise(), ED4_manager::refresh_flag_ok(), server_shutdown(), BasicStatus::set_gauge(), show_message(), throwParseError(), and to_arberr().
fflush | ( | stderr | ) |
fputs | ( | TRACE_PREFIX | , |
stderr | |||
) |
Referenced by aed_start_naligning(), aisc_add_destroy_callback(), aisc_server_errorf(), alloc_failure_panic(), ARB_main(), arb_socket_write(), ARB_textfiles_have_difflines(), ask_for_conversion_params(), ScrollSynchronizer::auto_update(), AW_add_inotification(), BackTraceInfo::BackTraceInfo(), NamedCommand::check_result(), XML_Text::close(), XML_Comment::close(), ED4_remap::compile(), AP_tree::compute_tree(), LineReader::copyTo(), AW_root::define_remote_command(), die(), PART::distanceTo(), BackTraceInfo::dump(), PT_statistic::dump(), ModRLimit::dump_error(), dump_token_recursive(), dumpError(), emit(), enter_stage_1_build_tree(), error_with_usage(), errorf(), execute_guarded_ClientCode(), export_nds_cb(), export_species_using_form(), export_structure_to_file(), export_tree_label(), export_tree_node_print(), LineQueue::flush(), flush_taxonomy_if_new_group_cb(), GB_internal_error(), gb_parse_ascii_rek(), gb_write_bin(), gbcms_talking_obsolete(), GBK_terminate(), GBK_test_address(), group_awar_changed_cb(), ins_ntree(), insert_ntree(), InsertDatainGDE(), Interpreter::launch(), LOG_STATUS(), main(), merge_startup_abort_cb(), NTREE_move_tree_info(), perform_query_cb(), InputFileError::print(), arb_test::print(), DiffLines::print_from(), arb_test::print_hex(), arb_test::print_pair(), arb_test::StaticCode::print_readable_string(), GBL_IMPL::print_trace(), Package::print_xsubs(), PT_dump_POS_TREE(), PT_start_design(), rebuild_rule_from_awars_cb(), run_command(), FileContent::save(), StorableSelectionList::save(), AWT_configuration::Save(), DI_MATRIX::save(), save_messagebox_content_to(), FieldTransfer::RuleSet::saveTo(), ED4_window::scrollbars_and_scrolledRect_inSync(), selectedSpeciesChanged_cb(), server_main_loop(), BasicStatus::set_gauge(), show_command_line_usage(), CLI::show_help(), show_help(), show_usage(), splitRNS(), SPOOLER::spool(), start_pt_server(), timed_inotifications_check_cb(), TREE_write_Newick(), UNITTEST_sigsegv_handler(), ScrollSynchronizer::update_explicit(), ScrollSynchronizer::update_implicit(), usage(), Usage(), warn_and_dump_counter_or_calling_progress(), AW_window::wm_activate(), FilteredExport::write_fasta(), SpecSetRegistry::write_node_information(), writeDefaultMaskfile(), and WriteNA_Flat().
va_start | ( | parg | , |
format | |||
) |
vfprintf | ( | stderr | , |
format | , | ||
parg | |||
) |
Referenced by aisc_server_errorf(), formatted(), FileWriter::outf(), and output::vput().
va_end | ( | parg | ) |
fputc | ( | '\n' | , |
stderr | |||
) |
Referenced by ARB_main(), ARB_textfiles_have_difflines(), aw_help_search(), NamedCommand::check_result(), XML_Comment::close(), LineReader::copyTo(), ModRLimit::dump_error(), dump_token_recursive(), dumpError(), enter_stage_1_build_tree(), export_nds_cb(), export_structure_to_file(), export_tree_label(), export_tree_node_print(), export_tree_rek(), formatted(), GBK_test_address(), group_awar_changed_cb(), LOG_STATUS(), main(), FileWriter::out(), perform_query_cb(), output::point(), PS_BitSet::print(), InputFileError::print(), ColumnStat::print(), PS_Node::print(), arb_test::print(), arb_test::print_hex_pair(), print_promotions(), print_tabs(), GBL_IMPL::print_trace(), PS_Node::printOnlyMe(), PTD_put_byte(), PTD_write_node_to_disk(), PTD_write_tip_to_disk(), runtests(), FileContent::save(), StorableSelectionList::save(), DI_MATRIX::save(), save_messagebox_content_to(), FieldTransfer::RuleSet::saveTo(), BasicStatus::set_gauge(), splitRNS(), to_indent(), TREE_export_tree(), TREE_write_Newick(), Usage(), warn_and_dump_counter_or_calling_progress(), write_aisc(), FilteredExport::write_fasta(), SpecSetRegistry::write_node_information(), and writeSeq().
|
static |
Definition at line 164 of file UnitTester.cxx.
References demangle_backtrace(), BackTraceInfo::dump(), EXIT_FAILURE, fputs(), Globals::inside_test, NULp, terminate_was_called, TRAP_INT, TRAP_SEGV, TRAP_TERM, TRAP_UNEXPECTED, and UNITTEST_return_after_segv.
Referenced by execute_guarded_ClientCode().
|
static |
Definition at line 218 of file UnitTester.cxx.
References terminate_was_called.
Referenced by execute_guarded_ClientCode().
|
static |
Definition at line 225 of file UnitTester.cxx.
References fflush(), fputs(), Globals::inside_test, INSTALL_SIGHANDLER, NULp, result, SECOND, terminate_called(), TEST_INTERRUPTED, TEST_INVALID, TEST_OK, TEST_TRAPPED, TRAP_INT, TRAP_SEGV, TRAP_TERM, TRAP_UNEXPECTED, UNINSTALL_SIGHANDLER, UNITTEST_return_after_segv, UNITTEST_sigsegv_handler(), and ut_assert.
Referenced by execute_guarded().
Definition at line 290 of file UnitTester.cxx.
Definition at line 321 of file UnitTester.cxx.
References Globals::libname, Globals::runDir, and string().
Referenced by been_inside_environment(), flag_callback(), and reset_test_local_flags().
|
static |
Definition at line 326 of file UnitTester.cxx.
References getLocalFlag(), Flag::is_up(), Flag::raise(), and result.
Referenced by UnitTester::UnitTester().
|
inline |
Definition at line 344 of file UnitTester.cxx.
References ANY_SETUP, getLocalFlag(), and Flag::is_up().
|
inline |
Definition at line 347 of file UnitTester.cxx.
References seen_valgrinded_call().
|
inline |
Definition at line 350 of file UnitTester.cxx.
References ANY_SETUP, getLocalFlag(), and Flag::lower_if_up().
void sleepms | ( | long | ms | ) |
Definition at line 354 of file UnitTester.cxx.
References ARB_sleep(), MS, and SEC.
Referenced by Mutex::Mutex(), and FunInfo::switch_to().
UnitTestResult execute_guarded | ( | UnitTest_function | fun, |
long * | duration_usec, | ||
long | max_allowed_duration_ms, | ||
bool | detect_environment_calls | ||
) |
Definition at line 403 of file UnitTester.cxx.
References execute_guarded_ClientCode(), EXIT_FAILURE, fflush(), result, Globals::running_on_valgrind, and TEST_THREW.
|
inline |
Definition at line 599 of file UnitTester.cxx.
References text_buffer.
Definition at line 601 of file UnitTester.cxx.
Referenced by appendValue(), and generateReport().
Definition at line 603 of file UnitTester.cxx.
References appendValue(), and as_text().
Definition at line 604 of file UnitTester.cxx.
References appendValue(), and as_text().
|
static |
Definition at line 606 of file UnitTester.cxx.
References appendValue().
Referenced by UnitTester::UnitTester().
|
static |
Definition at line 102 of file UnitTester.cxx.
|
static |
Definition at line 141 of file UnitTester.cxx.
|
static |
Definition at line 154 of file UnitTester.cxx.
Referenced by execute_guarded_ClientCode(), and UNITTEST_sigsegv_handler().
|
static |
Definition at line 155 of file UnitTester.cxx.
Referenced by terminate_called(), and UNITTEST_sigsegv_handler().
|
static |
Definition at line 596 of file UnitTester.cxx.
Referenced by as_text().
const size_t Mb = 1024*1024 |
Definition at line 629 of file UnitTester.cxx.
Definition at line 630 of file UnitTester.cxx.