s/ompi/opal/g throughout the file, because this is really an OPAL
test, not an OMPI test. Also fix a case where if you haven't run "make install", then opal_show_help_string() will (rightfully) return NULL. So be sure to handle that case and not segv. This commit was SVN r23522.
Этот коммит содержится в:
родитель
ce186723a7
Коммит
953e2ace35
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -16,7 +17,7 @@
|
|||||||
* $HEADER$
|
* $HEADER$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ompi_config.h"
|
#include "opal_config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -43,7 +44,6 @@
|
|||||||
#include "opal/util/output.h"
|
#include "opal/util/output.h"
|
||||||
#include "orte/runtime/runtime.h"
|
#include "orte/runtime/runtime.h"
|
||||||
#include "orte/constants.h"
|
#include "orte/constants.h"
|
||||||
#include "ompi/constants.h"
|
|
||||||
|
|
||||||
static bool opal_sos_test(void);
|
static bool opal_sos_test(void);
|
||||||
|
|
||||||
@ -66,30 +66,30 @@ static bool opal_sos_test(void)
|
|||||||
|
|
||||||
/* Checking for the correctness of GET_ and SET_ error code
|
/* Checking for the correctness of GET_ and SET_ error code
|
||||||
* operations */
|
* operations */
|
||||||
errnum1 = OPAL_SOS_GET_ERROR_CODE(OMPI_ERR_OUT_OF_RESOURCE);
|
errnum1 = OPAL_SOS_GET_ERROR_CODE(OPAL_ERR_OUT_OF_RESOURCE);
|
||||||
test_verify("failed", OMPI_ERR_OUT_OF_RESOURCE == errnum1);
|
test_verify("failed", OPAL_ERR_OUT_OF_RESOURCE == errnum1);
|
||||||
|
|
||||||
OPAL_SOS_SET_ERROR_CODE(errnum1, OMPI_ERR_IN_ERRNO);
|
OPAL_SOS_SET_ERROR_CODE(errnum1, OPAL_ERR_IN_ERRNO);
|
||||||
test_verify("failed", OMPI_ERR_IN_ERRNO ==
|
test_verify("failed", OPAL_ERR_IN_ERRNO ==
|
||||||
OPAL_SOS_GET_ERROR_CODE(errnum1));
|
OPAL_SOS_GET_ERROR_CODE(errnum1));
|
||||||
|
|
||||||
/* Check if OMPI_ERR_OUT_OF_RESOURCE is a native error code or
|
/* Check if OPAL_ERR_OUT_OF_RESOURCE is a native error code or
|
||||||
* not. Since OMPI_ERR_OUT_OF_RESOURCE is native, this should
|
* not. Since OPAL_ERR_OUT_OF_RESOURCE is native, this should
|
||||||
* return true. */
|
* return true. */
|
||||||
test_verify("failed", true ==
|
test_verify("failed", true ==
|
||||||
OPAL_SOS_IS_NATIVE(OMPI_ERR_OUT_OF_RESOURCE));
|
OPAL_SOS_IS_NATIVE(OPAL_ERR_OUT_OF_RESOURCE));
|
||||||
|
|
||||||
test_verify("failed", true == OPAL_SOS_IS_NATIVE(errnum1));
|
test_verify("failed", true == OPAL_SOS_IS_NATIVE(errnum1));
|
||||||
|
|
||||||
/* Encode a native error (OMPI_ERR_OUT_OF_RESOURCE) by
|
/* Encode a native error (OPAL_ERR_OUT_OF_RESOURCE) by
|
||||||
* logging it in the SOS framework using one of the SOS
|
* logging it in the SOS framework using one of the SOS
|
||||||
* reporter macros. This returns an encoded error code
|
* reporter macros. This returns an encoded error code
|
||||||
* (errnum1) with information about the native error such
|
* (errnum1) with information about the native error such
|
||||||
* as the severity, the native error code, the attached
|
* as the severity, the native error code, the attached
|
||||||
* error index etc. */
|
* error index etc. */
|
||||||
errnum1 = OPAL_SOS_INFO((OMPI_ERR_OUT_OF_RESOURCE, false,
|
errnum1 = OPAL_SOS_INFO((OPAL_ERR_OUT_OF_RESOURCE, false,
|
||||||
"Error %d: out of resource",
|
"Error %d: out of resource",
|
||||||
OMPI_ERR_OUT_OF_RESOURCE));
|
OPAL_ERR_OUT_OF_RESOURCE));
|
||||||
|
|
||||||
/* Check if errnum1 is native or not. This should return false */
|
/* Check if errnum1 is native or not. This should return false */
|
||||||
test_verify("failed", false == OPAL_SOS_IS_NATIVE(errnum1));
|
test_verify("failed", false == OPAL_SOS_IS_NATIVE(errnum1));
|
||||||
@ -98,8 +98,8 @@ static bool opal_sos_test(void)
|
|||||||
|
|
||||||
/* Extract the native error code out of errnum1. This should
|
/* Extract the native error code out of errnum1. This should
|
||||||
* return the encoded native error code associated with errnum1
|
* return the encoded native error code associated with errnum1
|
||||||
* (i.e. OMPI_ERR_OUT_OF_RESOURCE). */
|
* (i.e. OPAL_ERR_OUT_OF_RESOURCE). */
|
||||||
test_verify("failed", OMPI_ERR_OUT_OF_RESOURCE ==
|
test_verify("failed", OPAL_ERR_OUT_OF_RESOURCE ==
|
||||||
OPAL_SOS_GET_ERROR_CODE(errnum1));
|
OPAL_SOS_GET_ERROR_CODE(errnum1));
|
||||||
|
|
||||||
/* We log another error event as a child of the previous error
|
/* We log another error event as a child of the previous error
|
||||||
@ -110,26 +110,32 @@ static bool opal_sos_test(void)
|
|||||||
test_verify("failed",
|
test_verify("failed",
|
||||||
OPAL_SOS_SEVERITY_WARN == OPAL_SOS_GET_SEVERITY(errnum1));
|
OPAL_SOS_SEVERITY_WARN == OPAL_SOS_GET_SEVERITY(errnum1));
|
||||||
|
|
||||||
test_verify("failed", OMPI_ERR_OUT_OF_RESOURCE ==
|
test_verify("failed", OPAL_ERR_OUT_OF_RESOURCE ==
|
||||||
OPAL_SOS_GET_ERROR_CODE(errnum1));
|
OPAL_SOS_GET_ERROR_CODE(errnum1));
|
||||||
free(err_str);
|
free(err_str);
|
||||||
|
|
||||||
/* Let's report another event with severity ERROR using
|
/* Let's report another event with severity ERROR using
|
||||||
* OPAL_SOS_ERROR() and in effect promote errnum1 to
|
* OPAL_SOS_ERROR() and in effect promote errnum1 to
|
||||||
* severity 'ERROR'. */
|
* severity 'ERROR'. */
|
||||||
err_str = opal_show_help_string("help-opal-util.txt",
|
err_str = opal_show_help_string("help-opal-util.txt",
|
||||||
"stacktrace signal override",
|
"stacktrace signal override",
|
||||||
false, 10, 10, 10, "15");
|
false, 10, 10, 10, "15");
|
||||||
|
/* If OMPI isn't installed yet (which is quite likely/possible if
|
||||||
|
we're running "make check"!), then the show_help_string will
|
||||||
|
return NULL. So just put in any old string. */
|
||||||
|
if (NULL == err_str) {
|
||||||
|
err_str = strdup("Open MPI does not appear to be installed, so we'll just substitue in a random message to show during the opal_sos test. You can ignore the above warning about not finding the help message about 'stacktrace signal override'.");
|
||||||
|
}
|
||||||
errnum1 = OPAL_SOS_ERROR((errnum1, false, err_str));
|
errnum1 = OPAL_SOS_ERROR((errnum1, false, err_str));
|
||||||
test_verify("failed",
|
test_verify("failed",
|
||||||
OPAL_SOS_SEVERITY_ERROR == OPAL_SOS_GET_SEVERITY(errnum1));
|
OPAL_SOS_SEVERITY_ERROR == OPAL_SOS_GET_SEVERITY(errnum1));
|
||||||
free(err_str);
|
free(err_str);
|
||||||
|
|
||||||
/* Check the native code associated with the previously encoded
|
/* Check the native code associated with the previously encoded
|
||||||
* error. This should still return (OMPI_ERR_OUT_OF_RESOURCE)
|
* error. This should still return (OPAL_ERR_OUT_OF_RESOURCE)
|
||||||
* since the entire error history originates from the native
|
* since the entire error history originates from the native
|
||||||
* error OMPI_ERR_OUT_OF_RESOURCE */
|
* error OPAL_ERR_OUT_OF_RESOURCE */
|
||||||
test_verify("failed", OMPI_ERR_OUT_OF_RESOURCE ==
|
test_verify("failed", OPAL_ERR_OUT_OF_RESOURCE ==
|
||||||
OPAL_SOS_GET_ERROR_CODE(errnum1));
|
OPAL_SOS_GET_ERROR_CODE(errnum1));
|
||||||
|
|
||||||
/* We start off another error history stack originating with a
|
/* We start off another error history stack originating with a
|
||||||
@ -139,7 +145,7 @@ static bool opal_sos_test(void)
|
|||||||
free(err_str);
|
free(err_str);
|
||||||
test_verify("failed",
|
test_verify("failed",
|
||||||
OPAL_SOS_SEVERITY_ERROR == OPAL_SOS_GET_SEVERITY(errnum2));
|
OPAL_SOS_SEVERITY_ERROR == OPAL_SOS_GET_SEVERITY(errnum2));
|
||||||
test_verify("failed", OMPI_ERR_FATAL ==
|
test_verify("failed", OPAL_ERR_FATAL ==
|
||||||
OPAL_SOS_GET_ERROR_CODE(errnum2));
|
OPAL_SOS_GET_ERROR_CODE(errnum2));
|
||||||
|
|
||||||
/* Registering another error with severity ERROR.
|
/* Registering another error with severity ERROR.
|
||||||
@ -147,7 +153,7 @@ static bool opal_sos_test(void)
|
|||||||
errnum2 = OPAL_SOS_WARN((errnum2, false, "this process must die."));
|
errnum2 = OPAL_SOS_WARN((errnum2, false, "this process must die."));
|
||||||
test_verify("failed",
|
test_verify("failed",
|
||||||
OPAL_SOS_SEVERITY_WARN == OPAL_SOS_GET_SEVERITY(errnum2));
|
OPAL_SOS_SEVERITY_WARN == OPAL_SOS_GET_SEVERITY(errnum2));
|
||||||
test_verify("failed", OMPI_ERR_FATAL ==
|
test_verify("failed", OPAL_ERR_FATAL ==
|
||||||
OPAL_SOS_GET_ERROR_CODE(errnum2));
|
OPAL_SOS_GET_ERROR_CODE(errnum2));
|
||||||
|
|
||||||
/* We attach the two error traces originating from errnum1
|
/* We attach the two error traces originating from errnum1
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user