/* * constructor */ rpc_cpi_impl::rpc_cpi_impl (proxy * p, cpi_info const & info, saga::ini::ini const & glob_ini, saga::ini::ini const & adap_ini, TR1::shared_ptr <saga::adaptor> adaptor) : base_cpi (p, info, adaptor, cpi::Noflags) { grpc_error_t err; std::cout << "Initializing" << std::endl; /* gridrpc initialization */ err = grpc_initialize(NULL); if (err != GRPC_NO_ERROR && err != GRPC_ALREADY_INITIALIZED) { SAGA_ADAPTOR_THROW ("Failed to invoke grpc_initialize().", saga::NoSuccess); } std::cout << "Creating an RPC handle" << std::endl; instance_data data (this); saga::url fn_url(data->funcname_); int port = fn_url.get_port(); if (port == -1) { err = grpc_function_handle_init(&rpc_handle, const_cast<char *>(fn_url.get_host().c_str()), const_cast<char *>(fn_url.get_path().substr(1).c_str())); } else { if (port > 0 && port < 65536) { char host_plus_port[fn_url.get_host().length() + 8]; sprintf(host_plus_port, "%s:%d", fn_url.get_host().c_str(), fn_url.get_port()); err = grpc_function_handle_init(&rpc_handle, host_plus_port, const_cast<char *>(fn_url.get_path().substr(1).c_str())); } else { SAGA_ADAPTOR_THROW ("Invalid port number.", saga::NoSuccess); } } if (err != GRPC_NO_ERROR) { SAGA_ADAPTOR_THROW ("Failed to invoke grpc_function_handle_init().", saga::NoSuccess); } /* FIXEME: should support the following url conversion. host name host name:port number host name:port number/jobmanager host name/jobmanager host name:/jobmanager host name::subject host name:port number:subject host name/jobmanager:subject host name:/jobmanager:subject host name:port number/jobmanager:subject */ }
/* * Copy from inout-file to out-file and from in-file to inout-file. */ int main(int argc, char *argv[]) { grpc_error_t ret; if (argc < 5) { fprintf(stderr, "Usage: %s config in-file inout-file out-file\n", argv[0]); exit(2); } ret = grpc_initialize(argv[1]); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_initialize() error. (%s)\n", grpc_error_string(ret)); exit(2); } ret = grpc_function_handle_default(&handles, MODULE_NAME "/filename_test"); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_default() error. (%s)\n", grpc_error_string(ret)); exit(2); } ret = grpc_call(&handles, argv[2], argv[3], argv[4]); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_call() error. (%s)\n", grpc_error_string(ret)); exit(2); } ret = grpc_function_handle_destruct(&handles); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_destruct() error. (%s)\n", grpc_error_string(ret)); exit(2); } ret = grpc_finalize(); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_finalize() error. (%s)\n", grpc_error_string(ret)); exit(2); } return 0; }
int main(int argc, char *argv[]) { grpc_error_t result; char *config_file, *program_name; int ch; int ret, exit_code; program_name = argv[0]; while ((ch = getopt(argc, argv, "v")) != -1) { switch (ch) { case 'v' : verbose = 1; break; default : fprintf(stderr, "Usage: %s [-v] config\n", program_name); exit(2); } } argc -= optind; argv += optind; if (argc < 1) { fprintf(stderr, "Usage: %s [-v] config\n", program_name); exit(2); } config_file = argv[0]; exit_code = 0; setbuf(stdout, NULL); result = grpc_initialize(config_file); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_initialize() error. (%s)\n", grpc_error_string(result)); exit(2); } printf("char_testing: "); ret = char_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("short_testing: "); ret = short_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("int_testing: "); ret = int_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("long_testing: "); ret = long_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("float_testing: "); ret = float_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("double_testing: "); ret = double_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("string_testing: "); ret = string_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("string_array_testing: "); ret = string_array_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("scomplex_testing: "); ret = scomplex_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("dcomplex_testing: "); ret = dcomplex_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("work_testing: "); ret = work_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); result = grpc_finalize(); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_finalize() error. (%s)\n", grpc_error_string(result)); exit(2); } return exit_code; }
int main(int argc, char *argv[]) { grpc_function_handle_t handle; grpc_sessionid_t id; grpc_error_t result = GRPC_NO_ERROR; char *host = NULL; long times, answer; if (argc != 3){ fprintf(stderr, "USAGE: %s TIMES HOSTNAME\n", argv[0]); exit(2); } times = atol(argv[1]); host = argv[2]; /* Initialize */ result = grpc_initialize(config_file); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_initialize() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Initialize Function handles */ result = grpc_function_handle_init(&handle, host, func_name); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_init() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Asynchronous call */ result = grpc_call_async(&handle, &id, times, &answer); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_call_async() error. (%s)\n", grpc_error_string(result)); exit(2); } /* wait for session */ result = grpc_wait_all(); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_wait_all() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Destruct Function handles */ result = grpc_function_handle_destruct(&handle); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_destruct() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Compute and display pi. */ printf("PI = %f\n", 4.0 * ((double)answer / times)); /* Finalize */ result = grpc_finalize(); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_finalize() error. (%s)\n", grpc_error_string(result)); exit(2); } return 0; }
/* * Copy from inout-file to out-file and from in-file to inout-file. */ int main(int argc, char *argv[]) { grpc_error_t ret; int result; char *conf, *array_size_str, *end; int array_size; char **in_file_array, **inout_file_array, **out_file_array; char *in_file, *inout_file, *out_file; if (argc < 6) { fprintf(stderr, "Usage: %s config count in-file inout-file out-file\n", argv[0]); exit(2); } conf = argv[1]; array_size_str = argv[2]; in_file = argv[3]; inout_file = argv[4]; out_file = argv[5]; ret = grpc_initialize(conf); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_initialize() error. (%s)\n", grpc_error_string(ret)); exit(2); } array_size = strtol(array_size_str, &end, 0); if (*end != '\0') { fprintf(stderr, "Argument \"%s\" is not digit.\n", array_size_str); exit(1); } else if (array_size < 1){ fprintf(stderr, "array_size %d < 1 (min)\n", array_size); exit(1); } result = create_file_names(array_size, in_file, inout_file, out_file, &in_file_array, &inout_file_array, &out_file_array); if (result == 0) { fprintf(stderr, "creating filenames failed\n"); exit(1); } result = check_files(array_size, in_file_array, inout_file_array); if (result == 0) { fprintf(stderr, "files are not prepared. no test performed.\n"); exit(1); } ret = grpc_function_handle_default( &handles, MODULE_NAME "/filename_array_test"); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_default() error. (%s)\n", grpc_error_string(ret)); exit(2); } ret = grpc_call(&handles, array_size, in_file_array, inout_file_array, out_file_array); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_call() error. (%s)\n", grpc_error_string(ret)); exit(2); } ret = grpc_function_handle_destruct(&handles); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_destruct() error. (%s)\n", grpc_error_string(ret)); exit(2); } ret = grpc_finalize(); if (ret != GRPC_NO_ERROR) { fprintf(stderr, "grpc_finalize() error. (%s)\n", grpc_error_string(ret)); exit(2); } result = destroy_file_names(array_size, &in_file_array, &inout_file_array, &out_file_array); if (result == 0) { fprintf(stderr, "destroying filenames failed\n"); exit(1); } return 0; }
int main(int argc, char *argv[]) { grpc_object_handle_t_np *handles; grpc_sessionid_t *ids = NULL; grpc_error_t result = GRPC_NO_ERROR; char **hosts = NULL; double pi; long *count = NULL; long times, sum; int n; int i, j; if (argc < 3){ fprintf(stderr, "USAGE: %s TIMES HOSTNAME\n", argv[0]); fprintf(stderr, "USAGE: %s TIMES HOSTNAME1 HOSTANME2...\n", argv[0]); exit(2); } n = argc - 2; hosts = (char **)malloc(sizeof(char *) * n); if (hosts == NULL) { fprintf(stderr, "malloc: Can't allocate the storage for hostname.\n"); exit(2); } for (i = 2, j = 0; j < n; i++, j++) { hosts[j] = NULL; hosts[j] = strdup(argv[i]); if (*hosts == NULL) { fprintf(stderr, "strdup: Can't allocate the storage for hostname.\n"); exit(2); } } times = atol(argv[1]) / n; handles = (grpc_object_handle_t_np *)malloc( sizeof(grpc_object_handle_t_np) * n); if (handles == NULL) { fprintf(stderr, "malloc: Can't allocate the storage for handles.\n"); exit(2); } count = (long *)malloc(sizeof(long) * n); if (count == NULL) { fprintf(stderr, "malloc: Can't allocate the storage.\n"); exit(2); } ids = (grpc_sessionid_t *)malloc(sizeof(grpc_sessionid_t) * n); if (ids == NULL) { fprintf(stderr, "malloc: Can't allocate the storage.\n"); exit(2); } /* Initialize */ result = grpc_initialize(config_file); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_initialize() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Initialize Object handles */ for (i = 0; i < n; i++) { result = grpc_object_handle_init_np(&handles[i], hosts[i], func_name); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_object_handle_init_np() error. (%s)\n", grpc_error_string(result)); exit(2); } } /* Asynchronous call */ for (i = 0; i < n; i++) { result = grpc_invoke_async_np(&handles[i], "pi_trial", &ids[i], i, times, &count[i]); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_invoke_async_np() error. (%s)\n", grpc_error_string(result)); exit(2); } } /* wait for session */ result = grpc_wait_all(); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_wait_all() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Destruct Function handles */ for (i = 0; i < n; i++) { result = grpc_object_handle_destruct_np(&handles[i]); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_object_handle_destruct_np() error. (%s)\n", grpc_error_string(result)); exit(2); } } /* Compute and display pi. */ for (i = 0, sum = 0; i < n; i++) { sum += count[i]; } pi = 4.0 * (sum / ((double) times * n)); printf("PI = %f\n", pi); /* Finalize */ result = grpc_finalize(); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_finalize() error. (%s)\n", grpc_error_string(result)); exit(2); } for (i = 0; i < n; i++) { free(hosts[i]); } free(hosts); free(handles); free(count); free(ids); return 0; }
int main(int argc, char *argv[]) { grpc_function_handle_t handles[2]; grpc_sessionid_t ids[2]; grpc_error_t result = GRPC_NO_ERROR; char *hosts[2]; long count[2]; double pi; long times, sum; int i; if (argc != 4){ fprintf(stderr, "USAGE: %s TIMES HOSTNAME1 HOSTANME2\n", argv[0]); exit(2); } hosts[0] = NULL; hosts[0] = strdup(argv[2]); hosts[1] = NULL; hosts[1] = strdup(argv[3]); if ((hosts[0] == NULL) || (hosts[1] == NULL)) { fprintf(stderr, "strdup: Can't allocate the storage for hostname.\n"); exit(2); } times = atol(argv[1]) / 2; /* Initialize */ result = grpc_initialize(config_file); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_initialize() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Initialize Function handles */ for (i = 0; i < 2; i++) { result = grpc_function_handle_init(&handles[i], hosts[i], func_name); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_init() error. (%s)\n", grpc_error_string(result)); exit(2); } } /* Asynchronous call */ for (i = 0; i < 2; i++) { result = grpc_call_async(&handles[i], &ids[i], i, times, &count[i]); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_call_async() error. (%s)\n", grpc_error_string(result)); exit(2); } } /* wait for session */ result = grpc_wait_all(); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_wait_all() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Destruct Function handles */ for (i = 0; i < 2; i++) { result = grpc_function_handle_destruct(&handles[i]); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_destruct() error. (%s)\n", grpc_error_string(result)); exit(2); } } /* Compute and display pi. */ for (i = 0, sum = 0; i < 2; i++) { sum += count[i]; } pi = 4.0 * (sum / ((double) times * 2)); printf("PI = %f\n", pi); /* Finalize */ result = grpc_finalize(); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_finalize() error. (%s)\n", grpc_error_string(result)); exit(2); } for (i = 0; i < 2; i++) { free(hosts[i]); } return 0; }
int main(int argc, char *argv[]) { grpc_function_handle_t *handle; grpc_sessionid_t *id = NULL; grpc_error_t result = GRPC_NO_ERROR; char *host = NULL; int n; double scalarIn; double scalarOut; double *arrayIn; double *arrayOut; int i; int mismatchCount = 0; if (argc < 3){ fprintf(stderr, "USAGE: %s HOSTNAME No_of_CPUs\n", argv[0]); exit(2); } host = strdup(argv[1]); n = atoi(argv[2]); /* prepare arg data */ arrayIn = (double*)malloc(sizeof(double)*n); arrayOut = (double*)malloc(sizeof(double)*n); scalarIn = 1; for (i = 0; i < n; i++){ arrayIn[i] = (double)i; } handle = (grpc_function_handle_t *)malloc(sizeof(grpc_function_handle_t)); if (handle == NULL) { fprintf(stderr, "malloc: Can't allocate the storage for handles.\n"); exit(2); } id = (grpc_sessionid_t *)malloc(sizeof(grpc_sessionid_t)); if (id == NULL) { fprintf(stderr, "malloc: Can't allocate the storage.\n"); exit(2); } /* Initialize */ result = grpc_initialize(config_file); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_initialize() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Initialize Function handles */ result = grpc_function_handle_init(handle, host, func_name); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_init() error. (%s)\n", grpc_error_string(result)); exit(2); } printf("async call start: %s\n", host); /* Asynchronous call */ result = grpc_call_async(handle, id, n, scalarIn, &scalarOut, arrayIn, arrayOut); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_call_async() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Asynchronous call wait*/ result = grpc_wait_all(); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_wait_all() error. (%s)\n", grpc_error_string(result)); exit(2); } printf("wait_all end\n"); /* Destruct Function handles */ result = grpc_function_handle_destruct(handle); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_destruct() error. (%s)\n", grpc_error_string(result)); exit(2); } printf("destruct handle end\n"); /* Check Result */ if(scalarIn != scalarOut){ printf("Result is NOT correct: scalarIn(%f) != scalarOut(%f)\n", scalarIn, scalarOut); } else{ printf("Result is correct: scalarIn(%f) == scalarOut(%f)\n", scalarIn, scalarOut); } for (i = 0; i < n; i++) { if(arrayIn[i] != arrayOut[i]){ printf("Result is NOT correct: arrayIn(%f) != arrayOut(%f) at %d\n", arrayIn[i], arrayOut[i], i); mismatchCount++; } } if(mismatchCount == 0){ printf("Result is correct for all array args\n"); } /* Finalize */ result = grpc_finalize(); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_finalize() error. (%s)\n", grpc_error_string(result)); exit(2); } free(host); free(handle); free(id); return 0; }
int main(int argc, char *argv[]) { grpc_function_handle_t *handles; grpc_sessionid_t *ids = NULL, id; grpc_error_t result; char **hosts = NULL; double param1[DEF_SCALAR][DEF_SCALAR]; double param2[DEF_SCALAR][DEF_SCALAR]; double *param3; double wk1, wk2; int n; int index, base; int i, j, k; if (argc < 2) { fprintf(stderr, "USAGE: %s HOSTNAME.\n", argv[0]); fprintf(stderr, "USAGE: %s HOSTNAME1 HOSTNAME2...\n", argv[0]); exit(2); } n = argc - 1; hosts = (char **)malloc(sizeof(char *) * n); if (hosts == NULL) { fprintf(stderr, "malloc: Can't allocate the storage for hostname.\n"); exit(2); } for (i = 1, j = 0; j < n; i++, j++) { hosts[j] = NULL; hosts[j] = strdup(argv[i]); if (*hosts == NULL) { fprintf(stderr, "strdup: Can't allocate the storage for hostname.\n"); exit(2); } } handles = (grpc_function_handle_t *)malloc( sizeof(grpc_function_handle_t) * n); if (handles == NULL) { fprintf(stderr, "malloc: Can't allocate the storage for handles.\n"); exit(2); } ids = (grpc_sessionid_t *)malloc(sizeof(grpc_sessionid_t) * n); if (ids == NULL) { fprintf(stderr, "malloc: Can't allocate the storage.\n"); exit(2); } param3 = (double *)malloc(sizeof(double) * n * DEF_SCALAR * DEF_SCALAR); if (param3 == NULL) { fprintf(stderr, "malloc: Can't allocate the storage.\n"); exit(2); } /* Initialize the parameter */ for (j = 0, wk1 = 1.0, wk2 = 500.0; j < DEF_SCALAR; j++) { for (k = 0; k < DEF_SCALAR; k++) { param1[j][k] = wk1++; param2[j][k] = wk2++; } } for (i = 0; i < (n * DEF_SCALAR * DEF_SCALAR); i++) { param3[i] = 0.0; } for (i = 0; i < DEF_SCALAR; i++) { for (j = 0; j < DEF_SCALAR; j++) { fprintf(stdout, "%f ", param1[i][j]); } fprintf(stdout, "\n"); } fprintf(stdout, "\n"); for (i = 0; i < DEF_SCALAR; i++) { for (j = 0; j < DEF_SCALAR; j++) { fprintf(stdout, "%f ", param2[i][j]); } fprintf(stdout, "\n"); } fprintf(stdout, "\n"); /* Initialize */ result = grpc_initialize(config_file); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_initialize() error. (%s)\n", grpc_error_string(result)); exit(2); } /* Initialize Function handles */ for (i = 0; i < n; i++) { result = grpc_function_handle_init(&handles[i], hosts[i], func_name); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_init() error. (%s)\n", grpc_error_string(result)); exit(2); } } /* Asynchronous call */ for (i = 0; i < n; i++) { result = grpc_call_async(&handles[i], &ids[i], DEF_SCALAR, param1, param2, param3 + (i * DEF_SCALAR * DEF_SCALAR)); if (result != GRPC_NO_ERROR){ fprintf(stderr, "grpc_call_async() error. (%s)\n", grpc_error_string(result)); exit(2); } } for (k = 0; k < n; k++) { /* Wait any session */ result = grpc_wait_any(&id); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_wait_any() error. (%s)\n", grpc_error_string(result)); exit(2); } fprintf(stdout, "got Session ID = %d\n", id); for (index = 0; index < n; index++) { if (ids[index] == id) { break; } } fprintf(stdout, "index = %d, ID = %d\n", index, id); base = index * DEF_SCALAR * DEF_SCALAR; for (i = 0; i < DEF_SCALAR; i++) { for (j = 0; j < DEF_SCALAR; j++) { fprintf(stdout, "%f ", param3[base + (i * DEF_SCALAR) + j]); } fprintf(stdout, "\n"); } fprintf(stdout, "\n"); } /* Destruct Function handles */ for (i = 0; i < n; i++) { result = grpc_function_handle_destruct(&handles[i]); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_function_handle_destruct() error. (%s)\n", grpc_error_string(result)); exit(2); } } /* Finalize */ result = grpc_finalize(); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_finalize() error. (%s)\n", grpc_error_string(result)); exit(2); } for (i = 0; i < n; i++) { free(hosts[i]); } free(hosts); free(handles); free(ids); free(param3); return 0; }
int main(int argc, char *argv[]) { grpc_error_t result; char *config_file, *program_name; int ch; int ret, exit_code; program_name = argv[0]; while ((ch = getopt(argc, argv, "v")) != -1) { switch (ch) { case 'v' : verbose = 1; break; default : fprintf(stderr, "Usage: %s [-v] config\n", program_name); exit(2); } } argc -= optind; argv += optind; if (argc < 1) { fprintf(stderr, "Usage: %s [-v] config\n", program_name); exit(2); } fprintf(stdout, "----------------------------------------------------\n"); fprintf(stdout, " Please ignore error messages, if the result is OK.\n"); fprintf(stdout, "----------------------------------------------------\n"); config_file = argv[0]; exit_code = 0; setbuf(stdout, NULL); result = grpc_initialize(config_file); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_initialize() error. (%s)\n", grpc_error_string(result)); exit(2); } printf("cancel testing: "); ret = cancel_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); printf("cancel_all testing: "); ret = cancel_all_test(); printf(ret ? "\tOK\n" : "\tfailed\n"); exit_code = ((ret && (exit_code == 0)) ? 0 : 1); result = grpc_finalize(); if (result != GRPC_NO_ERROR) { fprintf(stderr, "grpc_finalize() error. (%s)\n", grpc_error_string(result)); exit(2); } return exit_code; }