int main() { #if XAPI_STACKTRACE xapi_errtab_register(perrtab_TEST); #endif xapi exit = foo(); assert_exit(TEST_ERROR_ONE, exit); succeed; }
int main() { #if XAPI_STACKTRACE xapi_errtab_register(perrtab_TEST); #endif // invoke the function, collect its exit status xapi exit = test_fatalize(); assert_exit(TEST_ERROR_ONE, exit); // victory succeed; }
int main() { #if XAPI_STACKTRACE xapi_errtab_register(perrtab_TEST); #endif xapi exit = test_basic(); assert_exit(TEST_ERROR_ONE, exit); exit = test_masking(); assert_exit(TEST_ERROR_TWO, exit); exit = test_substack_0_skip(); assert_exit(TEST_ERROR_ONE, exit); exit = test_substack_1_skip(); assert_exit(TEST_ERROR_ONE, exit); succeed; }
int main() { #if XAPI_STACKTRACE xapi_errtab_register(perrtab_TEST); #endif int x; for(x = 0; x < 3; x++) { // alpha calls beta, unwinds, and calls delta, which fails with NOFATAL xapi exit = alpha(); assert_exit(TEST_ERROR_TWO, exit); // dead area should have been skipped assertf(alpha_dead_count == 0 , "expected alpha-dead-count : 0, actual alpha-dead-count : %d" , alpha_dead_count ); } // victory succeed; }
int main(int argc, char** argv, char ** envp) { enter; xapi R = 0; char space[512]; char * fabw_path = 0; const command * cmd = 0; memblk * mb = 0; fab_client * client = 0; fab_request * request = 0; int fd = -1; size_t tracesz = 0; // libraries fatal(fab_load); fatal(logger_load); fatal(valyria_load); fatal(narrator_load); fatal(xlinux_load); xapi_errtab_register(perrtab_MAIN); // logging fatal(logging_setup); fatal(logger_arguments_setup, envp); fatal(logger_finalize); // modules fatal(params_setup); fatal(params_report); fatal(sigbank_setup, "fab"); // parse cmdline arguments fatal(args_parse, &cmd); fatal(args_report, cmd); // ensure fabd can write to my stdout/stderr fatal(xfchmod, 1, 0777); fatal(xfchmod, 2, 0777); #if DEVEL snprintf(space, sizeof(space), "%s/../fabw/fabw.devel", g_params.exedir); fabw_path = space; #endif fatal(fab_client_create, &client, ".", XQUOTE(FABIPCDIR), fabw_path); #if DEBUG || DEVEL logs(L_IPC, "started"); #endif #if 0 // possibly kill the existing fabd instance, if any if(changed credentials) fatal(client_terminate); #endif fatal(fab_client_prepare, client); fatal(fab_client_launchp, client); fatal(memblk_mk, &mb); fatal(args_collate, cmd, mb, &request); fatal(fab_client_make_request, client, mb, request); finally: #if DEBUG || DEVEL if(log_would(L_IPC)) { xapi_infos("name", "fab"); xapi_infof("pid", "%ld", (long)getpid()); if(client) xapi_infos("hash", fab_client_gethash(client)); } #endif if(XAPI_UNWINDING) { if(XAPI_ERRVAL == FAB_FABDEXIT || XAPI_ERRVAL == FAB_UNSUCCESS) { // on orderly shutdown fabd has already backtraced to our stdout } else { #if DEBUG || DEVEL || XAPI tracesz = xapi_trace_full(space, sizeof(space)); #else tracesz = xapi_trace_pithy(space, sizeof(space)); #endif xlogw(L_ERROR, L_RED, space, tracesz); } if(XAPI_ERRVAL == MAIN_BADARGS) { fatal(args_usage, cmd, 0, 0); } } // locals fatal(ixclose, &fd); fatal(fab_client_dispose, &client); memblk_free(mb); // module teardown sigbank_teardown(); params_teardown(); fatal(build_command_cleanup); // libraries fatal(fab_unload); fatal(logger_unload); fatal(valyria_unload); fatal(narrator_unload); fatal(xlinux_unload); conclude(&R); xapi_teardown(); return !!R; }