static int run(void) { int i, ret = 0; ret = init_fabric(); if (ret) return ret; ret = init_av(); if (ret) goto out; if (!(opts.options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (test_size[i].option > opts.size_option) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } /* Finalize before closing ep */ ft_finalize(fi, ep, txcq, rxcq, remote_fi_addr); out: return ret; }
static int run(void) { int i, ret = 0; ret = ft_init_fabric(); if (ret) return ret; ret = ft_exchange_keys(&remote); if (ret) goto out; if (!(opts.options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (!ft_use_size(i, opts.sizes_enabled)) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } ft_sync(); ft_finalize(); out: return ret; }
static int run(void) { int i, ret = 0; ret = init_fabric(); if (ret) return ret; ret = ft_init_av(); if (ret) goto out; if (!(opts.options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (test_size[i].option > opts.size_option) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = pingpong(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = pingpong(); if (ret) goto out; } ft_finalize(); out: return ret; }
/***************************************************************************** * Test %lX format *****************************************************************************/ void UT_osprintf_lX(void) { char *test_fmt = "lx"; /* Test format character(s) */ int i; struct { char *test_num; /* Test identifier; sequential numbers */ unsigned long int test_val; /* Test value */ int max_len; /* Maximum output string length */ char *format; /* Format string */ char *expected; /* Expected result */ char *description; /* Test description */ } osp_tests[] = { {"01", 0x9a8b7c6d, 8, "%lX", "9A8B7C6D", "%lX"}, {"02", 0xdd46ee21, 8, "$$$%lX$$$", "$$$DD46EE21$$$", "%lX embedded"}, {"03", 0x9ccc8275, 7, "%3lX", "9CCC8275", "%lX with minimum field size < number of digits"}, {"04", 0xbee33225, 10, "%.10lX", "00BEE33225", "%lX with precision field size"}, {"05", 0x123fdb, 7, "%9.7lX", " 0123FDB", "%lX with minimum and precision field size"}, {"06", 0xabc6543f, 16, "%-.20lX", "000000000000ABC6543F", "%lX with left-justify"}, {"07", -9876543, 5, "%lX", "FF694BC1", "%lX, negative value"}, {"08", 0x12b45, 3, "%8lX", " 12B45", "%lX with minimum field size > number of digits"}, {"09", 0x12b45, 2, "%08lX", "00012B45", "%lX with minimum field size > number of digits and leading zeroes"}, {"", 0, 0, "", "", ""} /* End with a null format to terminate list */ }; for (i = 0; osp_tests[i].format[0] != '\0'; i++) { /* Perform sprintf test */ init_test(); SPRINTF(strg_buf, osp_tests[i].format, osp_tests[i].test_val); UT_Report(check_test(osp_tests[i].expected, strg_buf), "SPRINTF", osp_tests[i].description, test_fmt, osp_tests[i].test_num); /* Truncate expected string in preparation for snprintf test */ strcpy(trunc_buf, osp_tests[i].expected); if (strlen(trunc_buf) >= osp_tests[i].max_len) { trunc_buf[osp_tests[i].max_len - 1] = '\0'; } /* Perform snprintf test */ init_test(); SNPRINTF(strg_buf, osp_tests[i].max_len, osp_tests[i].format, osp_tests[i].test_val); UT_Report(check_test(trunc_buf, strg_buf), "SNPRINTF", osp_tests[i].description, test_fmt, osp_tests[i].test_num); } }
/***************************************************************************** * Test %p format *****************************************************************************/ void UT_osprintf_p(void) { char *test_fmt = "p"; /* Test format character(s) */ int i; struct { char *test_num; /* Test identifier; sequential numbers */ long int test_val; /* Test value */ int max_len; /* Maximum output string length */ char *format; /* Format string */ char *expected; /* Expected result */ char *description; /* Test description */ } osp_tests[] = { {"01", 98765, 5, "%p", "0x181cd", "%p"}, {"02", 46372, 10, "$$$%p$$$", "$$$0xb524$$$", "%p embedded"}, {"03", 91827, 5, "%3p", "0x166b3", "%p with minimum field size"}, {"04", 33225, 11, "%.10p", "0x00000081c9", "%p with precision field size"}, {"05", 12345, 9, "%9.7p", "0x0003039", "%p with minimum and precision field size"}, {"06", 98765, 19, "%-.20p", "0x000000000000000181cd", "%p with left-justify"}, {"07", -98765, 8, "%p", "0xfffe7e33", "%p, negative value"}, {"08", 4108, 4, "%8p", " 0x100c", "%p with minimum field size > number of digits"}, {"09", 55220, 6, "%010p", "0x0000d7b4", "%p with minimum field size > number of digits and leading zeroes"}, {"", 0, 0, "", "", ""} /* End with a null format to terminate list */ }; for (i = 0; osp_tests[i].format[0] != '\0'; i++) { /* Perform sprintf test */ init_test(); sprintf(strg_buf, osp_tests[i].format, (void *) osp_tests[i].test_val); UT_Report(check_test(osp_tests[i].expected, strg_buf), "SPRINTF", osp_tests[i].description, test_fmt, osp_tests[i].test_num); /* Truncate expected string in preparation for snprintf test */ strcpy(trunc_buf, osp_tests[i].expected); if (strlen(trunc_buf) >= osp_tests[i].max_len) { trunc_buf[osp_tests[i].max_len - 1] = '\0'; } /* Perform snprintf test */ init_test(); snprintf(strg_buf, osp_tests[i].max_len, osp_tests[i].format, (void *) osp_tests[i].test_val); UT_Report(check_test(trunc_buf, strg_buf), "SNPRINTF", osp_tests[i].description, test_fmt, osp_tests[i].test_num); } }
static int run(void) { int i, ret = 0; if (!opts.dst_addr) { ret = server_listen(); if (ret) return ret; } ret = opts.dst_addr ? client_connect() : server_connect(); if (ret) return ret; ret = exchange_addr_key(); if (ret) return ret; if (!(opts.user_options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (test_size[i].option > opts.size_option) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } sync_test(); wait_for_data_completion(scq, max_credits - credits); /* Finalize before closing ep */ ft_finalize(ep, scq, rcq, FI_ADDR_UNSPEC); out: fi_shutdown(ep, 0); free_ep_res(); if (!opts.dst_addr) free_lres(); fi_close(&dom->fid); fi_close(&fab->fid); return ret; }
int main(void) { #ifdef QUICKSTART test obj; test obj2; init_test(&obj); test_set_pins(&obj, 16, 17); init_test(&obj2); test_set_pins(&obj2, 20, 21); printf("defaultPin %d, defaultOtherPin %d, myFloatConstant %g\n", test_defaultPin, test_defaultOtherPin, test_myFloatConstant); printf("obj: pin %d, other pin %d\n", test_get_pin(&obj), test_get_other_pin(&obj)); printf("obj2: pin %d, other pin %d\n", test_get_pin(&obj2), test_get_other_pin(&obj2)); test_start_blinker(&obj); test_blink(&obj); test_set_pin(&obj, 18); test_blink(&obj); test_blink(&obj2); test_set_pin(&obj2, 22); test_blink(&obj2); while (1) { test_blink(&obj); test_blink(&obj2); } while (1) ; #endif #ifdef ACTIVITYBOARD test obj; init_test(&obj); test_set_pins(&obj, 26, 27); while (1) test_blink(); #endif return 0; }
int main(int argc, char *argv[]) { root_test_t rt[1] = {{{ SU_HOME_INIT(rt) }}}; int retval = 0; int i; rt->rt_family = AF_INET; for (i = 1; argv[i]; i++) { if (strcmp(argv[i], "-v") == 0) rt->rt_flags |= tst_verbatim; else if (strcmp(argv[i], "-a") == 0) rt->rt_flags |= tst_abort; #if SU_HAVE_IN6 else if (strcmp(argv[i], "-6") == 0) rt->rt_family = AF_INET6; #endif else usage(1); } retval |= init_test(rt); retval |= register_test(rt); retval |= clone_test(rt); su_root_threading(rt->rt_root, 0); retval |= clone_test(rt); retval |= deinit_test(rt); return retval; }
int main(){ init_test(); const std::string source = ".version 4.2\n" ".target sm_20\n" ".address_size 64\n" ".visible .entry kernel(.param .u64 kernel_param_0) {\n" ".reg .s32 %r<2>;\n" ".reg .s64 %rd<3>;\n" "bra BB1_2;\n" "ld.param.u64 %rd1, [kernel_param_0];\n" "cvta.to.global.u64 %rd2, %rd1;\n" "mov.u32 %r1, 5;\n" "st.global.u32 [%rd2], %r1;\n" "BB1_2: ret;\n" "}\n"; CUmodule modId = 0; CUfunction funcHandle = 0; cu_assert(cuModuleLoadData(&modId, source.c_str())); cu_assert(cuModuleGetFunction(&funcHandle, modId, "kernel")); CUdeviceptr devValue; int hostValue = 10; cu_assert(cuMemAlloc(&devValue, sizeof(int))); cu_assert(cuMemcpyHtoD(devValue, &hostValue, sizeof(hostValue))); void * params[] = {&devValue}; cu_assert(cuLaunchKernel(funcHandle, 1,1,1, 1,1,1, 0,0, params, nullptr)); cu_assert(cuMemcpyDtoH(&hostValue, devValue, sizeof(hostValue))); assert(hostValue == 10); std::cout << hostValue << "\n"; cu_assert(cuMemFree(devValue)); cu_assert(cuModuleUnload(modId)); return 0; }
static void command (int cmd) { if (cmd == ' ') { seed++; init_test(); } }
static void simLoop (int pause) { int i,j; for (i=0; i < NUM; i++) { for (j=0; j < NUM; j++) test_matrix[i][j] = 0; } dSpaceCollide (space,0,&nearCallback); for (i=0; i < NUM; i++) { for (j=i+1; j < NUM; j++) { if (good_matrix[i][j] && !test_matrix[i][j]) { printf ("failed to report collision (%d,%d) (seed=%ld)\n",i,j,seed); } } } seed++; init_test(); for (i=0; i<NUM; i++) { dVector3 pos,side; dMatrix3 R; dRSetIdentity (R); for (j=0; j<3; j++) pos[j] = (bounds[i][j*2+1] + bounds[i][j*2]) * 0.5; for (j=0; j<3; j++) side[j] = bounds[i][j*2+1] - bounds[i][j*2]; if (hits[i] > 0) dsSetColor (1,0,0); else dsSetColor (1,1,0); dsDrawBox (pos,R,side); } }
int main(int argc, char **argv) { double freq_base, freq_step; int i, j, fails = 0; init_test(); printf("Checking response to frequency step:\n"); printf(" Step 1st interval 2nd interval\n"); printf(" Freq Dev Max Freq Dev Max\n"); for (i = 2; i >= 0; i--) { for (j = 0; j < 5; j++) { freq_base = (rand() % (1 << 24) - (1 << 23)) / 65536e6; freq_step = 10e-6 * (1 << (6 * i)); fails += run_test(0, freq_base, freq_step); } } set_frequency(0.0); if (fails) ksft_exit_fail(); ksft_exit_pass(); }
int main(int argc, char *argv[]) { init_test(); shutdown_test(); return 0; }
int main(){ init_test(); const std::vector<int> sizes({0, 13, 32, 35, 41, 57, 63, 64, 65, 79, 91, 100}); for (const auto i : sizes) { std::cout << run_function<unsigned long long>("_Z10kernel_u64Pyyi", 1024, i) << "\n"; std::cout << run_function<long long>("_Z10kernel_s64Pxxi", 1024, i) << "\n"; std::cout << run_function<unsigned int>("_Z10kernel_u32Pjji", 1024, i) << "\n"; std::cout << run_function<int>("_Z10kernel_s32Piii", 1024, i) << "\n"; } for (const auto i : sizes) { std::cout << run_function<long long>("_Z10kernel_s64Pxxi", -1024, i) << "\n"; std::cout << run_function<int>("_Z10kernel_s32Piii", -1024, i) << "\n"; } const std::vector<unsigned long long> rand_bits({3293874391723201, 39439, 1239748478343, 9898347812, 2938738479912733, 3287538749487, 973849723}); for (size_t k=0 ; k<sizes.size() ; k += 2) { const auto i = sizes[k]; for (const auto rnd : rand_bits) { std::cout << run_function<unsigned long long>("_Z10kernel_u64Pyyi", rnd, i) << "\n"; std::cout << run_function<long long>("_Z10kernel_s64Pxxi", rnd, i) << "\n"; std::cout << run_function<unsigned int>("_Z10kernel_u32Pjji", rnd, i) << "\n"; std::cout << run_function<int>("_Z10kernel_s32Piii", rnd, i) << "\n"; } } return 0; }
static int run(void) { int i, ret = 0; ret = opts.dst_addr ? client_connect() : server_connect(); if (ret) return ret; if (!(opts.user_options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (test_size[i].option > opts.size_option) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } while (credits < max_credits) poll_all_sends(); ft_finalize(ep, scq, rcq, remote_fi_addr); out: free_ep_res(); ret = fi_close(&av->fid); if (ret != 0) { FT_PRINTERR("fi_close", ret); } ret = fi_close(&dom->fid); if (ret != 0) { FT_PRINTERR("fi_close", ret); } ret = fi_close(&fab->fid); if (ret != 0) { FT_PRINTERR("fi_close", ret); } return ret; }
static void bad_credentials_test(NiceAgent *lagent, NiceAgent *ragent) { g_debug ("test-dribblemode:%s", G_STRFUNC); init_test (lagent, ragent, FALSE); nice_agent_set_remote_credentials (lagent, global_ls_id, "wrong", "wrong"); nice_agent_set_remote_credentials (ragent, global_rs_id, "wrong2", "wrong2"); nice_agent_gather_candidates (lagent, global_ls_id); while (!got_stun_packet) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING && !lagent_candidate_gathering_done); nice_agent_gather_candidates (ragent, global_rs_id); while (!ragent_candidate_gathering_done) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (ragent_candidate_gathering_done); swap_candidates (ragent, global_rs_id, lagent, global_ls_id, FALSE); while (global_lagent_state != NICE_COMPONENT_STATE_FAILED) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); // Set the correct credentials and swap candidates set_credentials (lagent, global_ls_id, ragent, global_rs_id); swap_candidates (ragent, global_rs_id, lagent, global_ls_id, FALSE); swap_candidates (lagent, global_ls_id, ragent, global_rs_id, FALSE); while (!data_received) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (data_received); g_assert (global_lagent_state == NICE_COMPONENT_STATE_READY); g_assert (global_ragent_state >= NICE_COMPONENT_STATE_CONNECTED); // Wait for lagent to finish gathering candidates while (!lagent_candidate_gathering_done) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (lagent_candidate_gathering_done); cleanup (lagent, ragent); }
static void bad_candidate_test(NiceAgent *lagent,NiceAgent *ragent) { NiceCandidate *cand = NULL; g_debug ("test-dribblemode:%s", G_STRFUNC); init_test (lagent, ragent, FALSE); nice_agent_gather_candidates (lagent, global_ls_id); while (!got_stun_packet) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING && !lagent_candidate_gathering_done); nice_agent_gather_candidates (ragent, global_rs_id); while (!ragent_candidate_gathering_done) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (ragent_candidate_gathering_done); add_bad_candidate (lagent, global_ls_id, cand); // lagent will finish candidate gathering causing this mainloop to quit while (!lagent_candidate_gathering_done) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); // connchecks will fail causing this mainloop to quit while (global_lagent_state != NICE_COMPONENT_STATE_FAILED) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (global_lagent_state == NICE_COMPONENT_STATE_FAILED && !data_received); set_credentials (lagent, global_ls_id, ragent, global_rs_id); swap_candidates (ragent, global_rs_id, lagent, global_ls_id, FALSE); swap_candidates (lagent, global_ls_id, ragent, global_rs_id, FALSE); while (!data_received) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (lagent_candidate_gathering_done); g_assert (global_lagent_state >= NICE_COMPONENT_STATE_CONNECTED); g_assert (global_ragent_state >= NICE_COMPONENT_STATE_CONNECTED); cleanup (lagent, ragent); }
int main() { init_test(); test(test_random_source_generation(),"Random source generation"); close_nissa(); return 0; }
static int run(void) { char *node, *service; uint64_t flags; int i, ret; ret = ft_read_addr_opts(&node, &service, hints, &flags, &opts); if (ret) return ret; if (!opts.dst_addr) { ret = ft_start_server(); if (ret) return ret; } ret = opts.dst_addr ? client_connect() : server_connect(); if (ret) { return ret; } if (!(opts.options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (!ft_use_size(i, opts.sizes_enabled)) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = pingpong(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = pingpong(); if (ret) goto out; } ret = ft_finalize(); out: fi_shutdown(ep, 0); return ret; }
void test_harness() { TEST_DATA_S tst_data_s; // Structure containing test data init_test( &tst_data_s ); do_test( &tst_data_s ); print_results( &tst_data_s ); } // test_harness
static int run(void) { int i, ret = 0; ret = init_fabric(); if (ret) return ret; ret = init_av(); if (ret) goto out; ret = exchange_addr_key(); if (ret) goto out; if (!(opts.user_options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (test_size[i].option > opts.size_option) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } /* Finalize before closing ep */ ft_finalize(ep, scq, rcq, remote_fi_addr); out: free_ep_res(); fi_close(&dom->fid); fi_close(&fab->fid); return ret; }
static int run(void) { int i, ret; if (!opts.dst_addr) { ret = ft_start_server(); if (ret) return ret; } ret = opts.dst_addr ? ft_client_connect() : ft_server_connect(); if (ret) return ret; ret = ft_exchange_keys(&remote); if (ret) return ret; if (!(opts.options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (!ft_use_size(i, opts.sizes_enabled)) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = run_test(); if (ret) goto out; } ft_sync(); ft_finalize(); out: fi_shutdown(ep, 0); return ret; }
static int run(void) { int i, ret; if (!opts.dst_addr) { ret = ft_start_server(); if (ret) return ret; } ret = opts.dst_addr ? ft_client_connect() : ft_server_connect(); if (ret) { return ret; } ret = ft_bw_init(); if (ret) return ret; if (!(opts.options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (!ft_use_size(i, opts.sizes_enabled)) continue; opts.transfer_size = test_size[i].size; init_test(&opts, test_name, sizeof(test_name)); ret = bandwidth(); if (ret) goto out; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = bandwidth(); if (ret) goto out; } ft_finalize(); out: return ret; }
static void bad_credentials_test(NiceAgent *lagent, NiceAgent *ragent) { g_debug ("test-dribblemode:%s", G_STRFUNC); init_test (lagent, ragent, FALSE); nice_agent_set_remote_credentials (lagent, global_ls_id, "wrong", "wrong"); nice_agent_set_remote_credentials (ragent, global_rs_id, "wrong2", "wrong2"); nice_agent_gather_candidates (lagent, global_ls_id); g_main_loop_run (global_mainloop); g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING && !lagent_candidate_gathering_done); nice_agent_gather_candidates (ragent, global_rs_id); if (!ragent_candidate_gathering_done) { g_main_loop_run (global_mainloop); g_assert (ragent_candidate_gathering_done); } swap_candidates (ragent, global_rs_id, lagent, global_ls_id, FALSE); g_main_loop_run (global_mainloop); g_assert (global_lagent_state == NICE_COMPONENT_STATE_FAILED); // Set the correct credentials and swap candidates set_credentials (lagent, global_ls_id, ragent, global_rs_id); swap_candidates (ragent, global_rs_id, lagent, global_ls_id, FALSE); swap_candidates (lagent, global_ls_id, ragent, global_rs_id, FALSE); g_main_loop_run (global_mainloop); g_assert (data_received); g_assert (global_lagent_state == NICE_COMPONENT_STATE_READY); g_assert (global_ragent_state >= NICE_COMPONENT_STATE_CONNECTED); // Wait for lagent to finish gathering candidates g_main_loop_run (global_mainloop); g_assert (lagent_candidate_gathering_done); cleanup (lagent, ragent); }
static int run(void) { int i, ret; ret = ft_init_fabric(); if (ret) return ret; /* Post an extra receive to avoid lacking a posted receive in the * finalize. */ ret = fi_recv(ep, rx_buf, rx_size + ft_rx_prefix_size(), fi_mr_desc(mr), 0, &rx_ctx); if (!(opts.options & FT_OPT_SIZE)) { for (i = 0; i < TEST_CNT; i++) { if (!ft_use_size(i, opts.sizes_enabled)) continue; opts.transfer_size = test_size[i].size; if (opts.transfer_size > fi->ep_attr->max_msg_size) continue; init_test(&opts, test_name, sizeof(test_name)); ret = pingpong(); if (ret) return ret; } } else { init_test(&opts, test_name, sizeof(test_name)); ret = pingpong(); if (ret) return ret; } return ft_finalize(); }
static void standard_test(NiceAgent *lagent, NiceAgent *ragent) { g_debug ("test-dribblemode:%s", G_STRFUNC); got_stun_packet = FALSE; init_test (lagent, ragent, FALSE); nice_agent_gather_candidates (lagent, global_ls_id); while (!got_stun_packet) g_main_context_iteration (NULL, TRUE); g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING && !lagent_candidate_gathering_done); nice_agent_gather_candidates (ragent, global_rs_id); while (!ragent_candidate_gathering_done) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (ragent_candidate_gathering_done); g_debug ("Setting local candidates of ragent as remote candidates of lagent"); swap_candidates (ragent, global_rs_id, lagent, global_ls_id, TRUE); swap_credentials (ragent, global_rs_id, lagent, global_ls_id); while (!data_received) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (global_lagent_state >= NICE_COMPONENT_STATE_CONNECTED && data_received); g_debug ("Setting local candidates of lagent as remote candidates of ragent"); swap_candidates (lagent, global_ls_id, ragent, global_rs_id, FALSE); swap_credentials (lagent, global_ls_id, ragent, global_rs_id); while (!lagent_candidate_gathering_done) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (lagent_candidate_gathering_done); while (global_ragent_state < NICE_COMPONENT_STATE_CONNECTED) g_main_context_iteration (NULL, TRUE); g_cancellable_reset (global_cancellable); g_assert (global_lagent_state == NICE_COMPONENT_STATE_READY); g_assert (global_ragent_state >= NICE_COMPONENT_STATE_CONNECTED); cleanup (lagent, ragent); }
int main (int argc, char *argv[]) { debugenv(); setprogname(argv[0]); init_shell(NULL); init_net(); init_sage(); init_dir(); init_test(); CMD(test, "# test function"); return shell(); }
void main(void) { PRINT("%s: run test_15_4\n", __func__); net_init(); init_test(); set_routes(); task_fiber_start(&fiberStack_receiving[0], STACKSIZE, (nano_fiber_entry_t) fiber_receiving, 0, 0, 7, 0); task_fiber_start(&fiberStack_sending[0], STACKSIZE, (nano_fiber_entry_t) fiber_sending, 0, 0, 7, 0); }
static int run(void) { int i, ret = 0; ret = init_fabric(); if (ret) return ret; ret = init_av(); if (ret) goto out; ret = exchange_addr_key(); if (ret) goto out; if (run_all_sizes) { for (i = 0; i < TEST_CNT; i++) { if (test_size[i].option > size_option) continue; init_test(test_size[i].size, test_name, sizeof(test_name), &transfer_size, &iterations); ret = run_test(); if (ret) { fprintf(stderr, "Test failed at iteration %d, " "msg size %d\n", i, transfer_size); goto out; } } } else { ret = run_test(); if (ret) goto out; } sync_test(); out: fi_shutdown(ep, 0); fi_close(&ep->fid); free_ep_res(); fi_close(&dom->fid); fi_close(&fab->fid); return ret; }
static void bad_candidate_test(NiceAgent *lagent,NiceAgent *ragent) { NiceCandidate *cand = NULL; g_debug ("test-dribblemode:%s", G_STRFUNC); init_test (lagent, ragent, FALSE); nice_agent_gather_candidates (lagent, global_ls_id); g_main_loop_run (global_mainloop); g_assert (global_lagent_state == NICE_COMPONENT_STATE_GATHERING && !lagent_candidate_gathering_done); nice_agent_gather_candidates (ragent, global_rs_id); if (!ragent_candidate_gathering_done) { g_main_loop_run (global_mainloop); g_assert (ragent_candidate_gathering_done); } add_bad_candidate (lagent, global_ls_id, cand); // lagent will finish candidate gathering causing this mainloop to quit g_main_loop_run (global_mainloop); // connchecks will fail causing this mainloop to quit g_main_loop_run (global_mainloop); g_assert (global_lagent_state == NICE_COMPONENT_STATE_FAILED && !data_received); set_credentials (lagent, global_ls_id, ragent, global_rs_id); swap_candidates (ragent, global_rs_id, lagent, global_ls_id, FALSE); swap_candidates (lagent, global_ls_id, ragent, global_rs_id, FALSE); g_main_loop_run (global_mainloop); g_assert (lagent_candidate_gathering_done); g_assert (global_lagent_state == NICE_COMPONENT_STATE_READY); g_assert (global_ragent_state >= NICE_COMPONENT_STATE_CONNECTED); cleanup (lagent, ragent); }