test abort

This commit is contained in:
Dennis Heimbigner 2019-05-20 23:21:22 -06:00
parent ec43745ee9
commit dc16b00f38
4 changed files with 19 additions and 54 deletions

View File

@ -150,7 +150,7 @@ nc_finalize(void)
/* Abort any open files */
index = 0;
ncp = NULL;
for(;;) { *
for(;;) {
ncp = iterate_NCList(&index);
if(ncp == NULL) break;
(void)nc_abort(ncp->ext_ncid); /* don't care if fails */

View File

@ -1,44 +0,0 @@
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
# 2015, 2016, 2017, 2018
# University Corporation for Atmospheric Research/Unidata.
# See netcdf-c/COPYRIGHT file for more info.
build_bin_test(bm_file)
build_bin_test(tst_chunks3)
build_bin_test(tst_ar4)
build_bin_test(tst_ar4_4d)
build_bin_test(bm_many_objs)
build_bin_test(tst_h_many_atts)
build_bin_test(bm_many_atts)
build_bin_test(tst_files2)
build_bin_test(tst_knmi)
build_bin_test(bm_netcdf4_recs)
build_bin_test(bigmeta)
build_bin_test(openbigmeta)
add_bin_test(tst_ar4_3d)
add_bin_test(tst_create_files)
add_bin_test(tst_files3)
add_bin_test(tst_mem)
add_bin_test(tst_wrf_reads)
add_bin_test(tst_attsperf)
add_sh_test(run_knmi_bm.sh)
add_sh_test(perftest.sh)
add_sh_test(run_tst_chunks.sh)
add_sh_test(run_bm_elena.sh))
IF(BUILD_UTILITIES)
add_sh_test(run_bm_test1.sh)
add_sh_test(run_bm_test2.sh)
# This will run a parallel I/O benchmark for parallel builds.
IF(TEST_PARALLEL4)
add_sh_test(run_par_bm_test.sh)
ENDIF()
ENDIF()
ADD_EXTRA_DIST(run_par_bm_test.sh.in run_knmi_bm.sh CMakeLists.txt
perftest.sh run_bm_test1.sh run_bm_test2.sh)

View File

@ -102,7 +102,7 @@ tst_*.h5 tst_grp_rename.cdl tst_grp_rename.dmp ref_grp_rename.cdl \
foo1.nc tst_*.h4 test.nc testszip.nc test.h5 szip_dump.cdl \
perftest.txt bigmeta.nc bigvars.nc *.gz MSGCPP_*.nc \
floats*.nc floats*.cdl shorts*.nc shorts*.cdl ints*.nc ints*.cdl \
testfilter_reg.nc
testfilter_reg.nc tst_cycle.nc
DISTCLEANFILES = findplugin.sh run_par_test.sh

View File

@ -18,11 +18,7 @@
#undef DEBUG
/* Created file */
#ifdef DEBUG
#define NCFILE "tst_cycle.nc"
#else
#define NCFILE "tc.nc"
#endif
#define ERR2 { \
err++; \
@ -47,19 +43,31 @@ main(int argc, char **argv)
for memory errors
*/
#ifndef DEBUG
/* Create a file */
if((stat = nc_create(NCFILE,NC_CLOBBER|NC_NETCDF4,&ncid))) ERR; /* Indirectly call nc_initialize() */
/* Leave file open to force finalize to abort it */
/* finalize and ensure that created file gets aborted */
if((stat = nc_finalize())) ERR;
/* Check that file does not exist */
{
FILE* f = fopen(NCFILE,"r");
if(f != NULL) {
fprintf(stderr,"*** Fail: nc_finalize failed to abort %s\n",NCFILE);
ERR;
goto done;
}
}
/* Create a and keep file */
if((stat = nc_create(NCFILE,NC_CLOBBER|NC_NETCDF4,&ncid))) ERR; /* Indirectly call nc_initialize() */
if((stat = nc_close(ncid))) ERR;
if((stat = nc_finalize())) ERR;
#endif
/* Re-open (including re-initialize) */
if((stat = nc_open(NCFILE,NC_NOCLOBBER,&ncid))) ERR; /* Indirectly call nc_initialize() */
/* Read the _NCProperties attribute */
if((stat = nc_get_att_text(ncid,NC_GLOBAL,"_NCProperties",ncprop))) ERR;
printf("|%s|\n",ncprop);
if((stat = nc_close(ncid))) ERR;
/* Do not close so that finalize will be forced to abort it */
if((stat = nc_finalize())) ERR;
/* Once more */
@ -68,6 +76,7 @@ main(int argc, char **argv)
if((stat = nc_close(ncid))) ERR;
if((stat = nc_finalize())) ERR;
done:
(void)unlink(NCFILE);
SUMMARIZE_ERR;