Skip to content

Commit

Permalink
test1
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisHeimbigner committed Sep 20, 2023
1 parent 138037e commit 0af6f44
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 33 deletions.
9 changes: 5 additions & 4 deletions include/nclog.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@

/* Log level: linear order */
/* Suggested tag values */
#define NCLOGERR (0) /* Errors */
#define NCLOGWARN (1) /* Warnings */
#define NCLOGNOTE (2) /* General info */
#define NCLOGDBG (3) /* Everything */
#define NCLOGOFF (0) /* Stop Logging */
#define NCLOGERR (1) /* Errors */
#define NCLOGWARN (2) /* Warnings */
#define NCLOGNOTE (3) /* General info */
#define NCLOGDEBUG (4) /* Everything */

/* Support ptr valued arguments that are used to store results */
#define PTRVAL(t,p,d) ((t)((p) == NULL ? (d) : *(p)))
Expand Down
4 changes: 2 additions & 2 deletions libdap2/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ prefetchdata(NCDAPCOMMON* nccomm)
/* Should be prefetchable */
nclistpush(vars,(void*)var);
if(SHOWFETCH) {
nclog(NCLOGDBG,"prefetch: %s",var->ncfullname);
nclog(NCLOGDEBUG,"prefetch: %s",var->ncfullname);
}
}
}
Expand Down Expand Up @@ -428,7 +428,7 @@ markprefetch(NCDAPCOMMON* nccomm)
{
extern char* ocfqn(OCddsnode);
char *tmp = ocfqn(var->ocnode);
nclog(NCLOGDBG,"prefetchable: %s=%lu",
nclog(NCLOGDEBUG,"prefetchable: %s=%lu",
tmp,(unsigned long)nelems);
free(tmp);
}
Expand Down
12 changes: 6 additions & 6 deletions libdap4/d4read.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ readpacket(NCD4INFO* state, NCURI* url, NCbytes* packet, NCD4mode dxx, NCD4forma
fetchurl = ncuribuild(url,NULL,suffix,flags);
MEMCHECK(fetchurl);
if(FLAGSET(state->controls.flags,NCF_SHOWFETCH)) {
nclog(NCLOGDBG,"fetch url=%s",fetchurl);
nclog(NCLOGDEBUG,"fetch url=%s",fetchurl);
#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&time0,NULL);
#endif
Expand All @@ -194,7 +194,7 @@ readpacket(NCD4INFO* state, NCURI* url, NCbytes* packet, NCD4mode dxx, NCD4forma
gettimeofday(&time1,NULL);
secs = deltatime(time0,time1);
#endif
nclog(NCLOGDBG,"fetch complete: %0.3f",secs);
nclog(NCLOGDEBUG,"fetch complete: %0.3f",secs);
}
}
#ifdef D4DEBUG
Expand Down Expand Up @@ -271,7 +271,7 @@ readfile(NCD4INFO* state, const NCURI* uri, NCD4mode dxx, NCD4format fxx, NCbyte
gettimeofday(&time0,NULL);
#endif
surl = ncuribuild((NCURI*)uri,NULL,NULL,NCURIALL);
nclog(NCLOGDBG,"fetch uri=%s file=%s",surl,filename);
nclog(NCLOGDEBUG,"fetch uri=%s file=%s",surl,filename);
}
switch (dxx) {
case NCD4_DMR:
Expand All @@ -293,7 +293,7 @@ readfile(NCD4INFO* state, const NCURI* uri, NCD4mode dxx, NCD4format fxx, NCbyte
gettimeofday(&time1,NULL);
secs = deltatime(time0,time1);
#endif
nclog(NCLOGDBG,"%s fetch complete: %0.3f",suffix,secs);
nclog(NCLOGDEBUG,"%s fetch complete: %0.3f",suffix,secs);
}
return THROW(stat);
}
Expand Down Expand Up @@ -326,7 +326,7 @@ readfileDAPDMR(NCD4INFO* state, const NCURI* uri, NCbytes* packet)
gettimeofday(&time0,NULL);
#endif
surl = ncuribuild((NCURI*)uri,NULL,".dap",NCURIALL);
nclog(NCLOGDBG,"fetch uri=%s file=%s",surl,filename);
nclog(NCLOGDEBUG,"fetch uri=%s file=%s",surl,filename);
}
stat = NC_readfile(filename,packet);

Expand All @@ -336,7 +336,7 @@ readfileDAPDMR(NCD4INFO* state, const NCURI* uri, NCbytes* packet)
gettimeofday(&time1,NULL);
secs = deltatime(time0,time1);
#endif
nclog(NCLOGDBG,"fetch complete: %0.3f",secs);
nclog(NCLOGDEBUG,"fetch complete: %0.3f",secs);
}

