2004-05-26 06:20:05 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-05-26 06:20:05 +04:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-10-20 05:03:09 +04:00
|
|
|
#include "ompi_config.h"
|
2004-05-26 06:20:05 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2004-10-20 05:03:09 +04:00
|
|
|
#ifdef HAVE_SYS_PARAM_H
|
2004-05-26 06:20:05 +04:00
|
|
|
#include <sys/param.h>
|
2004-10-20 05:03:09 +04:00
|
|
|
#endif
|
2004-05-26 06:20:05 +04:00
|
|
|
|
2006-02-12 22:51:24 +03:00
|
|
|
#include "orte/util/sys_info.h"
|
2004-08-10 01:47:27 +04:00
|
|
|
#include "support.h"
|
2004-05-26 06:20:05 +04:00
|
|
|
|
|
|
|
static bool test1(void); /* verify it returns info */
|
|
|
|
static bool test2(void); /* test second time through */
|
|
|
|
|
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
|
2005-03-29 23:58:32 +04:00
|
|
|
test_init("orte_sys_info_t");
|
2004-05-26 06:20:05 +04:00
|
|
|
|
|
|
|
if (test1()) {
|
2004-08-10 01:47:27 +04:00
|
|
|
test_success();
|
|
|
|
}
|
|
|
|
else {
|
2005-03-29 23:58:32 +04:00
|
|
|
test_failure("orte_sys_info_t test1 failed");
|
2004-05-26 06:20:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (test2()) {
|
2004-08-10 01:47:27 +04:00
|
|
|
test_success();
|
2004-05-26 06:20:05 +04:00
|
|
|
}
|
2004-08-10 01:47:27 +04:00
|
|
|
else {
|
2005-03-29 23:58:32 +04:00
|
|
|
test_failure("orte_sys_info_t test2 failed");
|
2004-05-26 06:20:05 +04:00
|
|
|
}
|
|
|
|
|
2004-08-10 01:47:27 +04:00
|
|
|
test_finalize();
|
|
|
|
return 0;
|
2004-05-26 06:20:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool test1(void)
|
|
|
|
{
|
|
|
|
/* Test trivial functionality. Program should return with init=true and all ptrs non-NULL */
|
|
|
|
|
2005-03-29 23:58:32 +04:00
|
|
|
orte_sys_info();
|
|
|
|
if (orte_system_info.init == false)
|
2004-05-26 06:20:05 +04:00
|
|
|
return(false);
|
|
|
|
|
2005-03-29 23:58:32 +04:00
|
|
|
if (orte_system_info.sysname == NULL ||
|
|
|
|
orte_system_info.nodename == NULL ||
|
|
|
|
orte_system_info.release == NULL ||
|
|
|
|
orte_system_info.version == NULL ||
|
|
|
|
orte_system_info.machine == NULL ||
|
2006-08-24 20:17:33 +04:00
|
|
|
orte_system_info.user == NULL)
|
2004-05-26 06:20:05 +04:00
|
|
|
return(false);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static bool test2(void)
|
|
|
|
{
|
|
|
|
/* test it a second time. system should return without crashing and with init=true */
|
2005-03-29 23:58:32 +04:00
|
|
|
orte_sys_info();
|
|
|
|
return(orte_system_info.init);
|
2004-05-26 06:20:05 +04:00
|
|
|
}
|