HRESULT ExecuteTestWithMemoryCheck(BSTR fileName) { HRESULT hr = E_FAIL; #ifdef CHECK_MEMORY_LEAK // Always check memory leak, unless user specified the flag already if (!ChakraRTInterface::IsEnabledCheckMemoryFlag()) { ChakraRTInterface::SetCheckMemoryLeakFlag(true); } // Disable the output in case an unhandled exception happens // We will re-enable it if there is no unhandled exceptions ChakraRTInterface::SetEnableCheckMemoryLeakOutput(false); #endif __try { hr = ExecuteTest(fileName); } __except (HostExceptionFilter(GetExceptionCode(), GetExceptionInformation())) { _flushall(); // Exception happened, so we probably didn't clean up properly, // Don't exit normally, just terminate TerminateProcess(::GetCurrentProcess(), GetExceptionCode()); } _flushall(); #ifdef CHECK_MEMORY_LEAK ChakraRTInterface::SetEnableCheckMemoryLeakOutput(true); #endif return hr; }
void LaunchSeqScan(std::unique_ptr<storage::DataTable> &hyadapt_table) { auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance(); auto txn = txn_manager.BeginTransaction(); std::unique_ptr<executor::ExecutorContext> context( new executor::ExecutorContext(txn)); // Column ids to be added to logical tile after scan. std::vector<oid_t> column_ids; std::vector<oid_t> hyadapt_column_ids; oid_t query_column_count = projectivity * column_count; GenerateSequence(hyadapt_column_ids, query_column_count); for (oid_t col_itr = 0; col_itr < query_column_count; col_itr++) { column_ids.push_back(hyadapt_column_ids[col_itr]); } // Create and set up seq scan executor auto predicate = GetPredicate(); planner::IndexScanPlan::IndexScanDesc dummy_index_scan_desc; planner::HybridScanPlan hybrid_scan_node(hyadapt_table.get(), predicate, column_ids, dummy_index_scan_desc, HybridScanType::SEQUENTIAL); executor::HybridScanExecutor hybrid_scan_executor(&hybrid_scan_node, context.get()); ExecuteTest(&hybrid_scan_executor); txn_manager.CommitTransaction(txn); }
int main(int argc, char* argv[]) { //------------------------------------ ENGINE_HANDLE Engine; //------------------------------------ if (argc > 1){ if ((strcasecmp(argv[1], "--help") == 0) || (strcasecmp(argv[1], "-h") == 0) || (strcasecmp(argv[1], "/help") == 0) || (strcasecmp(argv[1], "/?") == 0) || (strcasecmp(argv[1], "/h") == 0)){ PrintAllTests(); return 0; } } printf("\n==================================================\n"); printf(" Automated Unit Test of SegmentExecutionEngine\n"); printf("==================================================\n\n"); InitLog(); Engine = SeCreateSegmentEngine(55); // // The constructor registers the command. // TestSegmentIsoClass Iso2Command(Engine); Iso2Command.SetIsoVerbose(true); // // Personalize it // RegisterStaticCommands(Engine); RegisterIsoSegment(Engine); RegisterRampSegment(Engine); RegisterRepeatUntilSegment(Engine); RegisterAbortSegment(Engine); RegisterAbort2Segment(Engine); // // Run the tests. // if (argc > 1) { ExecuteTest(argv[1], Engine); } else { ExecuteAllTests(Engine); } return 0; }
HRESULT ExecuteTestWithMemoryCheck(char* fileName) { HRESULT hr = E_FAIL; #ifdef CHECK_MEMORY_LEAK // Always check memory leak, unless user specified the flag already if (!ChakraRTInterface::IsEnabledCheckMemoryFlag()) { ChakraRTInterface::SetCheckMemoryLeakFlag(true); } // Disable the output in case an unhandled exception happens // We will re-enable it if there is no unhandled exceptions ChakraRTInterface::SetEnableCheckMemoryLeakOutput(false); #endif #ifdef _WIN32 __try { hr = ExecuteTest(fileName); } __except (HostExceptionFilter(GetExceptionCode(), GetExceptionInformation())) { Assert(false); } #else // REVIEW: Do we need a SEH handler here? hr = ExecuteTest(fileName); if (FAILED(hr)) exit(0); #endif // _WIN32 _flushall(); #ifdef CHECK_MEMORY_LEAK ChakraRTInterface::SetEnableCheckMemoryLeakOutput(true); #endif return hr; }
void LaunchHybridScan(std::unique_ptr<storage::DataTable> &hyadapt_table) { std::vector<oid_t> column_ids; std::vector<oid_t> column_ids_second; oid_t query_column_count = projectivity * column_count; std::vector<oid_t> hyadapt_column_ids; GenerateSequence(hyadapt_column_ids, query_column_count); for (oid_t col_itr = 0; col_itr < query_column_count; col_itr++) { column_ids.push_back(hyadapt_column_ids[col_itr]); column_ids_second.push_back(hyadapt_column_ids[col_itr]); } auto index = hyadapt_table->GetIndex(0); std::vector<oid_t> key_column_ids; std::vector<ExpressionType> expr_types; std::vector<type::Value> values; std::vector<expression::AbstractExpression *> runtime_keys; CreateIndexScanPredicate(key_column_ids, expr_types, values); planner::IndexScanPlan::IndexScanDesc index_scan_desc( index, key_column_ids, expr_types, values, runtime_keys); auto predicate = GetPredicate(); planner::HybridScanPlan hybrid_scan_plan(hyadapt_table.get(), predicate, column_ids_second, index_scan_desc, HybridScanType::HYBRID); auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance(); auto txn = txn_manager.BeginTransaction(); std::unique_ptr<executor::ExecutorContext> context( new executor::ExecutorContext(txn)); executor::HybridScanExecutor hybrid_scan_executor(&hybrid_scan_plan, context.get()); ExecuteTest(&hybrid_scan_executor); txn_manager.CommitTransaction(txn); }
int main(int argc, const char** argv) { auto testsPath = boost::filesystem::path("./tests/"); boost::filesystem::directory_iterator endDirectoryIterator; for(boost::filesystem::directory_iterator directoryIterator(testsPath); directoryIterator != endDirectoryIterator; directoryIterator++) { auto testPath = directoryIterator->path(); auto stream = Framework::CreateInputStdStream(testPath.native()); CGameTestSheet testSheet(stream); for(const auto& test : testSheet.GetTests()) { auto environment = testSheet.GetEnvironment(test.environmentId); PrepareTestEnvironment(environment); ExecuteTest(test); } } return 0; }
static void do_test( void ) { int i = getRandom( 0, (int)( fcnt - 1 ) ); static int test_num = 0; char buffer[1024]; sprintf( buffer, "%s/test%d", results_dir, test_num++ ); if ( copyfont ( &fontlist[i], buffer ) ) { signal( SIGALRM, abort_test ); /* Anything that takes more than 20 seconds */ /* to parse and/or rasterize is an error. */ alarm( 20 ); if ( ( child_pid = fork() ) == 0 ) ExecuteTest( buffer ); else if ( child_pid != -1 ) { int status; waitpid( child_pid, &status, 0 ); alarm( 0 ); if ( WIFSIGNALED ( status ) ) printf( "Error found in file `%s'\n", buffer ); else unlink( buffer ); } else { fprintf( stderr, "Can't fork test case.\n" ); exit( 1 ); } alarm( 0 ); } }
//***************************************************************************** // //! \brief Test execution thread function. //! //! \param None //! //! \details Test execution thread function. //! //! \return The test result xtrue or xfalse. // //***************************************************************************** xtBoolean TestMain(void) { int i, j; TestIOInit(); PrintLine(""); PrintLine("*** CooCox CoIDE components test suites"); PrintLine("***"); #ifdef TEST_COMPONENTS_NAME Print("*** Components: "); PrintLine(TEST_COMPONENTS_NAME); #endif #ifdef TEST_COMPONENTS_VERSION Print("*** Version: "); PrintLine(TEST_COMPONENTS_VERSION); #endif #ifdef TEST_BOARD_NAME Print("*** Test Board: "); PrintLine(TEST_BOARD_NAME); #endif PrintLine(""); g_bGlobalFail = xfalse; i = 0; while (g_psPatterns[i]) { j = 0; while (g_psPatterns[i][j]) { PrintNewLine(); Print("--- Test Case "); PrintN(i + 1); Print("."); PrintN(j + 1); Print(" ("); Print((char *)g_psPatterns[i][j]->GetTest()); PrintLine(")"); ExecuteTest(g_psPatterns[i][j]); if (g_bLocalFail == xtrue) { Print("--- Result: FAILURE "); PrintLine(""); // //printf error information // Print(g_pcErrorInfoBuffer); PrintLine(""); if (g_pcTokensBuffer < g_pcTok) { Print(" The tokens in buffer is: "); PrintTokens(); PrintLine(""); } } else { PrintLine("--- Result: SUCCESS "); } j++; } i++; } PrintNewLine(); PrintLine(""); Print("Final result: "); if (g_bGlobalFail == xtrue) PrintLine("FAILURE"); else PrintLine("SUCCESS"); return g_bGlobalFail; }
void Test::Run() { ExecuteTest(*this, m_details, m_isMockTest); }
void Test::Run() { ExecuteTest(*this, m_details); }
void RunUpdate() { auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance(); auto txn = txn_manager.BeginTransaction(); ///////////////////////////////////////////////////////// // INDEX SCAN + PREDICATE ///////////////////////////////////////////////////////// std::unique_ptr<executor::ExecutorContext> context( new executor::ExecutorContext(txn)); // Column ids to be added to logical tile after scan. std::vector<oid_t> column_ids; oid_t column_count = state.column_count + 1; for (oid_t col_itr = 0; col_itr < column_count; col_itr++) { column_ids.push_back(col_itr); } // Create and set up index scan executor std::vector<oid_t> key_column_ids; std::vector<ExpressionType> expr_types; std::vector<Value> values; std::vector<expression::AbstractExpression *> runtime_keys; auto tuple_count = state.scale_factor * DEFAULT_TUPLES_PER_TILEGROUP; auto lookup_key = rand() % tuple_count; key_column_ids.push_back(0); expr_types.push_back( ExpressionType::EXPRESSION_TYPE_COMPARE_EQUAL); values.push_back(ValueFactory::GetIntegerValue(lookup_key)); auto ycsb_pkey_index = user_table->GetIndexWithOid(user_table_pkey_index_oid); planner::IndexScanPlan::IndexScanDesc index_scan_desc( ycsb_pkey_index, key_column_ids, expr_types, values, runtime_keys); // Create plan node. auto predicate = nullptr; planner::IndexScanPlan index_scan_node(user_table, predicate, column_ids, index_scan_desc); // Run the executor executor::IndexScanExecutor index_scan_executor(&index_scan_node, context.get()); ///////////////////////////////////////////////////////// // UPDATE ///////////////////////////////////////////////////////// planner::ProjectInfo::TargetList target_list; planner::ProjectInfo::DirectMapList direct_map_list; // Update the second attribute for (oid_t col_itr = 0; col_itr < column_count; col_itr++) { if(col_itr != 1) { direct_map_list.emplace_back(col_itr, std::pair<oid_t, oid_t>(0, col_itr)); } } Value update_val = ValueFactory::GetStringValue(std::string("updated")); target_list.emplace_back(1, expression::ExpressionUtil::ConstantValueFactory(update_val)); planner::UpdatePlan update_node( user_table, new planner::ProjectInfo(std::move(target_list), std::move(direct_map_list))); executor::UpdateExecutor update_executor(&update_node, context.get()); update_executor.AddChild(&index_scan_executor); ///////////////////////////////////////////////////////// // EXECUTE ///////////////////////////////////////////////////////// std::vector<executor::AbstractExecutor *> executors; executors.push_back(&update_executor); ExecuteTest(executors); txn_manager.CommitTransaction(); }
void RunRead() { auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance(); auto txn = txn_manager.BeginTransaction(); ///////////////////////////////////////////////////////// // INDEX SCAN + PREDICATE ///////////////////////////////////////////////////////// std::unique_ptr<executor::ExecutorContext> context( new executor::ExecutorContext(txn)); // Column ids to be added to logical tile after scan. std::vector<oid_t> column_ids; oid_t column_count = state.column_count + 1; for (oid_t col_itr = 0; col_itr < column_count; col_itr++) { column_ids.push_back(col_itr); } // Create and set up index scan executor std::vector<oid_t> key_column_ids; std::vector<ExpressionType> expr_types; std::vector<Value> values; std::vector<expression::AbstractExpression *> runtime_keys; auto tuple_count = state.scale_factor * DEFAULT_TUPLES_PER_TILEGROUP; auto lookup_key = rand() % tuple_count; key_column_ids.push_back(0); expr_types.push_back( ExpressionType::EXPRESSION_TYPE_COMPARE_EQUAL); values.push_back(ValueFactory::GetIntegerValue(lookup_key)); auto ycsb_pkey_index = user_table->GetIndexWithOid(user_table_pkey_index_oid); planner::IndexScanPlan::IndexScanDesc index_scan_desc( ycsb_pkey_index, key_column_ids, expr_types, values, runtime_keys); // Create plan node. auto predicate = nullptr; planner::IndexScanPlan index_scan_node(user_table, predicate, column_ids, index_scan_desc); // Run the executor executor::IndexScanExecutor index_scan_executor(&index_scan_node, context.get()); ///////////////////////////////////////////////////////// // MATERIALIZE ///////////////////////////////////////////////////////// // Create and set up materialization executor std::unordered_map<oid_t, oid_t> old_to_new_cols; for (oid_t col_itr = 0; col_itr < column_count; col_itr++) { old_to_new_cols[col_itr] = col_itr; } auto output_schema = catalog::Schema::CopySchema(user_table->GetSchema()); bool physify_flag = true; // is going to create a physical tile planner::MaterializationPlan mat_node(old_to_new_cols, output_schema, physify_flag); executor::MaterializationExecutor mat_executor(&mat_node, nullptr); mat_executor.AddChild(&index_scan_executor); ///////////////////////////////////////////////////////// // EXECUTE ///////////////////////////////////////////////////////// std::vector<executor::AbstractExecutor *> executors; executors.push_back(&mat_executor); ExecuteTest(executors); txn_manager.CommitTransaction(); }
void RunNewOrder(){ /* "NEW_ORDER": { "getWarehouseTaxRate": "SELECT W_TAX FROM WAREHOUSE WHERE W_ID = ?", # w_id "getDistrict": "SELECT D_TAX, D_NEXT_O_ID FROM DISTRICT WHERE D_ID = ? AND D_W_ID = ?", # d_id, w_id "getCustomer": "SELECT C_DISCOUNT, C_LAST, C_CREDIT FROM CUSTOMER WHERE C_W_ID = ? AND C_D_ID = ? AND C_ID = ?", # w_id, d_id, c_id "incrementNextOrderId": "UPDATE DISTRICT SET D_NEXT_O_ID = ? WHERE D_ID = ? AND D_W_ID = ?", # d_next_o_id, d_id, w_id "createOrder": "INSERT INTO ORDERS (O_ID, O_D_ID, O_W_ID, O_C_ID, O_ENTRY_D, O_CARRIER_ID, O_OL_CNT, O_ALL_LOCAL) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", # d_next_o_id, d_id, w_id, c_id, o_entry_d, o_carrier_id, o_ol_cnt, o_all_local "createNewOrder": "INSERT INTO NEW_ORDER (NO_O_ID, NO_D_ID, NO_W_ID) VALUES (?, ?, ?)", # o_id, d_id, w_id "getItemInfo": "SELECT I_PRICE, I_NAME, I_DATA FROM ITEM WHERE I_ID = ?", # ol_i_id "getStockInfo": "SELECT S_QUANTITY, S_DATA, S_YTD, S_ORDER_CNT, S_REMOTE_CNT, S_DIST_%02d FROM STOCK WHERE S_I_ID = ? AND S_W_ID = ?", # d_id, ol_i_id, ol_supply_w_id "updateStock": "UPDATE STOCK SET S_QUANTITY = ?, S_YTD = ?, S_ORDER_CNT = ?, S_REMOTE_CNT = ? WHERE S_I_ID = ? AND S_W_ID = ?", # s_quantity, s_order_cnt, s_remote_cnt, ol_i_id, ol_supply_w_id "createOrderLine": "INSERT INTO ORDER_LINE (OL_O_ID, OL_D_ID, OL_W_ID, OL_NUMBER, OL_I_ID, OL_SUPPLY_W_ID, OL_DELIVERY_D, OL_QUANTITY, OL_AMOUNT, OL_DIST_INFO) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", # o_id, d_id, w_id, ol_number, ol_i_id, ol_supply_w_id, ol_quantity, ol_amount, ol_dist_info } */ LOG_INFO("-------------------------------------"); int warehouse_id = GetRandomInteger(0, state.warehouse_count - 1); int district_id = GetRandomInteger(0, state.districts_per_warehouse - 1); //int customer_id = GetRandomInteger(0, state.customers_per_district); int o_ol_cnt = GetRandomInteger(orders_min_ol_cnt, orders_max_ol_cnt); //auto o_entry_ts = GetTimeStamp(); std::vector<int> i_ids, i_w_ids, i_qtys; //bool o_all_local = true; for (auto ol_itr = 0; ol_itr < o_ol_cnt; ol_itr++) { i_ids.push_back(GetRandomInteger(0, state.item_count)); bool remote = GetRandomBoolean(new_order_remote_txns); i_w_ids.push_back(warehouse_id); if(remote == true) { i_w_ids[ol_itr] = GetRandomIntegerExcluding(0, state.warehouse_count - 1, warehouse_id); //o_all_local = false; } i_qtys.push_back(GetRandomInteger(0, order_line_max_ol_quantity)); } auto &txn_manager = concurrency::TransactionManagerFactory::GetInstance(); auto txn = txn_manager.BeginTransaction(); std::unique_ptr<VarlenPool> pool(new VarlenPool(BACKEND_TYPE_MM)); std::unique_ptr<executor::ExecutorContext> context( new executor::ExecutorContext(txn)); // getWarehouseTaxRate std::vector<oid_t> warehouse_column_ids = {7}; // W_TAX // Create and set up index scan executor std::vector<oid_t> warehouse_key_column_ids = {0}; // W_ID std::vector<ExpressionType> warehouse_expr_types; std::vector<Value> warehouse_key_values; std::vector<expression::AbstractExpression *> runtime_keys; warehouse_expr_types.push_back( ExpressionType::EXPRESSION_TYPE_COMPARE_EQUAL); warehouse_key_values.push_back(ValueFactory::GetIntegerValue(warehouse_id)); auto warehouse_pkey_index = warehouse_table->GetIndexWithOid( warehouse_table_pkey_index_oid); planner::IndexScanPlan::IndexScanDesc warehouse_index_scan_desc( warehouse_pkey_index, warehouse_key_column_ids, warehouse_expr_types, warehouse_key_values, runtime_keys); // Create plan node. auto predicate = nullptr; planner::IndexScanPlan warehouse_index_scan_node(warehouse_table, predicate, warehouse_column_ids, warehouse_index_scan_desc); executor::IndexScanExecutor warehouse_index_scan_executor(&warehouse_index_scan_node, context.get()); auto gwtr_lists_values = ExecuteTest(&warehouse_index_scan_executor); if(gwtr_lists_values.empty() == true) { LOG_ERROR("getWarehouseTaxRate failed"); txn_manager.AbortTransaction(); return; } auto w_tax = gwtr_lists_values[0][0]; LOG_TRACE("W_TAX: %d", w_tax); // getDistrict std::vector<oid_t> district_column_ids = {8, 10}; // D_TAX, D_NEXT_O_ID // Create and set up index scan executor std::vector<oid_t> district_key_column_ids = {0, 1}; // D_ID, D_W_ID std::vector<ExpressionType> district_expr_types; std::vector<Value> district_key_values; district_expr_types.push_back( ExpressionType::EXPRESSION_TYPE_COMPARE_EQUAL); district_expr_types.push_back( ExpressionType::EXPRESSION_TYPE_COMPARE_EQUAL); district_key_values.push_back(ValueFactory::GetIntegerValue(district_id)); district_key_values.push_back(ValueFactory::GetIntegerValue(warehouse_id)); auto district_pkey_index = district_table->GetIndexWithOid( district_table_pkey_index_oid); planner::IndexScanPlan::IndexScanDesc district_index_scan_desc( district_pkey_index, district_key_column_ids, district_expr_types, district_key_values, runtime_keys); // Create plan node. planner::IndexScanPlan district_index_scan_node(district_table, predicate, district_column_ids, district_index_scan_desc); executor::IndexScanExecutor district_index_scan_executor(&district_index_scan_node, context.get()); auto gd_lists_values = ExecuteTest(&district_index_scan_executor); if(gd_lists_values.empty() == true) { LOG_ERROR("getDistrict failed"); txn_manager.AbortTransaction(); return; } auto d_tax = gd_lists_values[0][0]; LOG_TRACE("D_TAX: %d", d_tax); auto d_next_o_id = gd_lists_values[0][1]; LOG_TRACE("D_NEXT_O_ID: %d", d_next_o_id); // incrementNextOrderId txn_manager.CommitTransaction(); }
int main( int argc, char** argv ) { char **dirs, **exts; int dcnt = 0, ecnt = 0, rset = false, allexts = false; int i; time_t now; char* testfile = NULL; dirs = calloc( (size_t)( argc + 1 ), sizeof ( char ** ) ); exts = calloc( (size_t)( argc + 1 ), sizeof ( char ** ) ); for ( i = 1; i < argc; i++ ) { char* pt = argv[i]; char* end; if ( pt[0] == '-' && pt[1] == '-' ) pt++; if ( strcmp( pt, "-all" ) == 0 ) allexts = true; else if ( strcmp( pt, "-check-outlines" ) == 0 ) check_outlines = true; else if ( strcmp( pt, "-dir" ) == 0 ) dirs[dcnt++] = argv[++i]; else if ( strcmp( pt, "-error-count" ) == 0 ) { if ( !rset ) error_fraction = 0.0; rset = true; error_count = (unsigned int)strtoul( argv[++i], &end, 10 ); if ( *end != '\0' ) { fprintf( stderr, "Bad value for error-count: %s\n", argv[i] ); exit( 1 ); } } else if ( strcmp( pt, "-error-fraction" ) == 0 ) { if ( !rset ) error_count = 0; rset = true; error_fraction = strtod( argv[++i], &end ); if ( *end != '\0' ) { fprintf( stderr, "Bad value for error-fraction: %s\n", argv[i] ); exit( 1 ); } if ( error_fraction < 0.0 || error_fraction > 1.0 ) { fprintf( stderr, "error-fraction must be in the range [0;1]\n" ); exit( 1 ); } } else if ( strcmp( pt, "-ext" ) == 0 ) exts[ecnt++] = argv[++i]; else if ( strcmp( pt, "-help" ) == 0 ) { usage( stdout, argv[0] ); exit( 0 ); } else if ( strcmp( pt, "-nohints" ) == 0 ) nohints = true; else if ( strcmp( pt, "-rasterize" ) == 0 ) rasterize = true; else if ( strcmp( pt, "-results" ) == 0 ) results_dir = argv[++i]; else if ( strcmp( pt, "-size" ) == 0 ) { font_size = (FT_F26Dot6)( strtod( argv[++i], &end ) * 64 ); if ( *end != '\0' || font_size < 64 ) { fprintf( stderr, "Bad value for size: %s\n", argv[i] ); exit( 1 ); } } else if ( strcmp( pt, "-test" ) == 0 ) testfile = argv[++i]; else { usage( stderr, argv[0] ); exit( 1 ); } } if ( allexts ) { free( exts ); exts = NULL; } else if ( ecnt == 0 ) { free( exts ); exts = default_ext_list; } if ( dcnt == 0 ) { free( dirs ); dirs = default_dir_list; } if ( testfile ) ExecuteTest( testfile ); /* This should never return */ time( &now ); srandom( (unsigned int)now ); FindFonts( dirs, exts ); mkdir( results_dir, 0755 ); forever do_test(); return 0; }