if(stat != NC_NOERR) goto done;
Expand Down
2 changes: 2 additions & 0 deletions libdispatch/dfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ nc_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparamsp, u
if((stat = ncp->dispatch->inq_var_filter_info(ncid,varid,id,nparamsp,params))) goto done;

done:
if(stat == NC_ENOFILTER) nclog(NCLOGWARN,"Undefined filter: %u",(unsigned)id);
return stat;
}

Expand Down Expand Up @@ -131,6 +132,7 @@ nc_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams, const un
if((stat = NC_check_id(ncid,&ncp))) return stat;
if((stat = ncp->dispatch->def_var_filter(ncid,varid,id,nparams,params))) goto done;
done:
if(stat == NC_ENOFILTER) nclog(NCLOGWARN,"Undefined filter: %u",(unsigned)id);
return stat;
}

Expand Down
4 changes: 2 additions & 2 deletions libdispatch/drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ NC_rcload(void)
globalstate = NC_getglobalstate();

if(globalstate->rcinfo->ignore) {
nclog(NCLOGDBG,".rc file loading suppressed");
nclog(NCLOGNOTE,".rc file loading suppressed");
goto done;
}
if(globalstate->rcinfo->loaded) goto done;
Expand Down Expand Up @@ -653,7 +653,7 @@ rcsearch(const char* prefix, const char* rcname, char** pathp)
/* see if file is readable */
f = NCfopen(path,"r");
if(f != NULL)
nclog(NCLOGDBG, "Found rc file=%s",path);
nclog(NCLOGNOTE, "Found rc file=%s",path);
done:
if(f == NULL || ret != NC_NOERR) {
nullfree(path);
Expand Down
25 changes: 20 additions & 5 deletions libdispatch/nclog.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ static struct NCLOGGLOBAL {
} frames[NC_MAX_FRAMES];
} nclog_global = {0,-1,NULL};

static const char* nctagset[] = {"Error","Warning","Note","Debug"};
static const char* nctagset[] = {"OFF","ERR","WARN","NOTE","DEBUG",NULL};

/* Forward */
static const char* nctagname(int tag);
static int nctagforname(const char* tag);

/*!\defgroup NClog NClog Management
@{*/
Expand All @@ -67,12 +68,15 @@ ncloginit(void)
return;
nclogginginitialized = 1;
memset(&nclog_global,0,sizeof(nclog_global));
nclog_global.loglevel = NCLOGERR;
ncsetloglevel(NCLOGOFF);
nclog_global.tracelevel = -1;
nclog_global.nclogstream = stderr;
/* Use environment variables to preset nclogging state*/
envv = getenv(NCENVLOGGING);
if(envv != NULL) ncsetloglevel(atoi(envv));
if(envv != NULL) {
int level = nctagforname(envv);
if(level < 0) ncsetloglevel(level);
}
envv = getenv(NCENVTRACING);
if(envv != NULL) nctracelevel(atoi(envv));
}
Expand All @@ -91,7 +95,7 @@ ncsetloglevel(int level)
int was;
if(!nclogginginitialized) ncloginit();
was = nclog_global.loglevel;
if(level >= NCLOGDBG && level <= NCLOGNOTE)
if(level >= 0 && level <= NCLOGDEBUG)
nclog_global.loglevel = level;
if(nclog_global.nclogstream == NULL) nclogopen(NULL);
return was;
Expand Down Expand Up @@ -168,11 +172,22 @@ nclogtextn(int level, const char* text, size_t count)
static const char*
nctagname(int tag)
{
if(tag < NCLOGERR || tag >= NCLOGDBG)
if(tag < NCLOGOFF || tag >= NCLOGDEBUG)
return "unknown";
return nctagset[tag];
}

static int
nctagforname(const char* tag)
{
int level;
const char** p = NULL;
for(level=0,p=nctagset;*p;p++,level++) {
if(strcasecmp(*p,tag)==0) return level;
}
return -1;
}

/*!
Send trace messages.
\param[in] level Indicate the level of trace
Expand Down
2 changes: 1 addition & 1 deletion libnczarr/zdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef ZDEBUG_H
#define ZDEBUG_H

#undef ZCATCH /* Warning: significant performance impact */
#define ZCATCH /* Warning: significant performance impact */
#undef ZTRACING /* Warning: significant performance impact */

