//----------------------------------------------------------------------------- //BOP // !IROUTINE: ESMCI::TestEnd() - Print a standard end test message // // !INTERFACE: int TestEnd( // // !RETURN VALUE: // ESMF_SUCCESS or ESMF_FAILURE // // !ARGUMENTS: int result, // in - cumulative failure count const char *file, // in - test filename int line, // in - test line number in test filename int only) { // in - if set to 0, print on stderr also // // !DESCRIPTION: // Prints summary message about total failures, and standard exit message. // If {\tt only} is zero, also print same message to stderr as well // as the normal output on stdout. The default for {\tt only} is 1. // //EOP //----------------------------------------------------------------------------- int rc; char msgbuf[ESMF_MAXSTR]; ESMCI::LogErr *whichLog; // TODO: this should be settable by the user whichLog = &ESMC_LogDefault; if (file == NULL) { sprintf(msgbuf, "FAIL %s, line %d, null filename passed to " "ESMCI::TestEnd()\n", __FILE__, __LINE__); whichLog->Write(msgbuf, ESMC_LOG_INFO); if (!only) fprintf(stderr, "%s", msgbuf); return(ESMF_FAILURE); } sprintf(msgbuf, "Number of failed tests: %d\n", result); whichLog->Write(msgbuf, ESMC_LOG_INFO); if (!only) fprintf(stderr, "%s", msgbuf); sprintf(msgbuf, "Ending Test, file %s, line %d\n", file, line); whichLog->Write(msgbuf, ESMC_LOG_INFO); if (!only) fprintf(stderr, "%s", msgbuf); rc = ESMCI_Finalize(); if (rc != ESMF_SUCCESS) { sprintf(msgbuf, "FAIL: %s, line %d, Finalizing ESMF\n", file, line); whichLog->Write(msgbuf, ESMC_LOG_INFO); if (!only) fprintf(stderr, "%s", msgbuf); return(rc); } return(ESMF_SUCCESS); }
//----------------------------------------------------------------------------- //BOP // !IROUTINE: ESMC_Finalize - Finalize the ESMF Framework // // !INTERFACE: int ESMC_Finalize( // // !RETURN VALUE: // int return code // // !ARGUMENTS: void){ // // !DESCRIPTION: // //EOP int localrc; // todo: it may be better to go directly into F90 instead of using C++ localrc = ESMCI_Finalize(); // todo: use LogErr to do error handling for localrc return localrc; } // end ESMC_Finalize