void testcase_failed(TestCaseState_t *tcs, char *frmt, ...) { InternalTestCaseState_t *itcs = (InternalTestCaseState_t *) tcs; char buf[10]; size_t bufsz = sizeof(buf); va_list va; va_start(va, frmt); #if HAVE_VSNPRINTF vsnprintf(itcs->comment_buf, COMMENT_BUF_SZ, frmt, va); #else vsprintf(itcs->comment_buf, frmt, va); #endif va_end(va); itcs->result = TESTCASE_FAILED; itcs->comment = itcs->comment_buf; if (erl_drv_getenv("ERL_ABORT_ON_FAILURE", buf, &bufsz) == 0 && strcmp("true", buf) == 0) { fprintf(stderr, "Testcase \"%s\" failed: %s\n", itcs->visible.testcase_name, itcs->comment); abort(); } longjmp(itcs->done_jmp_buf, 1); }
static int innostore_drv_init() { char log_filename[_POSIX_PATH_MAX]; size_t log_filename_size = sizeof(log_filename); ErlDrvSysInfo sys_info; G_ENGINE_STATE_LOCK = erl_drv_mutex_create("innostore_state_lock"); G_LOGGER_LOCK = erl_drv_mutex_create("innostore_logger_lock"); // Check if this is beam.smp - cannot run under beam // due to restrictions with driver_send_term driver_system_info(&sys_info, sizeof(sys_info)); if (sys_info.smp_support == 0) { log("Innostore only supports the SMP runtime, add -smp enable"); return -1; } // Initialize Inno's memory subsystem if (ib_init() != DB_SUCCESS) { return -1; } // Set up the logger if (erl_drv_getenv("INNOSTORE_LOG", log_filename, &log_filename_size) == 0) { set_log_file(log_filename); } else { set_log_file(NULL); } return 0; }