int main(int argc, char **argv) { int i, retval; if (argc < 2) { /* Run all tests */ for (i = 0; i < num_all_tests; ++i) { printf("Running test #%d %s...\n", i, all_tests[i]); fflush(stdout); fflush(stderr); retval = call_test(all_tests[i]); fflush(stdout); fflush(stderr); } } else { /* Run one test */ printf("Running test %s...\n", argv[1]); fflush(stdout); fflush(stderr); retval = call_test(argv[1]); fflush(stdout); fflush(stderr); } if (retval) printf("FAIL\n"); else printf("OK\n"); fflush(stdout); fflush(stderr); return (retval ? 1 : 0); }
int main(int argc, char **argv) { int i, retval; if (argc < 2) { /* Run all tests */ for (i = 0; i < num_all_tests; ++i) { printf("Running test #%d %s...\n", i, all_tests[i]); retval = call_test(all_tests[i]); if (retval) { printf("FAIL\n"); return 1; } } } else { /* Run one test */ printf("Running test %s...\n", argv[1]); retval = call_test(argv[1]); if (retval) { printf("FAIL\n"); return 1; } } printf("OK\n"); return 0; }
void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* reporter, GrContextFactory* factory) { #if SK_SUPPORT_GPU // Iterate over context types, except use "native" instead of explicitly trying OpenGL and // OpenGL ES. Do not use GLES on desktop, since tests do not account for not fixing // http://skbug.com/2809 GrContextFactory::GLContextType contextTypes[] = { GrContextFactory::kNative_GLContextType, #if SK_ANGLE #ifdef SK_BUILD_FOR_WIN GrContextFactory::kANGLE_GLContextType, #endif GrContextFactory::kANGLE_GL_GLContextType, #endif #if SK_COMMAND_BUFFER GrContextFactory::kCommandBuffer_GLContextType, #endif #if SK_MESA GrContextFactory::kMESA_GLContextType, #endif GrContextFactory::kNull_GLContextType, GrContextFactory::kDebug_GLContextType, }; static_assert(SK_ARRAY_COUNT(contextTypes) == GrContextFactory::kGLContextTypeCnt - 2, "Skipping unexpected GLContextType for GPU tests"); for (auto& contextType : contextTypes) { int contextSelector = kNone_GPUTestContexts; if (GrContextFactory::IsRenderingGLContext(contextType)) { contextSelector |= kAllRendering_GPUTestContexts; } else if (contextType == GrContextFactory::kNative_GLContextType) { contextSelector |= kNative_GPUTestContexts; } else if (contextType == GrContextFactory::kNull_GLContextType) { contextSelector |= kNull_GPUTestContexts; } else if (contextType == GrContextFactory::kDebug_GLContextType) { contextSelector |= kDebug_GPUTestContexts; } if ((testContexts & contextSelector) == 0) { continue; } GrContextFactory::ContextInfo context = factory->getContextInfo(contextType); if (context.fGrContext) { call_test(test, reporter, context); } context = factory->getContextInfo(contextType, GrContextFactory::kEnableNVPR_GLContextOptions); if (context.fGrContext) { call_test(test, reporter, context); } } #endif }
/** * * @brief Perform all selected benchmarks * see config.h to select or to unselect * * @return N/A */ void BenchTask(void) { int autorun = 0, continuously = 0; init_output(&continuously, &autorun); bench_test_init(); PRINT_STRING(newline, output_file); do { PRINT_STRING(dashline, output_file); PRINT_STRING("| S I M P L E S E R V I C E " "M E A S U R E M E N T S | nsec |\n", output_file); PRINT_STRING(dashline, output_file); task_start(RECVTASK); call_test(); queue_test(); sema_test(); mutex_test(); memorymap_test(); mempool_test(); event_test(); mailbox_test(); pipe_test(); PRINT_STRING("| END OF TESTS " " |\n", output_file); PRINT_STRING(dashline, output_file); PRINT_STRING("PROJECT EXECUTION SUCCESSFUL\n",output_file); } while (continuously && !kbhit()); WAIT_FOR_USER(); if (autorun) { task_sleep(SECONDS(2)); } output_close(); }
/* Executes the SQL CREATE queries, opens the sqlite * database connection and calls swill or pico_ql_test * depending on the compile flag TEST. */ int register_table(int argc, int view_index, const char **q, const char **sqlite_names, int port_number) { /* This definition implicitly constraints a table name * to 140 characters. It should be more than enough. */ char sqlite_query[200]; int re, i=0; sqlite3 *db; /* Virtual table schema will be in-memory and will not persist. Views can be included in the DSL */ re = sqlite3_open(":memory:", &db); if (re) { printf("can't open database\n"); sqlite3_close(db); return re; } #ifdef PICO_QL_DEBUG for (i = 0; i < argc; i++) { printf("\nquery to be executed: %s.\n", q[i]); } #endif sqlite3_module *mod; mod = (sqlite3_module *)sqlite3_malloc(sizeof(sqlite3_module)); fill_module(mod); int output = sqlite3_create_module(db, "PicoQL", mod, NULL); if (output == 1) printf("Error while registering module\n"); #ifdef PICO_QL_DEBUG else if (output == 0) printf("Module registered successfully\n"); #endif // sqlite3_create_function() calls for (i = 0; i < argc; i++) { char sqlite_type[10]; if (i < view_index) strcpy(sqlite_type, "table"); else strcpy(sqlite_type, "view"); sprintf(sqlite_query, "SELECT * FROM sqlite_master WHERE type='%s' AND name='%s';", sqlite_type, sqlite_names[i]); if (prep_exec(NULL, db, (const char *)sqlite_query, NULL) != SQLITE_ROW) { re = prep_exec(NULL, db, (const char *)q[i], NULL); #ifdef PICO_QL_DEBUG printf("Query %s returned %i\n", q[i], re); #endif if (re != 101) { printf("Extended error code: %i.\n", sqlite3_extended_errcode(db)); printf("Extended error message:\n%s.\n", sqlite3_errmsg(db)); return re; } } } start_serving(); #ifndef PICO_QL_TEST printf("Please visit http://localhost:%i to be served\n", port_number); call_swill(db, port_number); #else re = call_test(db); #endif sqlite3_free(mod); return re; }