mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
ckp
This commit is contained in:
parent
a4a2132f98
commit
56f6e7e141
@ -1,8 +1,5 @@
|
||||
# Test c output
|
||||
T=tst_diskless5
|
||||
|
||||
#H58=8
|
||||
H510=10
|
||||
T=tst_cycle
|
||||
|
||||
#ARGS=diskless persist
|
||||
|
||||
@ -10,17 +7,12 @@ H510=10
|
||||
|
||||
#CMD=env HDF5_DEBUG=trace
|
||||
#CMD=export NETCDF_LOG_LEVEL=5 ;gdb --args
|
||||
CMD=valgrind --leak-check=full
|
||||
#CMD=valgrind --leak-check=full
|
||||
#CMD=gdb --args
|
||||
|
||||
#PAR=1
|
||||
|
||||
ifdef H58
|
||||
H5L=/usr/local
|
||||
endif
|
||||
ifdef H510
|
||||
H5L=/opt
|
||||
endif
|
||||
|
||||
CFLAGS=-Wall -Wno-unused-variable -Wno-unused-function -g -O0 -I.. -I../include
|
||||
|
||||
@ -49,9 +41,3 @@ cmp::
|
||||
cpp::
|
||||
${CC} -E ${CFLAGS} ${T}.c > ${T}.txt
|
||||
|
||||
#TS = tst_diskless tst_diskless2 tst_diskless3 tst_diskless4 tst_diskless5 tst_diskless6
|
||||
TS = tst_diskless5
|
||||
several::
|
||||
export LD_LIBRARY_PATH=${LLP}; export CFLAGS; export LDFLAGS; \
|
||||
for f in ${TS} ; do ${CC} -o ${TS} ${CFLAGS} ${TS}.c ${SRC} ${LDFLAGS}; done
|
||||
|
||||
|
@ -136,6 +136,9 @@ NCDISPATCH_initialize(void)
|
||||
return status;
|
||||
}
|
||||
|
||||
/* Clean up globally allocated memory; make sure
|
||||
that nc_initialize can be called.
|
||||
*/
|
||||
int
|
||||
NCDISPATCH_finalize(void)
|
||||
{
|
||||
|
@ -118,7 +118,10 @@ done:
|
||||
int
|
||||
NC4_provenance_finalize(void)
|
||||
{
|
||||
return NC4_clear_provenance(&globalprovenance);
|
||||
int stat = NC_NOERR;
|
||||
stat = NC4_clear_provenance(&globalprovenance);
|
||||
globalpropinitialized = 0;
|
||||
return stat;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,7 +75,7 @@ nc_initialize()
|
||||
int stat = NC_NOERR;
|
||||
|
||||
if(NC_initialized) return NC_NOERR;
|
||||
if(NC_finalized) return NC_EINTERNAL;
|
||||
/* Allow repeated calls if nc_finalize has been called in-between */
|
||||
NC_initialized = 1;
|
||||
NC_finalized = 0;
|
||||
|
||||
@ -114,9 +114,8 @@ done:
|
||||
* valgrind, then it will report memory that has not been
|
||||
* deallocated. Calling nc_finalize should reclaim all such memory.
|
||||
*
|
||||
* WARNING: this function should be called when the program has
|
||||
* completed all use of the netcdf-c library. Calling any function
|
||||
* after nc_finalize() may cause a variety of memory-related errors.
|
||||
* Once this function is called, it will be necessary to call
|
||||
* nc_initialize again.
|
||||
*
|
||||
* This funcion invokes all defined
|
||||
* finalizers, and there is a finalizer
|
||||
|
@ -27,7 +27,7 @@ TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names \
|
||||
tst_nofill tst_nofill2 tst_nofill3 tst_atts3 tst_meta tst_inq_type \
|
||||
tst_utf8_validate tst_utf8_phrases tst_global_fillval \
|
||||
tst_max_var_dims tst_formats tst_def_var_fill tst_err_enddef \
|
||||
tst_default_format
|
||||
tst_default_format tst_cycle
|
||||
|
||||
if USE_PNETCDF
|
||||
check_PROGRAMS += tst_parallel2 tst_pnetcdf tst_addvar
|
||||
|
43
nc_test/tst_cycle.c
Normal file
43
nc_test/tst_cycle.c
Normal file
@ -0,0 +1,43 @@
|
||||
/* This is part of the netCDF package. Copyright 2018 University
|
||||
Corporation for Atmospheric Research/Unidata See COPYRIGHT file for
|
||||
conditions of use. See www.unidata.ucar.edu for more info.
|
||||
|
||||
Test multiple cycles of nc_initialize...nc_finalize
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <nc_tests.h>
|
||||
#include "err_macros.h"
|
||||
#include <netcdf.h>
|
||||
|
||||
#define ERR2 { \
|
||||
err++; \
|
||||
fprintf(stderr, "Sorry! Unexpected result, %s, line: %d (%s)\n", \
|
||||
__FILE__, __LINE__, nc_strerror(stat)); \
|
||||
exit(1); \
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int stat = NC_NOERR;
|
||||
|
||||
printf("\n*** Testing initialize/finalize cycle.\n");
|
||||
|
||||
/* Directly invoke nc_initialize...nc_finalize multiple times.*/
|
||||
/* Ideally do this test with some kind of memory checker to look
|
||||
for memory errors
|
||||
*/
|
||||
|
||||
if((stat = nc_initialize())) ERR;
|
||||
if((stat = nc_finalize())) ERR;
|
||||
if((stat = nc_initialize())) ERR;
|
||||
if((stat = nc_finalize())) ERR;
|
||||
if((stat = nc_initialize())) ERR;
|
||||
if((stat = nc_finalize())) ERR;
|
||||
|
||||
SUMMARIZE_ERR;
|
||||
|
||||
FINAL_RESULTS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user