void Runner::go() { m_ticker.stop(); m_page.setPreferredContentsSize(QSize(1024, 600)); addJHW(); loadSpec(); }
int main(void) { int number_failed; Suite * s; SRunner * sr; int memdebug = 0; int iswin = 0; int error = 0; #if defined(_WIN64) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN32__) iswin = 1; #endif memdebug = getenv("MEMDEBUG") ? atoi(getenv("MEMDEBUG")) : 0; if( memdebug ) { talloc_enable_leak_report_full(); } rootctx = talloc_new(NULL); // Load the spec spec_filename = getenv("handlebars_tokenizer_spec"); if( spec_filename == NULL ) { spec_filename = "./spec/handlebars/spec/tokenizer.json"; } error = loadSpec(spec_filename); if( error != 0 ) { goto error; } fprintf(stderr, "Loaded %lu test cases\n", tests_len); s = parser_suite(); sr = srunner_create(s); if( iswin || memdebug ) { srunner_set_fork_status(sr, CK_NOFORK); } srunner_run_all(sr, CK_ENV); number_failed = srunner_ntests_failed(sr); srunner_free(sr); error = (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; error: talloc_free(rootctx); if( memdebug ) { talloc_report_full(NULL, stderr); } return error; }
void Runner::timerEvent(QTimerEvent *event) { ++m_runs; if (event->timerId() != m_ticker.timerId()) return; if (hasErrors && m_runs > 2) QApplication::instance()->exit(1); if (isFinished) { int exitCode = 0; if (didFail || hasErrors) { exitCode = 1; } else { if (usedConsole) { exitCode = 2; } } bool runAgain = true; if (runnerFiles.count() == 0) { runAgain = false; } else { if (exitCode == 1) { runAgain = false; } } if (runAgain) { isFinished = false; loadSpec(); } else { QApplication::instance()->exit(exitCode); } } if (m_runs > 30) { std::cout << "WARNING: too many runs and the test is still not finished!" << std::endl; QApplication::instance()->exit(1); } }