Convert over the rest of the unit tests to dynamically open components
(oops -- didn't realize there were so many that needed it) This commit was SVN r5223.
Этот коммит содержится в:
родитель
33dbd9585d
Коммит
2d802bafab
@ -14,7 +14,6 @@
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
|
||||
#include "orte_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@ -27,11 +26,13 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "support.h"
|
||||
#include "components.h"
|
||||
|
||||
#include "include/constants.h"
|
||||
#include "include/orte_constants.h"
|
||||
#include "include/orte_types.h"
|
||||
|
||||
#include "support.h"
|
||||
#include "runtime/runtime.h"
|
||||
#include "util/proc_info.h"
|
||||
#include "mca/base/base.h"
|
||||
@ -41,10 +42,15 @@
|
||||
static bool test1(void); /* verify different buffer inits */
|
||||
static bool test2(void); /* verify int16 */
|
||||
|
||||
FILE *test_out;
|
||||
static FILE *test_out;
|
||||
static mca_ns_base_module_t *ns_module = NULL;
|
||||
|
||||
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
test_component_handle_t ns_handle;
|
||||
mca_ns_base_component_t *ns_component = NULL;
|
||||
int priority;
|
||||
|
||||
test_init("orte_ns_nds");
|
||||
test_out = stderr;
|
||||
@ -53,12 +59,13 @@ int main (int argc, char* argv[])
|
||||
if (!ompi_output_init()) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If threads are supported - assume that we are using threads - and reset otherwise.
|
||||
* If threads are supported - assume that we are using threads -
|
||||
* and reset otherwise.
|
||||
*/
|
||||
ompi_set_using_threads(OMPI_HAVE_THREAD_SUPPORT);
|
||||
|
||||
|
||||
/* For malloc debugging */
|
||||
ompi_malloc_init();
|
||||
|
||||
@ -67,7 +74,7 @@ int main (int argc, char* argv[])
|
||||
|
||||
/* ensure the replica is isolated */
|
||||
setenv("OMPI_MCA_ns_replica_isolate", "1", 1);
|
||||
|
||||
|
||||
/* init the proc info structure */
|
||||
orte_proc_info();
|
||||
|
||||
@ -77,21 +84,16 @@ int main (int argc, char* argv[])
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* startup the name services */
|
||||
if (OMPI_SUCCESS != orte_ns_base_open()) {
|
||||
fprintf(stderr, "can't open name services\n");
|
||||
exit (1);
|
||||
/* Open the ns replica component and initialize a module */
|
||||
if (OMPI_SUCCESS !=
|
||||
test_component_open("ns", "replica", &ns_handle,
|
||||
(mca_base_component_t**) &ns_component) ||
|
||||
NULL == ns_component) {
|
||||
test_fail_stop("Could not open ns replica\n", 1);
|
||||
}
|
||||
|
||||
/* startup the name server */
|
||||
if (OMPI_SUCCESS != orte_ns_base_select()) {
|
||||
fprintf(test_out, "NS could not start\n");
|
||||
test_failure("test_ns_replica mca_ns_base_select failed");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(test_out, "NS started\n");
|
||||
test_success();
|
||||
ns_module = ns_component->ns_init(&priority);
|
||||
if (NULL == ns_module) {
|
||||
test_fail_stop("NS replica component did not return a module\n", 1);
|
||||
}
|
||||
|
||||
fprintf(test_out, "executing test1\n");
|
||||
@ -111,7 +113,11 @@ int main (int argc, char* argv[])
|
||||
}
|
||||
|
||||
/* finalize and see if memory cleared */
|
||||
orte_ns_base_close();
|
||||
if (NULL != ns_component->ns_finalize) {
|
||||
ns_component->ns_finalize();
|
||||
}
|
||||
test_component_close(&ns_handle);
|
||||
|
||||
orte_proc_info_finalize();
|
||||
mca_base_close();
|
||||
ompi_malloc_finalize();
|
||||
@ -130,7 +136,7 @@ static bool test1(void) /* check seed/singleton name discovery */
|
||||
|
||||
orte_process_info.seed = true;
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.set_my_name())) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->set_my_name())) {
|
||||
test_comment("set_my_name failed for seed/singleton case");
|
||||
fprintf(test_out, "set_my_name failed for seed/singleton case with return %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
@ -143,7 +149,7 @@ static bool test1(void) /* check seed/singleton name discovery */
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 != orte_ns.compare(ORTE_NS_CMP_ALL, orte_process_info.my_name, &seed)) {
|
||||
if (0 != ns_module->compare(ORTE_NS_CMP_ALL, orte_process_info.my_name, &seed)) {
|
||||
test_comment("name_discovery failed for seed/singleton case - name mismatch");
|
||||
fprintf(test_out, "name_discovery failed for seed/singleton case - name mismatch\n");
|
||||
return false;
|
||||
@ -166,7 +172,7 @@ static bool test2(void)
|
||||
}
|
||||
|
||||
orte_process_info.seed = false;
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.copy_process_name(&orte_process_info.ns_replica, &dummy))) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->copy_process_name(&orte_process_info.ns_replica, &dummy))) {
|
||||
test_comment("unable to copy name");
|
||||
fprintf(test_out, "unable to copy name with return %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
@ -180,7 +186,7 @@ static bool test2(void)
|
||||
setenv("OMPI_MCA_ns_nds_vpid_start", "0", 1);
|
||||
setenv("OMPI_MCA_ns_nds_num_procs", "100000", 1);
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.set_my_name())) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->set_my_name())) {
|
||||
test_comment("set_my_name failed for env case");
|
||||
fprintf(test_out, "set_my_name failed for env case with return %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
@ -193,7 +199,7 @@ static bool test2(void)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (0 != orte_ns.compare(ORTE_NS_CMP_ALL, orte_process_info.my_name, &dummy)) {
|
||||
if (0 != ns_module->compare(ORTE_NS_CMP_ALL, orte_process_info.my_name, &dummy)) {
|
||||
test_comment("name_discovery failed for env case - name mismatch");
|
||||
fprintf(test_out, "name_discovery failed for env case - name mismatch\n");
|
||||
return false;
|
||||
|
@ -1,19 +1,25 @@
|
||||
/*
|
||||
* unit test for name server replica.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Authors: Ralph H. Castain <rhc@lanl.gov>
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
*/
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "support.h"
|
||||
#include "components.h"
|
||||
|
||||
#include "include/orte_constants.h"
|
||||
#include "include/orte_schema.h"
|
||||
@ -35,6 +41,10 @@ int main(int argc, char **argv)
|
||||
orte_vpid_t vpid;
|
||||
int i, j, rc;
|
||||
char *tmp;
|
||||
test_component_handle_t ns_handle;
|
||||
mca_ns_base_component_t *ns_component = NULL;
|
||||
mca_ns_base_module_t *ns_module = NULL;
|
||||
int priority;
|
||||
|
||||
test_init("test_ns_replica");
|
||||
|
||||
@ -49,12 +59,13 @@ int main(int argc, char **argv)
|
||||
if (!ompi_output_init()) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If threads are supported - assume that we are using threads - and reset otherwise.
|
||||
* If threads are supported - assume that we are using threads -
|
||||
* and reset otherwise.
|
||||
*/
|
||||
ompi_set_using_threads(OMPI_HAVE_THREAD_SUPPORT);
|
||||
|
||||
|
||||
/* For malloc debugging */
|
||||
ompi_malloc_init();
|
||||
|
||||
@ -75,30 +86,20 @@ int main(int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* open the name server */
|
||||
if (OMPI_SUCCESS == orte_ns_base_open()) {
|
||||
fprintf(test_out, "NS opened\n");
|
||||
test_success();
|
||||
} else {
|
||||
fprintf(test_out, "NS could not open\n");
|
||||
test_failure("test_ns_replica mca_ns_base_open failed");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
/* Open the ns replica component and initialize a module */
|
||||
if (OMPI_SUCCESS !=
|
||||
test_component_open("ns", "replica", &ns_handle,
|
||||
(mca_base_component_t**) &ns_component) ||
|
||||
NULL == ns_component) {
|
||||
test_fail_stop("Could not open ns replica\n", 1);
|
||||
}
|
||||
|
||||
/* startup the name server */
|
||||
if (OMPI_SUCCESS != orte_ns_base_select()) {
|
||||
fprintf(test_out, "NS could not start\n");
|
||||
test_failure("test_ns_replica mca_ns_base_select failed");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(test_out, "NS started\n");
|
||||
test_success();
|
||||
ns_module = ns_component->ns_init(&priority);
|
||||
if (NULL == ns_module) {
|
||||
test_fail_stop("NS replica component did not return a module\n", 1);
|
||||
}
|
||||
|
||||
/* create a name */
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.create_process_name(&test_name, 0, 1, 1))) { /* got error */
|
||||
if (ORTE_SUCCESS != (rc = ns_module->create_process_name(&test_name, 0, 1, 1))) { /* got error */
|
||||
fprintf(test_out, "create process name failed with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica orte_ns create_process_name failed");
|
||||
@ -112,7 +113,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* convert a string to a name */
|
||||
tmp = strdup("1234.5678.9AEF");
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.convert_string_to_process_name(&test_name, tmp))) { /* got error */
|
||||
if (ORTE_SUCCESS != (rc = ns_module->convert_string_to_process_name(&test_name, tmp))) { /* got error */
|
||||
fprintf(test_out, "convert string to process name failed with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica orte_ns convert_string_to_process_name failed");
|
||||
@ -127,7 +128,7 @@ int main(int argc, char **argv)
|
||||
free(test_name);
|
||||
|
||||
/* create a cellid */
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.create_cellid(&cell))) { /* got error */
|
||||
if (ORTE_SUCCESS != (rc = ns_module->create_cellid(&cell))) { /* got error */
|
||||
test_failure("test_ns_replica orte_ns test create_cellid failed");
|
||||
fprintf(test_out, "create cellid: error with error %s\n", ORTE_ERROR_NAME(rc));
|
||||
test_finalize();
|
||||
@ -139,7 +140,7 @@ int main(int argc, char **argv)
|
||||
|
||||
for (i=0; i<10; i++) { /* loop through */
|
||||
/* create jobid */
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.create_jobid(&job))) { /* got error */
|
||||
if (ORTE_SUCCESS != (rc = ns_module->create_jobid(&job))) { /* got error */
|
||||
fprintf(test_out, "create jobid: error with error %s\n", ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica orte_ns create_jobid failed");
|
||||
test_finalize();
|
||||
@ -151,7 +152,7 @@ int main(int argc, char **argv)
|
||||
|
||||
for (j=0; j<5; j++) { /* loop through several vpid ranges */
|
||||
/* get range of vpids */
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.reserve_range(job, 250, &vpid))) { /* got error */
|
||||
if (ORTE_SUCCESS != (rc = ns_module->reserve_range(job, 250, &vpid))) { /* got error */
|
||||
fprintf(test_out, "get range: error with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica orte_ns reserve_range failed");
|
||||
@ -163,7 +164,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* create a name */
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.create_process_name(&test_name, (orte_cellid_t)i,
|
||||
if (ORTE_SUCCESS != (rc = ns_module->create_process_name(&test_name, (orte_cellid_t)i,
|
||||
job, vpid))) {
|
||||
fprintf(test_out, "test_ns_replica: failed to create proc name after vpid range with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
@ -173,7 +174,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* get and print its string values */
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.get_proc_name_string(&tmp, test_name))) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->get_proc_name_string(&tmp, test_name))) {
|
||||
fprintf(test_out, "test_ns_replica: failed to get proc_name_string with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica: failed to get proc_name_string");
|
||||
@ -183,7 +184,7 @@ int main(int argc, char **argv)
|
||||
fprintf(test_out, "(%d) strings: name - %s\n", i, tmp);
|
||||
}
|
||||
free(tmp);
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.get_vpid_string(&tmp, test_name))) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->get_vpid_string(&tmp, test_name))) {
|
||||
fprintf(test_out, "test_ns_replica: failed to get vpid_string with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica: failed to get vpid_string");
|
||||
@ -193,7 +194,7 @@ int main(int argc, char **argv)
|
||||
fprintf(test_out, "(%d) strings: vpid - %s\n", i, tmp);
|
||||
}
|
||||
free(tmp);
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.get_jobid_string(&tmp, test_name))) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->get_jobid_string(&tmp, test_name))) {
|
||||
fprintf(test_out, "test_ns_replica: failed to get jobid_string with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica: failed to get jobid_string");
|
||||
@ -203,7 +204,7 @@ int main(int argc, char **argv)
|
||||
fprintf(test_out, "(%d) strings: jobid - %s\n", i, tmp);
|
||||
}
|
||||
free(tmp);
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.get_cellid_string(&tmp, test_name))) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->get_cellid_string(&tmp, test_name))) {
|
||||
fprintf(test_out, "test_ns_replica: failed to get cellid_string with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica: failed to get cellid_string");
|
||||
@ -215,21 +216,21 @@ int main(int argc, char **argv)
|
||||
free(tmp);
|
||||
|
||||
/* get and print its numeric values */
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.get_vpid(&vpid, test_name))) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->get_vpid(&vpid, test_name))) {
|
||||
fprintf(test_out, "test_ns_replica: failed to get vpid with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica: failed to get vpid");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
}
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.get_jobid(&job, test_name))) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->get_jobid(&job, test_name))) {
|
||||
fprintf(test_out, "test_ns_replica: failed to get jobid with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica: failed to get jobid");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
}
|
||||
if (ORTE_SUCCESS != (rc = orte_ns.get_cellid(&cell, test_name))) {
|
||||
if (ORTE_SUCCESS != (rc = ns_module->get_cellid(&cell, test_name))) {
|
||||
fprintf(test_out, "test_ns_replica: failed to get cellid with error %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_ns_replica: failed to get cellid");
|
||||
@ -243,7 +244,11 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* finalize and see if memory cleared */
|
||||
orte_ns_base_close();
|
||||
if (NULL != ns_component->ns_finalize) {
|
||||
ns_component->ns_finalize();
|
||||
}
|
||||
test_component_close(&ns_handle);
|
||||
|
||||
orte_proc_info_finalize();
|
||||
mca_base_close();
|
||||
ompi_malloc_finalize();
|
||||
|
@ -1,19 +1,25 @@
|
||||
/*
|
||||
* unit test for RDS resource file parser
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Authors: Ralph H. Castain <rhc@lanl.gov>
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
*/
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "support.h"
|
||||
#include "components.h"
|
||||
|
||||
#include "include/orte_constants.h"
|
||||
|
||||
@ -23,7 +29,7 @@
|
||||
#include "util/sys_info.h"
|
||||
|
||||
#include "mca/gpr/base/base.h"
|
||||
#include "mca/rds/base/base.h"
|
||||
#include "mca/ras/base/base.h"
|
||||
|
||||
/* output files needed by the test */
|
||||
static FILE *test_out=NULL;
|
||||
@ -35,16 +41,24 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
bool allow, have;
|
||||
int priority;
|
||||
test_component_handle_t gpr_handle;
|
||||
mca_gpr_base_component_t *gpr_component = NULL;
|
||||
orte_gpr_base_module_t *gpr_module = NULL;
|
||||
test_component_handle_t ras_handle;
|
||||
orte_ras_base_component_t *ras_component = NULL;
|
||||
orte_ras_base_module_t *ras_module = NULL;
|
||||
|
||||
test_init("test_rds_fn");
|
||||
test_init("test_ras_fn");
|
||||
|
||||
if (getenv("TEST_WRITE_TO_FILE") != NULL) {
|
||||
test_out = fopen( "test_rds_fn", "w+" );
|
||||
test_out = fopen( "test_ras_fn", "w+" );
|
||||
} else {
|
||||
test_out = stderr;
|
||||
}
|
||||
if( test_out == NULL ) {
|
||||
test_failure("rds_fn couldn't open test file failed");
|
||||
test_failure("ras_fn couldn't open test file failed");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
}
|
||||
@ -56,12 +70,13 @@ main(int argc, char **argv)
|
||||
if (!ompi_output_init()) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If threads are supported - assume that we are using threads - and reset otherwise.
|
||||
* If threads are supported - assume that we are using threads -
|
||||
* and reset otherwise.
|
||||
*/
|
||||
ompi_set_using_threads(OMPI_HAVE_THREAD_SUPPORT);
|
||||
|
||||
|
||||
/* For malloc debugging */
|
||||
ompi_malloc_init();
|
||||
|
||||
@ -90,20 +105,20 @@ main(int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS == orte_gpr_base_open()) {
|
||||
fprintf(test_out, "GPR started\n");
|
||||
} else {
|
||||
fprintf(test_out, "GPR could not start\n");
|
||||
exit (1);
|
||||
/* Open the gpr replica component and initialize a module */
|
||||
if (OMPI_SUCCESS !=
|
||||
test_component_open("gpr", "replica", &gpr_handle,
|
||||
(mca_base_component_t**) &gpr_component) ||
|
||||
NULL == gpr_component) {
|
||||
test_fail_stop("Could not open GPR replica\n", 1);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS == orte_gpr_base_select()) {
|
||||
fprintf(test_out, "GPR replica selected\n");
|
||||
} else {
|
||||
fprintf(test_out, "GPR replica could not be selected\n");
|
||||
exit (1);
|
||||
gpr_module = gpr_component->gpr_init(&allow, &have, &priority);
|
||||
if (NULL == gpr_module) {
|
||||
test_fail_stop("GPR replica component did not return a module\n", 1);
|
||||
}
|
||||
|
||||
fprintf(test_out, "GPR replica started\n");
|
||||
|
||||
/* dps */
|
||||
if (ORTE_SUCCESS == orte_dps_open()) {
|
||||
fprintf(test_out, "DPS started\n");
|
||||
} else {
|
||||
@ -111,37 +126,33 @@ main(int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* setup the RDS */
|
||||
if (ORTE_SUCCESS == orte_rds_base_open()) {
|
||||
fprintf(test_out, "RDS started\n");
|
||||
} else {
|
||||
fprintf(test_out, "RDS could not start\n");
|
||||
exit (1);
|
||||
/* setup the ras */
|
||||
if (OMPI_SUCCESS !=
|
||||
test_component_open("ras", "host", &ras_handle,
|
||||
(mca_base_component_t**) &ras_component) ||
|
||||
NULL == ras_component) {
|
||||
test_fail_stop("Could not open ras host component\n", 1);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS == orte_rds_base_select()) {
|
||||
fprintf(test_out, "RDS selected\n");
|
||||
} else {
|
||||
fprintf(test_out, "RDS could not be selected\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* run the query */
|
||||
if (ORTE_SUCCESS != (rc = orte_rds_base_query())) {
|
||||
fprintf(test_out, "RDS query failed with code %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_rds_fn rds_query failed");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(test_out, "RDS query succeeded\n");
|
||||
test_success();
|
||||
ras_module = ras_component->ras_init(&priority);
|
||||
if (NULL == ras_module) {
|
||||
test_fail_stop("ras host component did not return a module\n", 1);
|
||||
}
|
||||
fprintf(test_out, "RAS host component started\n");
|
||||
|
||||
fprintf(stderr, "now finalize and see if all memory cleared\n");
|
||||
orte_rds_base_close();
|
||||
|
||||
if (NULL != ras_module->finalize) {
|
||||
ras_module->finalize();
|
||||
}
|
||||
test_component_close(&ras_handle);
|
||||
|
||||
orte_dps_close();
|
||||
orte_gpr_base_close();
|
||||
|
||||
if (NULL != gpr_component->gpr_finalize) {
|
||||
gpr_component->gpr_finalize();
|
||||
}
|
||||
test_component_close(&gpr_handle);
|
||||
|
||||
orte_sys_info_finalize();
|
||||
orte_proc_info_finalize();
|
||||
mca_base_close();
|
||||
@ -155,7 +166,7 @@ main(int argc, char **argv)
|
||||
test_success();
|
||||
}
|
||||
else {
|
||||
test_failure( "test_rds failed");
|
||||
test_failure( "test_ras failed");
|
||||
}
|
||||
*/
|
||||
test_finalize();
|
||||
|
@ -1,19 +1,25 @@
|
||||
/*
|
||||
* unit test for RDS resource file parser
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Authors: Ralph H. Castain <rhc@lanl.gov>
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
*/
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "support.h"
|
||||
#include "components.h"
|
||||
|
||||
#include "include/orte_constants.h"
|
||||
|
||||
@ -35,6 +41,14 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
bool allow, have;
|
||||
int priority;
|
||||
test_component_handle_t gpr_handle;
|
||||
mca_gpr_base_component_t *gpr_component = NULL;
|
||||
orte_gpr_base_module_t *gpr_module = NULL;
|
||||
test_component_handle_t rds_handle;
|
||||
orte_rds_base_component_t *rds_component = NULL;
|
||||
orte_rds_base_module_t *rds_module = NULL;
|
||||
|
||||
test_init("test_rds_fn");
|
||||
|
||||
@ -56,12 +70,13 @@ main(int argc, char **argv)
|
||||
if (!ompi_output_init()) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If threads are supported - assume that we are using threads - and reset otherwise.
|
||||
* If threads are supported - assume that we are using threads -
|
||||
* and reset otherwise.
|
||||
*/
|
||||
ompi_set_using_threads(OMPI_HAVE_THREAD_SUPPORT);
|
||||
|
||||
|
||||
/* For malloc debugging */
|
||||
ompi_malloc_init();
|
||||
|
||||
@ -90,58 +105,52 @@ main(int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS == orte_gpr_base_open()) {
|
||||
fprintf(test_out, "GPR started\n");
|
||||
} else {
|
||||
fprintf(test_out, "GPR could not start\n");
|
||||
exit (1);
|
||||
/* Open the gpr replica component and initialize a module */
|
||||
if (OMPI_SUCCESS !=
|
||||
test_component_open("gpr", "replica", &gpr_handle,
|
||||
(mca_base_component_t**) &gpr_component) ||
|
||||
NULL == gpr_component) {
|
||||
test_fail_stop("Could not open GPR replica\n", 1);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS == orte_gpr_base_select()) {
|
||||
fprintf(test_out, "GPR replica selected\n");
|
||||
} else {
|
||||
fprintf(test_out, "GPR replica could not be selected\n");
|
||||
exit (1);
|
||||
gpr_module = gpr_component->gpr_init(&allow, &have, &priority);
|
||||
if (NULL == gpr_module) {
|
||||
test_fail_stop("GPR replica did not return a component\n", 1);
|
||||
}
|
||||
|
||||
fprintf(test_out, "GPR replica started\n");
|
||||
|
||||
if (ORTE_SUCCESS == orte_dps_open()) {
|
||||
fprintf(test_out, "DPS started\n");
|
||||
} else {
|
||||
fprintf(test_out, "DPS could not start\n");
|
||||
exit (1);
|
||||
test_fail_stop("DPS could not start\n", 1);
|
||||
}
|
||||
|
||||
/* setup the RDS */
|
||||
if (ORTE_SUCCESS == orte_rds_base_open()) {
|
||||
fprintf(test_out, "RDS started\n");
|
||||
} else {
|
||||
fprintf(test_out, "RDS could not start\n");
|
||||
exit (1);
|
||||
if (OMPI_SUCCESS !=
|
||||
test_component_open("rds", "hostfile", &rds_handle,
|
||||
(mca_base_component_t**) &rds_component) ||
|
||||
NULL == rds_component) {
|
||||
test_fail_stop("Could not open rds hostfile\n", 1);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS == orte_rds_base_select()) {
|
||||
fprintf(test_out, "RDS selected\n");
|
||||
} else {
|
||||
fprintf(test_out, "RDS could not be selected\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* run the query */
|
||||
if (ORTE_SUCCESS != (rc = orte_rds_base_query())) {
|
||||
fprintf(test_out, "RDS query failed with code %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_rds_fn rds_query failed");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(test_out, "RDS query succeeded\n");
|
||||
test_success();
|
||||
rds_module = rds_component->rds_init();
|
||||
if (NULL == rds_module) {
|
||||
test_fail_stop("rds hostfile component did not return a module\n", 1);
|
||||
}
|
||||
fprintf(test_out, "RDS host component started\n");
|
||||
|
||||
fprintf(stderr, "now finalize and see if all memory cleared\n");
|
||||
orte_rds_base_close();
|
||||
|
||||
if (NULL != rds_module->finalize) {
|
||||
rds_module->finalize();
|
||||
}
|
||||
test_component_close(&rds_handle);
|
||||
|
||||
orte_dps_close();
|
||||
orte_gpr_base_close();
|
||||
|
||||
if (NULL != gpr_component->gpr_finalize) {
|
||||
gpr_component->gpr_finalize();
|
||||
}
|
||||
test_component_close(&gpr_handle);
|
||||
|
||||
orte_sys_info_finalize();
|
||||
orte_proc_info_finalize();
|
||||
mca_base_close();
|
||||
|
@ -1,19 +1,25 @@
|
||||
/*
|
||||
* unit test for RDS resource file parser
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Authors: Ralph H. Castain <rhc@lanl.gov>
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
*/
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "orte_config.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "support.h"
|
||||
#include "components.h"
|
||||
|
||||
#include "include/orte_constants.h"
|
||||
|
||||
@ -23,7 +29,7 @@
|
||||
#include "util/sys_info.h"
|
||||
|
||||
#include "mca/gpr/base/base.h"
|
||||
#include "mca/rds/base/base.h"
|
||||
#include "mca/rmaps/base/base.h"
|
||||
|
||||
/* output files needed by the test */
|
||||
static FILE *test_out=NULL;
|
||||
@ -35,16 +41,24 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int rc;
|
||||
bool allow, have;
|
||||
int priority;
|
||||
test_component_handle_t gpr_handle;
|
||||
mca_gpr_base_component_t *gpr_component = NULL;
|
||||
orte_gpr_base_module_t *gpr_module = NULL;
|
||||
test_component_handle_t rmaps_handle;
|
||||
orte_rmaps_base_component_t *rmaps_component = NULL;
|
||||
orte_rmaps_base_module_t *rmaps_module = NULL;
|
||||
|
||||
test_init("test_rds_fn");
|
||||
test_init("test_rmaps_fn");
|
||||
|
||||
if (getenv("TEST_WRITE_TO_FILE") != NULL) {
|
||||
test_out = fopen( "test_rds_fn", "w+" );
|
||||
test_out = fopen( "test_rmaps_fn", "w+" );
|
||||
} else {
|
||||
test_out = stderr;
|
||||
}
|
||||
if( test_out == NULL ) {
|
||||
test_failure("rds_fn couldn't open test file failed");
|
||||
test_failure("rmaps_fn couldn't open test file failed");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
}
|
||||
@ -56,12 +70,13 @@ main(int argc, char **argv)
|
||||
if (!ompi_output_init()) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If threads are supported - assume that we are using threads - and reset otherwise.
|
||||
* If threads are supported - assume that we are using threads -
|
||||
* and reset otherwise.
|
||||
*/
|
||||
ompi_set_using_threads(OMPI_HAVE_THREAD_SUPPORT);
|
||||
|
||||
|
||||
/* For malloc debugging */
|
||||
ompi_malloc_init();
|
||||
|
||||
@ -90,20 +105,20 @@ main(int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS == orte_gpr_base_open()) {
|
||||
fprintf(test_out, "GPR started\n");
|
||||
} else {
|
||||
fprintf(test_out, "GPR could not start\n");
|
||||
exit (1);
|
||||
/* Open the gpr replica component and initialize a module */
|
||||
if (OMPI_SUCCESS !=
|
||||
test_component_open("gpr", "replica", &gpr_handle,
|
||||
(mca_base_component_t**) &gpr_component) ||
|
||||
NULL == gpr_component) {
|
||||
test_fail_stop("Could not open replica\n", 1);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS == orte_gpr_base_select()) {
|
||||
fprintf(test_out, "GPR replica selected\n");
|
||||
} else {
|
||||
fprintf(test_out, "GPR replica could not be selected\n");
|
||||
exit (1);
|
||||
gpr_module = gpr_component->gpr_init(&allow, &have, &priority);
|
||||
if (NULL == gpr_module) {
|
||||
test_fail_stop("replica component did not return a module\n", 1);
|
||||
}
|
||||
|
||||
fprintf(test_out, "GPR replica started\n");
|
||||
|
||||
/* dps */
|
||||
if (ORTE_SUCCESS == orte_dps_open()) {
|
||||
fprintf(test_out, "DPS started\n");
|
||||
} else {
|
||||
@ -111,37 +126,33 @@ main(int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* setup the RDS */
|
||||
if (ORTE_SUCCESS == orte_rds_base_open()) {
|
||||
fprintf(test_out, "RDS started\n");
|
||||
} else {
|
||||
fprintf(test_out, "RDS could not start\n");
|
||||
exit (1);
|
||||
/* setup the RMAPS */
|
||||
if (OMPI_SUCCESS !=
|
||||
test_component_open("rmaps", "round_robin", &rmaps_handle,
|
||||
(mca_base_component_t**) &rmaps_component) ||
|
||||
NULL == rmaps_component) {
|
||||
test_fail_stop("Could not open rmaps round_robin component\n", 1);
|
||||
}
|
||||
|
||||
if (ORTE_SUCCESS == orte_rds_base_select()) {
|
||||
fprintf(test_out, "RDS selected\n");
|
||||
} else {
|
||||
fprintf(test_out, "RDS could not be selected\n");
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/* run the query */
|
||||
if (ORTE_SUCCESS != (rc = orte_rds_base_query())) {
|
||||
fprintf(test_out, "RDS query failed with code %s\n",
|
||||
ORTE_ERROR_NAME(rc));
|
||||
test_failure("test_rds_fn rds_query failed");
|
||||
test_finalize();
|
||||
exit(1);
|
||||
} else {
|
||||
fprintf(test_out, "RDS query succeeded\n");
|
||||
test_success();
|
||||
rmaps_module = rmaps_component->rmaps_init(&priority);
|
||||
if (NULL == rmaps_module) {
|
||||
test_fail_stop("rmaps round_robin component did not return a module\n", 1);
|
||||
}
|
||||
fprintf(test_out, "RMAPS host component started\n");
|
||||
|
||||
fprintf(stderr, "now finalize and see if all memory cleared\n");
|
||||
orte_rds_base_close();
|
||||
|
||||
if (NULL != rmaps_module->finalize) {
|
||||
rmaps_module->finalize();
|
||||
}
|
||||
test_component_close(&rmaps_handle);
|
||||
|
||||
orte_dps_close();
|
||||
orte_gpr_base_close();
|
||||
|
||||
if (NULL != gpr_component->gpr_finalize) {
|
||||
gpr_component->gpr_finalize();
|
||||
}
|
||||
test_component_close(&gpr_handle);
|
||||
|
||||
orte_sys_info_finalize();
|
||||
orte_proc_info_finalize();
|
||||
mca_base_close();
|
||||
@ -155,7 +166,7 @@ main(int argc, char **argv)
|
||||
test_success();
|
||||
}
|
||||
else {
|
||||
test_failure( "test_rds failed");
|
||||
test_failure( "test_rmaps failed");
|
||||
}
|
||||
*/
|
||||
test_finalize();
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user