int main(int argc, char** argv) { int rc; opal_thread_t thr1; opal_thread_t thr2; test_init("opal_thread_t"); OBJ_CONSTRUCT(&thr1, opal_thread_t); OBJ_CONSTRUCT(&thr2, opal_thread_t); thr1.t_run = thr1_run; thr2.t_run = thr2_run; rc = opal_thread_start(&thr1); test_verify_int(OPAL_SUCCESS, rc); rc = opal_thread_start(&thr2); test_verify_int(OPAL_SUCCESS, rc); rc = opal_thread_join(&thr1, NULL); test_verify_int(OPAL_SUCCESS, rc); rc = opal_thread_join(&thr2, NULL); test_verify_int(OPAL_SUCCESS, rc); test_verify_int(3, count); return test_finalize(); }
int main(int argc, char* argv[]) { opal_init(&argc, &argv); test_init("opal_os_create_dirpath_t"); /* All done */ if (test1()) { test_success(); } else { test_failure("opal_os_create_dirpath test1 failed"); } if (test2()) { test_success(); } else { test_failure("opal_os_create_dirpath test2 failed"); } if (test3()) { test_success(); } else { test_failure("opal_os_create_dirpath test3 failed"); } test_finalize(); opal_finalize(); return 0; }
int main() { int i = 0; CU_ErrorCode error; test_initialize(); CU_SuiteInfo all_test_suites[TEST_CUITES_COUNT + 1]; all_test_suites[i++] = fs_test_suite; all_test_suites[i++] = mm_test_suite; all_test_suites[i++] = glibc_test_suite; all_test_suites[i++] = shell_test_suite; all_test_suites[i++] = ring_buffer_test_suite; all_test_suites[i++] = (CU_SuiteInfo)CU_SUITE_INFO_NULL; if (CUE_SUCCESS != CU_initialize_registry()) return CU_get_error(); error = CU_register_suites(all_test_suites); CU_basic_set_mode(CU_BRM_VERBOSE); CU_basic_run_tests(); CU_cleanup_registry(); error = CU_get_error(); test_finalize(); return error; }
int main(int argc, char* argv[]) { int num_dirs; char ** dirs; bool * nfs; test_init("opal_path_nfs()"); #ifdef DEBUG printf ("Test usage: ./opal_path_nfs [DIR]\n"); printf ("On Linux interprets output from mount(8) to check for nfs and verify opal_path_nfs()\n"); printf ("Additionally, you may specify multiple DIR on the cmd-line, of which you the output\n"); #endif if (1 < argc) { int i; for (i = 1; i < argc; i++) printf ("Is dir[%d]:%s one of the detected network file systems? %s\n", i, argv[i], opal_path_nfs (argv[i], NULL) ? "Yes": "No"); } get_mounts (&num_dirs, &dirs, &nfs); while (num_dirs--) { test (dirs[num_dirs], nfs[num_dirs]); } /* All done */ return test_finalize(); }
static int test_run_one( const MMSConfig* config, const TestDesc* desc) { Test test; if (test_init(&test, config, desc)) { GError* error = NULL; GBytes* push = g_bytes_new_static( g_mapped_file_get_contents(test.notification_ind), g_mapped_file_get_length(test.notification_ind)); if (mms_dispatcher_handle_push(test.disp, "TestConnection", push, &error)) { if (mms_dispatcher_start(test.disp)) { test.ret = RET_OK; g_main_loop_run(test.loop); } else { MMS_INFO("%s FAILED", desc->name); } } else { MMS_ERR("%s", MMS_ERRMSG(error)); MMS_INFO("%s FAILED", desc->name); g_error_free(error); } g_bytes_unref(push); test_finalize(&test); return test.ret; } else { return RET_ERR; } }
static int test_read_report_once( const MMSConfig* config, const TestDesc* desc, gboolean debug) { Test test; GError* error = NULL; test_init(&test, config, desc, debug); if (mms_dispatcher_send_read_report(test.disp, test.id, TEST_IMSI, "MessageID", desc->phone, desc->status, &error)) { if (mms_dispatcher_start(test.disp)) { test.ret = RET_OK; g_main_loop_run(test.loop); } else { MMS_INFO("FAILED"); } } else { g_error_free(error); MMS_INFO("FAILED"); } test_finalize(&test); return test.ret; }
int main(int argc, char *argv[]) { char * tst; char * expected; test_init("ompi_numtostr_t"); tst = opal_ltostr(10); expected = malloc(sizeof(long) * 8); snprintf(expected, sizeof(long) * 8, "%d", 10); if (strcmp(tst, expected) != 0) { test_failure("opal_ltostr test failed"); } else { test_success(); } free(tst); free(expected); tst = opal_dtostr(5.32); expected = malloc(sizeof(long) * 8); snprintf(expected, sizeof(long) * 8, "%f", 5.32); if (strcmp(tst, expected) != 0) { test_failure("opal_dtostr test failed"); } else { test_success(); } test_finalize(); return 0; }
int main(int argc, char **argv) { test_init(); test(test_db); test(test_db_prepare); test_finalize(); return 0; }
int main(int argc, char **argv) { test_init("ompi_rb_tree_t"); test1(); test2(); /* test_keys(); */ return test_finalize(); }
int main(int argc, char** argv) { int rc; opal_thread_t* thr1; opal_thread_t* thr2; test_init("opal_condition_t"); rc = opal_init(&argc, &argv); test_verify_int(OPAL_SUCCESS, rc); if (OPAL_SUCCESS != rc) { test_finalize(); exit(1); } opal_set_using_threads(true); OBJ_CONSTRUCT(&mutex, opal_mutex_t); OBJ_CONSTRUCT(&thr1_cond, opal_condition_t); OBJ_CONSTRUCT(&thr2_cond, opal_condition_t); thr1 = OBJ_NEW(opal_thread_t); thr2 = OBJ_NEW(opal_thread_t); thr1->t_run = thr1_run; thr2->t_run = thr2_run; rc = opal_thread_start(thr1); test_verify_int(OPAL_SUCCESS, rc); rc = opal_thread_start(thr2); test_verify_int(OPAL_SUCCESS, rc); rc = opal_thread_join(thr1, NULL); test_verify_int(OPAL_SUCCESS, rc); test_verify_int(TEST_COUNT, thr1_count); rc = opal_thread_join(thr2, NULL); test_verify_int(OPAL_SUCCESS, rc); test_verify_int(TEST_COUNT, thr2_count); opal_finalize(); return test_finalize(); }
int main(int argc, char **argv) { test_init(); test(test_parseB60); test(test_parsetime); test(test_daywrap); test(test_daywrap_minutes); test(test_spawn_script); test_finalize(); return 0; }
int main(int argc, char **argv) { test_init("opal_pointer_array"); /* run through tests with thread usage set to false */ test(false); /* run through tests with thread usage set to true */ test(true); return test_finalize(); }
int main(int argc, char* argv[]) { test_init("opal_argv_t"); if( test1() ) test_success(); else test_failure("test1 argv test failed"); if( test2() ) test_success(); else test_failure("test2 argv test failed"); if( test3() ) test_success(); else test_failure("test3 argv test failed"); if( test4() ) test_success(); else test_failure("test4 argv test failed"); if( test5() ) test_success(); else test_failure("test5 argv test failed"); if( test6() ) test_success(); else test_failure("test6 argv test failed"); if( test7() ) test_success(); else test_failure("test7 argv test failed"); if( test8() ) test_success(); else test_failure("test8 argv test failed"); if (test9()) { test_success(); } else { test_failure("test9 argv test failed"); } if (test10()) { test_success(); } else { test_failure("test10 argv test failed"); } /* All done */ return test_finalize(); }
int main(int argc, char *argv[]) { /* Local variables */ opal_bitmap_t bm; int err; /* Perform overall test initialization */ test_init("opal_bitmap_t"); #ifdef STANDALONE error_out = stderr; #else error_out = fopen( "./opal_bitmap_test_out.txt", "w" ); if( error_out == NULL ) error_out = stderr; #endif /* Initialize bitmap */ PRINT_VALID_ERR; err = opal_bitmap_init(NULL, 2); if (err == OPAL_ERR_BAD_PARAM) fprintf(error_out, "ERROR: Initialization of bitmap failed\n\n"); PRINT_VALID_ERR; err = opal_bitmap_init(&bm, -1); if (err == OPAL_ERR_BAD_PARAM) fprintf(error_out, "ERROR: Initialization of bitmap failed \n\n"); err = opal_bitmap_init(&bm, BSIZE); if (0 > err) { fprintf(error_out, "Error in bitmap create -- aborting \n"); exit(-1); } fprintf(error_out, "\nTesting bitmap set... \n"); test_bitmap_set(&bm); fprintf(error_out, "\nTesting bitmap clear ... \n"); test_bitmap_clear(&bm); fprintf(error_out, "\nTesting bitmap is_set ... \n"); test_bitmap_is_set(&bm); fprintf(error_out, "\nTesting bitmap clear_all... \n"); test_bitmap_clear_all(&bm); fprintf(error_out, "\nTesting bitmap set_all... \n"); test_bitmap_set_all(&bm); fprintf(error_out, "\nTesting bitmap find_and_set... \n"); test_bitmap_find_and_set(&bm); fprintf(error_out, "\n~~~~~~ Testing complete ~~~~~~ \n\n"); test_finalize(); #ifndef STANDALONE fclose(error_out); #endif return 0; }
int main(int argc, char **argv) { /* local variables */ opal_list_t list, x; size_t indx,i,list_size, tmp_size_1, tmp_size_2,size_elements; int error_cnt; test_data_t *elements, *ele; opal_list_item_t *item; opal_init(); test_init("opal_list_t"); /* initialize list */ OBJ_CONSTRUCT(&list, opal_list_t); OBJ_CONSTRUCT(&x, opal_list_t); /* check length of list */ list_size=opal_list_get_size(&list); if( 0 == list_size ) { test_success(); } else { test_failure(" opal_list_get_size"); } /* check for empty */ if (opal_list_is_empty(&list)) { test_success(); } else { test_failure(" opal_list_is_empty(empty list)"); } /* create test elements */ size_elements=4; elements=(test_data_t *)malloc(sizeof(test_data_t)*size_elements); assert(elements); for(i=0 ; i < size_elements ; i++) { OBJ_CONSTRUCT(elements + i, test_data_t); (elements+i)->data=i; } /* populate list */ for(i=0 ; i < size_elements ; i++) { opal_list_append(&list,(opal_list_item_t *)(elements+i)); } list_size=opal_list_get_size(&list); if( list_size == size_elements ) { test_success(); } else { test_failure(" populating list"); } /* checking for empty on non-empty list */ if (!opal_list_is_empty(&list)) { test_success(); } else { test_failure(" opal_list_is_empty(non-empty list)"); } /* check that list is ordered as expected */ i=0; error_cnt=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { if( ele->data != i ) error_cnt++; i++; } if( 0 == error_cnt ) { test_success(); } else { test_failure(" error in list order "); } /* check opal_list_get_first */ ele = (test_data_t *)NULL; ele = (test_data_t *) opal_list_get_first(&list); assert(ele); if( 0 == ele->data ) { test_success(); } else { test_failure(" error in opal_list_get_first"); } i=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { i++; } if( size_elements == i ) { test_success(); } else { test_failure(" error in opal_list_get_first - list size changed "); } /* check opal_list_get_last */ ele = (test_data_t *)NULL; ele = (test_data_t *) opal_list_get_last(&list); assert(ele); if( (size_elements-1) == ele->data ) { test_success(); } else { test_failure(" error in opal_list_get_last"); } i=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { i++; } if( size_elements == i ) { test_success(); } else { test_failure(" error in opal_list_get_first - list size changed "); } /* check opal_list_remove_first */ ele = (test_data_t *)NULL; ele = (test_data_t *) opal_list_remove_first(&list); assert(ele); if( 0 == ele->data ) { test_success(); } else { test_failure(" error in opal_list_remove_first"); } i=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { i++; } if( (size_elements-1) == i ) { test_success(); } else { test_failure(" error in opal_list_remove_first - list size changed "); } /* test opal_list_prepend */ opal_list_prepend(&list,(opal_list_item_t *)elements); ele = (test_data_t *)NULL; ele = (test_data_t *) opal_list_get_first(&list); assert(ele); if( 0 == ele->data ) { test_success(); } else { test_failure(" error in opal_list_prepend"); } i=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { i++; } if( size_elements == i ) { test_success(); } else { test_failure(" error in opal_list_prepend - list size changed "); } /* check opal_list_remove_last */ ele = (test_data_t *)NULL; ele = (test_data_t *) opal_list_remove_last(&list); assert(ele); if( (size_elements-1) == ele->data ) { test_success(); } else { test_failure(" error in opal_list_remove_last"); } i=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { i++; } if( (size_elements-1) == i ) { test_success(); } else { test_failure(" error in opal_list_remove_last - list size changed "); } /* test opal_list_append */ opal_list_append(&list,(opal_list_item_t *)(elements+size_elements-1)); ele = (test_data_t *)NULL; ele = (test_data_t *) opal_list_get_last(&list); assert(ele); if( (size_elements-1) == ele->data ) { test_success(); } else { test_failure(" error in opal_list_append"); } i=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { i++; } if( size_elements == i ) { test_success(); } else { test_failure(" error in opal_list_append - list size changed "); } /* remove element from list */ indx=size_elements/2; if( 0 == indx ) indx=1; assert(2 <= size_elements); ele = (test_data_t *)NULL; ele = (test_data_t *) opal_list_remove_item(&list,(opal_list_item_t *)(elements+indx)); assert(ele); if( (indx-1) == ele->data ) { test_success(); } else { test_failure(" error in opal_list_remove - previous"); } ele=(test_data_t *)(((opal_list_item_t *)ele)->opal_list_next); if( (indx+1) == ele->data ) { test_success(); } else { test_failure(" error in opal_list_remove - next"); } i=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { i++; } if( (size_elements-1) == i ) { test_success(); } else { test_failure(" error in opal_list_remove - list size changed incorrectly"); } /* test the insert function */ i=opal_list_insert(&list,(opal_list_item_t *)(elements+indx),indx); if( 1 == i ) { test_success(); } else { test_failure(" error in opal_list_remove_item \n"); } i=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { i++; } if( size_elements == i ) { test_success(); } else { test_failure(" error in opal_list_insert - incorrect list length"); } i=0; error_cnt=0; for(ele = (test_data_t *) opal_list_get_first(&list); ele != (test_data_t *) opal_list_get_end(&list); ele = (test_data_t *) ((opal_list_item_t *)ele)->opal_list_next) { if( ele->data != i ) error_cnt++; i++; } if( 0 == error_cnt ) { test_success(); } else { test_failure(" error in list order - opal_list_remove_item "); } /* test the splice and join functions */ list_size = opal_list_get_size(&list); for (i = 0, item = opal_list_get_first(&list) ; i < list_size / 2 ; ++i, item = opal_list_get_next(item)) { } opal_list_splice(&x, opal_list_get_end(&x), &list, item, opal_list_get_end(&list)); tmp_size_1 = opal_list_get_size(&list); tmp_size_2 = opal_list_get_size(&x); if (tmp_size_1 != i) { test_failure(" error in splice (size of list)"); } else if (tmp_size_2 != list_size - tmp_size_1) { test_failure(" error in splice (size of x)"); } else { test_success(); } opal_list_join(&list, opal_list_get_end(&list), &x); tmp_size_1 = opal_list_get_size(&list); tmp_size_2 = opal_list_get_size(&x); if (tmp_size_1 != list_size) { test_failure(" error in join (size of list)"); } else if (tmp_size_2 != 0) { test_failure(" error in join (size of x)"); } else { test_success(); } if (NULL != elements) free(elements); opal_finalize(); return test_finalize(); }
int main(int argc, char **argv) { for (size_t i = 0; i < 128; i++) { test_class(PN_OBJECT, i); test_class(PN_VOID, i); test_class(&noop_class, i); } for (size_t i = 0; i < 128; i++) { test_new(i, PN_OBJECT); test_new(i, &noop_class); } test_finalize(); test_free(); test_hashcode(); test_compare(); for (int i = 0; i < 1024; i++) { test_refcounting(i); } for (size_t i = 0; i < 4; i++) { test_list(i); } for (size_t i = 0; i < 4; i++) { test_list_refcount(i); } test_list_index(); test_map(); test_map_links(); test_hash(); test_string(NULL); test_string(""); test_string("this is a test"); test_string("012345678910111213151617181920212223242526272829303132333435363" "738394041424344454647484950515253545556575859606162636465666768"); test_string("this has an embedded \000 in it"); test_stringn("this has an embedded \000 in it", 28); test_string_format(); test_string_addf(); test_build_list(); test_build_map(); test_build_map_odd(); for (int i = 0; i < 64; i++) { test_map_iteration(i); } test_list_inspect(); test_map_inspect(); test_list_compare(); test_iterator(); for (int seed = 0; seed < 64; seed++) { for (int size = 1; size <= 64; size++) { test_heap(seed, size); } } return 0; }
int main(int argc, char* argv[]) { orte_proc_info(); /* initialize proc info structure */ orte_process_info.my_name = (orte_process_name_t*)malloc(sizeof(orte_process_name_t)); orte_process_info.my_name->cellid = 0; orte_process_info.my_name->jobid = 0; orte_process_info.my_name->vpid = 0; test_init("orte_session_dir_t"); test_out = fopen( "test_session_dir_out", "w+" ); if( test_out == NULL ) { test_failure("test_session_dir couldn't open test file failed"); test_finalize(); exit(1); } fprintf(test_out, "running test1\n"); if (test1()) { test_success(); } else { test_failure("orte_session_dir_t test1 failed"); } fprintf(test_out, "running test2\n"); if (test2()) { test_success(); } else { test_failure("orte_session_dir_t test2 failed"); } fprintf(test_out, "running test3\n"); if (test3()) { test_success(); } else { test_failure("orte_session_dir_t test3 failed"); } fprintf(test_out, "running test4\n"); if (test4()) { test_success(); } else { test_failure("orte_session_dir_t test4 failed"); } fprintf(test_out, "running test5\n"); if (test5()) { test_success(); } else { test_failure("orte_session_dir_t test5 failed"); } fprintf(test_out, "running test6\n"); if (test6()) { test_success(); } else { test_failure("orte_session_dir_t test6 failed"); } fprintf(test_out, "running test7\n"); if (test7()) { test_success(); } else { test_failure("orte_session_dir_t test7 failed"); } fprintf(test_out, "running test8\n"); if (test8()) { test_success(); } else { test_failure("orte_session_dir_t test8 failed"); } fprintf(test_out, "completed all tests\n"); fclose(test_out); /* clean up */ orte_proc_info_finalize(); test_finalize(); return 0; }
void test_fail_stop(const char *msg, int status) { test_failure(msg); test_finalize(); exit(status); }
int main(int argc, char *argv[]) { char hostname[OPAL_MAXHOSTNAMELEN]; opal_init(&argc, &argv); test_init("opal_if"); /* 127.0.0.1 */ if (test_ifaddrtoname("127.0.0.1")) { test_success(); } else { test_failure("ifaddrtoname test failed for 127.0.0.1"); } if (opal_ifislocal("127.0.0.1")) { test_success(); } else { test_failure("ifislocal test failed for 127.0.0.1"); } /* localhost */ if (test_ifaddrtoname("localhost")) { test_success(); } else { test_failure("ifaddrtoname test failed for localhost"); } if (opal_ifislocal("localhost")) { test_success(); } else { test_failure("ifislocal test failed for localhost"); } /* 0.0.0.0 */ if (test_ifaddrtoname("0.0.0.0")) { test_failure("ifaddrtoname test failed for 0.0.0.0"); } else { test_success(); } if (opal_ifislocal("0.0.0.0")) { test_failure("opal_ifislocal test failed for 0.0.0.0"); } else { test_success(); } /* foo.example.com */ printf("This should generate a warning:\n"); fflush(stdout); if (test_ifaddrtoname("foo.example.com")) { test_failure("ifaddrtoname test failed for foo.example.com"); } else { test_success(); } printf("This should generate a warning:\n"); fflush(stdout); if (opal_ifislocal("foo.example.com")) { test_failure("ifislocal test failed for foo.example.com"); } else { test_success(); } /* local host name */ gethostname(hostname, sizeof(hostname)); if (test_ifaddrtoname(hostname)) { test_success(); } else { test_failure("ifaddrtoname test failed for local host name"); } if (opal_ifislocal(hostname)) { test_success(); } else { test_failure("ifislocal test failed for local host name"); } test_finalize(); opal_finalize(); return 0; }