#undef ZDEBUG /* general debug */
Expand Down
8 changes: 3 additions & 5 deletions libnczarr/zfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ NCZ_addfilter(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, unsigned int id, size_t
/* Before anything else, find the matching plugin */
if((stat = NCZ_plugin_loaded(id,&plugin))) goto done;
if(plugin == NULL) {
ZLOG(NCLOGWARN,"no such plugin: %u",(unsigned)id);
stat = THROW(NC_ENOFILTER);
goto done;
}
Expand Down Expand Up @@ -437,7 +436,6 @@ NCZ_filter_remove(NC_VAR_INFO_T* var, unsigned int id)
goto done;
}
}
ZLOG(NCLOGERR,"no such filter: %u",(unsigned)id);
stat = THROW(NC_ENOFILTER);
done:
return ZUNTRACE(stat);
Expand Down Expand Up @@ -566,10 +564,12 @@ NCZ_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams,
/* See if deflate &/or szip is defined */
if((stat = NCZ_filter_lookup(var,H5Z_FILTER_DEFLATE,&tmp))) goto done;
havedeflate = (tmp == NULL ? 0 : 1);
stat = NC_NOERR; /* reset */

if((stat = NCZ_filter_lookup(var,H5Z_FILTER_SZIP,&tmp))) goto done;
haveszip = (tmp == NULL ? 0 : 1);

stat = NC_NOERR; /* reset */

/* If incoming filter not already defined, then check for conflicts */
if(oldspec == NULL) {
if(id == H5Z_FILTER_DEFLATE) {
Expand Down Expand Up @@ -710,7 +710,6 @@ NCZ_inq_var_filter_info(int ncid, int varid, unsigned int id, size_t* nparamsp,
if(params && spec->hdf5.visible.nparams > 0)
memcpy(params,spec->hdf5.visible.params,sizeof(unsigned int)*spec->hdf5.visible.nparams);
} else {
ZLOG(NCLOGWARN,"no such filter: %u",(unsigned)id);
stat = THROW(NC_ENOFILTER);
}
done:
Expand Down Expand Up @@ -991,7 +990,6 @@ NCZ_filter_build(const NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, const NCjson* j
/* Get the id of this codec filter */
if(NCJdictget(jfilter,"id",&jvalue)<0) {stat = NC_EFILTER; goto done;}
if(NCJsort(jvalue) != NCJ_STRING) {
ZLOG(NCLOGERR,"no such filter: %s",NCJstring(jvalue));
stat = THROW(NC_ENOFILTER); goto done;
}

Expand Down
7 changes: 5 additions & 2 deletions libnczarr/zvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2141,14 +2141,17 @@ NCZ_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep,
/* Short-circuit the filter-related inquiries */
if(shufflep) {
*shufflep = 0;
if((retval = NCZ_inq_var_filter_info(ncid,varid,2,NULL,NULL))==NC_NOERR)
if((retval = NCZ_inq_var_filter_info(ncid,varid,H5Z_FILTER_SHUFFLE,NULL,NULL))==NC_NOERR)
*shufflep = 1;
}
retval = NC_NOERR; /* reset */

if(fletcher32p) {
*fletcher32p = 0;
if((retval = NCZ_inq_var_filter_info(ncid,varid,3,NULL,NULL))==NC_NOERR)
if((retval = NCZ_inq_var_filter_info(ncid,varid,H5Z_FILTER_FLETCHER32,NULL,NULL))==NC_NOERR)
*fletcher32p = 1;
}
retval = NC_NOERR; /* reset */

/* Now that lazy atts have been read, use the libsrc4 function to
* get the answers. */
Expand Down
10 changes: 6 additions & 4 deletions nczarr_test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ LDADD = ${top_builddir}/liblib/libnetcdf.la

TESTS_ENVIRONMENT =
TEST_EXTENSIONS = .sh
SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose
#TESTS_ENVIRONMENT += export SETX=1;
#TESTS_ENVIRONMENT += export NCTRACING=1;

Expand Down Expand Up @@ -145,9 +145,11 @@ check_PROGRAMS += testfilter testfilter_misc testfilter_order testfilter_repeat
TESTS += run_filter.sh
TESTS += run_specific_filters.sh

if AX_DISABLE
# This test is too dangerous to run in a parallel make environment.
# It causes race conditions. So suppress and only test by hand.
#TESTS += run_unknown.sh
TESTS += run_unknown.sh
endif

if ISMINGW
XFAIL_TESTS = run_filter.sh run_specific_filters.sh run_nczfilter.sh
Expand Down
1 change: 0 additions & 1 deletion nczarr_test/run_put_vars_two_unlim_dim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh

set -e
set -x

find ${execdir} -name 'test_put_vars_two_unlim_dim*'

Expand Down
1 change: 0 additions & 1 deletion nczarr_test/ut_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ writedata(void)
int i;
size64_t totallen;
char* data1p = (char*)&data1[0]; /* byte level version of data1 */
NCZM_FEATURES features;

/* Create the data */
for(i=0;i<DATA1LEN;i++) data1[i] = i;
Expand Down

0 comments on commit 0af6f44

Please sign in to comment.