Merge pull request #2199 from WardF/github_actions_mingw.wif

Add MSYS2/MinGW64 to Github Actions
This commit is contained in:
Ward Fisher 2022-01-25 10:05:35 -07:00 committed by GitHub
commit b092f7ddae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 194 additions and 139 deletions

View File

@ -0,0 +1,54 @@
###
# Build hdf4, hdf5 dependencies and cache them in a combined directory.
# See https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
# for information related to github runners.
###
name: Run MSYS2, MinGW64-based Tests
on: [ pull_request ]
jobs:
build-and-test:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: git mingw-w64-x86_64-toolchain automake libtool autoconf make cmake mingw-w64-x86_64-hdf5 unzip
###
# Configure and build
###
- name: (Autotools) Run autoconf
run: autoreconf -if
- name: (Autotools) Configure Build
run: ./configure --enable-hdf5 --enable-dap --disable-dap-remote-tests --disable-static --disable-plugins --disable-byterange --disable-dap-remote-tests --disable-logging
if: ${{ success() }}
- name: (Autotools) Look at config.log if error
run: cat config.log
if: ${{ failure() }}
- name: (Autotools) Print Summary
run: cat libnetcdf.settings
- name: (Autotools) Build Library and Utilities
run: make -j 8 LDFLAGS="-no-undefined -Wl,--export-all-symbols"
if: ${{ success() }}
- name: (Autotools) Build and Run Tests
run: make check -j 8
if: ${{ success() }}

View File

@ -40,6 +40,11 @@
#undef DEBUG
#ifndef nulldup
#define nulldup(s) ((s)?strdup(s):NULL)
#endif
extern int NC_initialized; /**< True when dispatch table is initialized. */
/* User-defined formats. */

View File

@ -32,6 +32,10 @@
#endif
#endif
#ifndef nulldup
#define nulldup(x) ((x)?strdup(x):(x))
#endif
#undef DEBUG
/* If Defined, then use only stdio for all magic number io;
@ -236,7 +240,7 @@ processuri(const char* path, NCURI** urip, NClist* fraglenv)
if(!found)
{stat = NC_EINVAL; goto done;} /* unrecognized URL form */
/* process the corresponding fragments for that protocol */
/* process the corresponding fragments for that protocol */
if(protolist->fragments != NULL) {
int i;
tmp = nclistnew();
@ -251,7 +255,7 @@ processuri(const char* path, NCURI** urip, NClist* fraglenv)
}
nclistfreeall(tmp); tmp = NULL;
}
/* Substitute the protocol in any case */
if(protolist->substitute) ncurisetprotocol(uri,protolist->substitute);
@ -446,7 +450,7 @@ processmacros(NClist** fraglenvp)
if(fraglenvp == NULL || nclistlength(*fraglenvp) == 0) goto done;
fraglenv = *fraglenvp;
expanded = nclistnew();
expanded = nclistnew();
while(nclistlength(fraglenv) > 0) {
int found = 0;
char* key = NULL;
@ -458,7 +462,7 @@ processmacros(NClist** fraglenvp)
if(strcmp(macros->name,key)==0) {
nclistpush(expanded,strdup(macros->defkey));
nclistpush(expanded,strdup(macros->defvalue));
found = 1;
found = 1;
break;
}
}
@ -500,7 +504,7 @@ processinferences(NClist* fraglenv)
break;
}
}
if(pos < 0)
if(pos < 0)
goto done; /* no modes defined */
/* Get the mode as list */
@ -535,7 +539,7 @@ processinferences(NClist* fraglenv)
/* Store new mode value */
if((newmodeval = list2string(modes))== NULL)
{stat = NC_ENOMEM; goto done;}
{stat = NC_ENOMEM; goto done;}
nclistset(fraglenv,pos+1,newmodeval);
nullfree(modeval);
modeval = NULL;
@ -572,7 +576,7 @@ mergekey(NClist** valuesp)
if(strcasecmp(candidate,value)==0)
{nullfree(value); value = NULL; break;}
}
}
}
if(value != NULL) {nclistpush(newvalues,value); value = NULL;}
}
/* Make sure to have at least 1 value */
@ -645,11 +649,11 @@ cleanfragments(NClist** fraglenvp)
newlist = nclistnew();
buf = ncbytesnew();
allkeys = nclistnew();
tmp = nclistnew();
tmp = nclistnew();
/* collect all unique keys */
collectallkeys(fraglenv,allkeys);
/* Collect all values for same key across all fragments */
/* Collect all values for same key across all fragments */
for(i=0;i<nclistlength(allkeys);i++) {
key = nclistget(allkeys,i);
collectvaluesbykey(fraglenv,key,tmp);
@ -676,7 +680,7 @@ done:
static int
processfragmentkeys(const char* key, const char* value, NCmodel* model)
{
return NC_NOERR;
return NC_NOERR;
}
/*
@ -760,7 +764,7 @@ set_default_mode(int* modep)
case NC_FORMAT_NETCDF4_CLASSIC: mode |= (NC_NETCDF4|NC_CLASSIC_MODEL); break;
case NC_FORMAT_CLASSIC: /* fall thru */
default: break; /* default to classic */
}
}
*modep = mode; /* final result */
}
@ -820,7 +824,7 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void
#endif
/* Phase 4: Rebuild the url fragment and rebuilt the url */
sfrag = envvlist2string(fraglenv,"&");
sfrag = envvlist2string(fraglenv,"&");
nclistfreeall(fraglenv); fraglenv = NULL;
#ifdef DEBUG
fprintf(stderr,"frag final: %s\n",sfrag);
@ -833,10 +837,10 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void
*newpathp = ncuribuild(uri,NULL,NULL,NCURIALL);
#ifdef DEBUG
fprintf(stderr,"newpath=|%s|\n",*newpathp); fflush(stderr);
#endif
#endif
/* Phase 5: Process the mode key to see if we can tell the formatx */
modeval = ncurifragmentlookup(uri,"mode");
modeval = ncurifragmentlookup(uri,"mode");
if(modeval != NULL) {
if((stat = parseonchar(modeval,',',modeargs))) goto done;
for(i=0;i<nclistlength(modeargs);i++) {
@ -866,7 +870,7 @@ NC_infermodel(const char* path, int* omodep, int iscreate, int useparallel, void
} else {/* Not URL */
if(*newpathp) *newpathp = NULL;
}
}
/* Phase 8: mode inference from mode flags */
/* The modeargs did not give us a model (probably not a URL).
@ -938,7 +942,7 @@ isreadable(NCURI* uri, NCmodel* model)
}
/* Step 2: check for bytes mode */
if(NC_testmode(uri,"bytes")) return 1;
return 0;
}
@ -975,7 +979,7 @@ nc__testurl(const char* path0, char** basenamep)
NCURI* uri = NULL;
int ok = 0;
char* path = NULL;
if(!ncuriparse(path0,&uri)) {
char* p;
char* q;
@ -1040,7 +1044,7 @@ check_file_type(const char *path, int omode, int use_parallel,
model->format = format;
goto done;
}
#endif
#endif
magicinfo.path = path; /* do not free */
magicinfo.uri = uri; /* do not free */

View File

@ -23,6 +23,10 @@ See COPYRIGHT for license information.
#include "ncauth.h"
#include "ncpathmgr.h"
#ifndef nulldup
#define nulldup(x) ((x)?strdup(x):(x))
#endif
#undef NOREAD
#undef DRCDEBUG
@ -76,7 +80,7 @@ ncrc_createglobalstate(void)
{
int stat = NC_NOERR;
const char* tmp = NULL;
if(ncrc_globalstate == NULL) {
ncrc_globalstate = calloc(1,sizeof(NCRCglobalstate));
}
@ -99,7 +103,7 @@ Initialize defaults and load:
For debugging support, it is possible
to change where the code looks for the .aws directory.
This is set by the environment variable NC_TEST_AWS_DIR.
This is set by the environment variable NC_TEST_AWS_DIR.
*/
@ -107,10 +111,10 @@ void
ncrc_initialize(void)
{
int stat = NC_NOERR;
if(NCRCinitialized) return;
NCRCinitialized = 1; /* prevent recursion */
#ifndef NOREAD
/* Load entrys */
if((stat = NC_rcload())) {
@ -192,7 +196,7 @@ NC_rcload(void)
if(!NCRCinitialized) ncrc_initialize();
globalstate = ncrc_getglobalstate();
if(globalstate->rcinfo.ignore) {
nclog(NCLOGDBG,".rc file loading suppressed");
@ -217,21 +221,21 @@ NC_rcload(void)
const char** rcname;
const char* dirnames[3];
const char** dir;
/* Make sure rcinfo.rchome is defined */
ncrc_setrchome();
dirnames[0] = globalstate->rcinfo.rchome;
dirnames[1] = globalstate->cwd;
dirnames[2] = NULL;
for(dir=dirnames;*dir;dir++) {
for(dir=dirnames;*dir;dir++) {
for(rcname=rcfilenames;*rcname;rcname++) {
ret = rcsearch(*dir,*rcname,&path);
if(ret == NC_NOERR && path != NULL)
nclistpush(rcfileorder,path);
path = NULL;
path = NULL;
}
}
}
@ -612,7 +616,7 @@ NC_rcfile_insert(const char* key, const char* value, const char* hostport, const
if(!NCRCinitialized) ncrc_initialize();
globalstate = ncrc_getglobalstate();
rc = globalstate->rcinfo.entries;
if(rc == NULL) {
rc = nclistnew();
if(rc == NULL) {ret = NC_ENOMEM; goto done;}
@ -727,7 +731,7 @@ NC_getdefaults3region(NCURI* uri, const char** regionp)
region = NC_rclookupx(uri,"AWS.REGION");
if(region == NULL) {/* See if we can find a profile */
if((stat = NC_getactives3profile(uri,&profile))==NC_NOERR) {
if(profile)
if(profile)
(void)NC_s3profilelookup(profile,"aws_region",&region);
}
}
@ -835,7 +839,7 @@ awslex(AWSparser* parser)
} else if(c == ';') {
char* p = parser->pos - 1;
if(*p == '\n') {
/* Skip comment */
/* Skip comment */
do {p++;} while(*p != '\n' && *p != '\0');
parser->pos = p;
token = (*p == '\n'?AWS_EOL:AWS_EOF);
@ -952,12 +956,12 @@ fprintf(stderr,">>> parse: profile=%s\n",profile->name);
if((entry = (struct AWSentry*)calloc(1,sizeof(struct AWSentry)))==NULL)
{stat = NC_ENOMEM; goto done;}
entry->key = key; key = NULL;
entry->value = value; value = NULL;
entry->value = value; value = NULL;
#ifdef PARSEDEBUG
fprintf(stderr,">>> parse: entry=(%s,%s)\n",entry->key,entry->value);
#endif
nclistpush(profile->entries,entry); entry = NULL;
if(token == AWS_WORD) token = awslex(parser); /* finish the line */
if(token == AWS_WORD) token = awslex(parser); /* finish the line */
} else
{stat = NCTHROW(NC_EINVAL); goto done;}
}
@ -1099,7 +1103,7 @@ NC_authgets3profile(const char* profilename, struct AWSprofile** profilep)
int stat = NC_NOERR;
int i = -1;
NCRCglobalstate* gstate = ncrc_getglobalstate();
for(i=0;i<nclistlength(gstate->s3creds.profiles);i++) {
struct AWSprofile* profile = (struct AWSprofile*)nclistget(gstate->s3creds.profiles,i);
if(strcmp(profilename,profile->name)==0)

View File

@ -29,7 +29,9 @@
#include "ncpathmgr.h"
#define NC_MAX_PATH 4096
#ifndef nulldup
#define nulldup(x) ((x)?strdup(x):(x))
#endif
/**************************************************/
/**
* Provide a hidden interface to allow utilities
@ -281,7 +283,7 @@ NC_getmodelist(const char* modestr, NClist** modelistp)
int stat=NC_NOERR;
NClist* modelist = NULL;
modelist = nclistnew();
modelist = nclistnew();
if(modestr == NULL || strlen(modestr) == 0) goto done;
/* Parse the mode string at the commas or EOL */
@ -323,7 +325,7 @@ NC_testmode(NCURI* uri, const char* tag)
const char* modestr = NULL;
NClist* modelist = NULL;
modestr = ncurifragmentlookup(uri,"mode");
modestr = ncurifragmentlookup(uri,"mode");
if(modestr == NULL) goto done;
/* Parse mode str */
if((stat = NC_getmodelist(modestr,&modelist))) goto done;
@ -331,14 +333,14 @@ NC_testmode(NCURI* uri, const char* tag)
for(i=0;i<nclistlength(modelist);i++) {
const char* mode = (const char*)nclistget(modelist,i);
if(strcasecmp(mode,tag)==0) {found = 1; break;}
}
}
done:
nclistfreeall(modelist);
return found;
}
#if ! defined __INTEL_COMPILER
#if defined __APPLE__
#if ! defined __INTEL_COMPILER
#if defined __APPLE__
int isinf(double x)
{
union { unsigned long long u; double f; } ieee754;
@ -411,7 +413,7 @@ NC_join(NClist* segments, char** pathp)
const char* seg = nclistget(segments,i);
if(seg[0] != '/')
ncbytescat(buf,"/");
ncbytescat(buf,seg);
ncbytescat(buf,seg);
}
done:
@ -421,4 +423,3 @@ done:
ncbytesfree(buf);
return stat;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2018, University Corporation for Atmospheric Research
* Copyright 2022, University Corporation for Atmospheric Research
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
*/
/**
@ -21,6 +21,10 @@
#endif
#include "ncdispatch.h"
#ifndef nulldup
#define nulldup(x) ((x)?strdup(x):(x))
#endif
/** This is the default create format for nc_create and nc__create. */
static int default_create_format = NC_FORMAT_CLASSIC;

View File

@ -6,6 +6,10 @@
#include "zincludes.h"
#include "zfilter.h"
#ifndef nulldup
#define nulldup(x) ((x)?strdup(x):(x))
#endif
#undef FILLONCLOSE
/* Forward */
@ -88,7 +92,7 @@ ncz_collect_dims(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NCjson** jdimsp)
LOG((3, "%s: ", __func__));
NCJnew(NCJ_DICT,&jdims);
NCJnew(NCJ_DICT,&jdims);
for(i=0; i<ncindexsize(grp->dim); i++) {
NC_DIM_INFO_T* dim = (NC_DIM_INFO_T*)ncindexith(grp->dim,i);
char slen[128];
@ -182,7 +186,7 @@ ncz_sync_grp(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, int isclose)
zinfo->zarr.nczarr_version.major,
zinfo->zarr.nczarr_version.minor,
zinfo->zarr.nczarr_version.release);
if((stat = NCJnew(NCJ_DICT,&jsuper))) goto done;
if((stat = NCJnew(NCJ_DICT,&jsuper))) goto done;
if((stat-NCJnewstring(NCJ_STRING,version,&jtmp))) goto done;
if((stat = NCJinsert(jsuper,"version",jtmp))) goto done;
jtmp = NULL;
@ -191,7 +195,7 @@ ncz_sync_grp(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, int isclose)
}
if(!purezarr) {
/* Insert the "_NCZARR_GROUP" dict */
/* Insert the "_NCZARR_GROUP" dict */
if((stat = NCJinsert(jgroup,NCZ_V2_GROUP,json))) goto done;
json = NULL;
}
@ -266,7 +270,7 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose)
NClist* filterchain = NULL;
NCjson* jfilter = NULL;
#endif
zinfo = file->format_file_info;
map = zinfo->map;
@ -338,7 +342,7 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose)
}
if((stat = NCJappend(jvar,jtmp))) goto done;
jtmp = NULL;
/* fill_value key */
if(var->no_fill) {
if((stat=NCJnew(NCJ_NULL,&jfill))) goto done;
@ -356,7 +360,7 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose)
if((stat = NCJaddstring(jvar,NCJ_STRING,"order"))) goto done;
/* "C" means row-major order, i.e., the last dimension varies fastest;
"F" means column-major order, i.e., the first dimension varies fastest.*/
/* Default to C for now */
/* Default to C for now */
if((stat = NCJaddstring(jvar,NCJ_STRING,"C"))) goto done;
/* Compressor and Filters */
@ -365,7 +369,7 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose)
configuration parameters, or ``null`` if no compressor is to be used. */
if((stat = NCJaddstring(jvar,NCJ_STRING,"compressor"))) goto done;
#ifdef ENABLE_NCZARR_FILTERS
filterchain = (NClist*)var->filters;
filterchain = (NClist*)var->filters;
if(nclistlength(filterchain) > 0) {
struct NCZ_Filter* filter = (struct NCZ_Filter*)nclistget(filterchain,nclistlength(filterchain)-1);
/* encode up the compressor */
@ -373,7 +377,7 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose)
} else
#endif
{ /* no filters at all */
/* Default to null */
/* Default to null */
if((stat = NCJnew(NCJ_NULL,&jtmp))) goto done;
}
if(jtmp && (stat = NCJappend(jvar,jtmp))) goto done;
@ -415,7 +419,7 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose)
if((stat = NCJinsert(jvar,"dimension_separator",jtmp))) goto done;
jtmp = NULL;
}
/* Capture dimref names as FQNs */
if(var->ndims > 0) {
if((dimrefs = nclistnew())==NULL) {stat = NC_ENOMEM; goto done;}
@ -438,14 +442,14 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose)
}
if((stat = NCJnew(NCJ_DICT,&jncvar)))
goto done;
/* Insert dimrefs */
if((stat = NCJinsert(jncvar,"dimrefs",jdimrefs)))
goto done;
jdimrefs = NULL; /* Avoid memory problems */
/* Add the _Storage flag */
/* Record if this is a scalar; use the storage field */
/* Record if this is a scalar; use the storage field */
if(var->ndims == 0) {
if((stat = NCJnewstring(NCJ_STRING,"scalar",&jtmp)))goto done;
} else if(var->storage == NC_CONTIGUOUS) {
@ -454,7 +458,7 @@ ncz_sync_var_meta(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose)
if((stat = NCJnewstring(NCJ_STRING,"compact",&jtmp)))goto done;
} else {/* chunked */
if((stat = NCJnewstring(NCJ_STRING,"chunked",&jtmp)))goto done;
}
}
if((stat = NCJinsert(jncvar,"storage",jtmp))) goto done;
jtmp = NULL;
@ -505,7 +509,7 @@ ncz_sync_var(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int isclose)
{
int stat = NC_NOERR;
NCZ_VAR_INFO_T* zvar = var->format_var_info;
if(!isclose) {
if((stat = ncz_sync_var_meta(file,var,isclose))) goto done;
}
@ -535,7 +539,7 @@ ncz_write_var(NC_VAR_INFO_T* var)
if(zvar->cache) {
if((stat = NCZ_flush_chunk_cache(zvar->cache))) goto done;
}
#ifdef FILLONCLOSE
/* If fill is enabled, then create missing chunks */
if(!var->no_fill) {
@ -543,7 +547,7 @@ ncz_write_var(NC_VAR_INFO_T* var)
NCZOdometer* chunkodom = NULL;
NC_FILE_INFO_T* file = var->container->nc4_info;
NCZ_FILE_INFO_T* zfile = (NCZ_FILE_INFO_T*)file->format_file_info;
NCZMAP* map = zfile->map;
NCZMAP* map = zfile->map;
size64_t start[NC_MAX_VAR_DIMS];
size64_t stop[NC_MAX_VAR_DIMS];
size64_t stride[NC_MAX_VAR_DIMS];
@ -566,7 +570,7 @@ ncz_write_var(NC_VAR_INFO_T* var)
if((chunkodom = nczodom_new(var->ndims+zvar->scalar,start,stop,stride,stop))==NULL)
{stat = NC_ENOMEM; goto done;}
for(;nczodom_more(chunkodom);nczodom_next(chunkodom)) {
size64_t* indices = nczodom_indices(chunkodom);
size64_t* indices = nczodom_indices(chunkodom);
/* Convert to key */
if((stat = NCZ_buildchunkpath(zvar->cache,indices,&key))) goto done;
switch (stat = nczmap_exists(map,key)) {
@ -630,7 +634,7 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc
isrootgroup = 1;
}
if(!isxarray && ncindexsize(attlist) == 0)
if(!isxarray && ncindexsize(attlist) == 0)
goto done; /* do nothing */
if(ncindexsize(attlist) > 0) {
@ -645,7 +649,7 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc
/* If reserved and hidden, then ignore */
if(ra && (ra->flags & HIDDENATTRFLAG)) continue;
if(a->nc_typeid >= NC_STRING)
{stat = THROW(NC_ENCZARR); goto done;}
{stat = THROW(NC_ENCZARR); goto done;}
if((stat = ncz_zarr_type_name(a->nc_typeid,1,&tname))) goto done;
if((stat = NCJnewstring(NCJ_STRING,tname,&jtype)))
goto done;
@ -654,7 +658,7 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc
jtype = NULL;
}
}
/* Construct container path */
if(container->sort == NCGRP)
stat = NCZ_grpkey((NC_GRP_INFO_T*)container,&fullpath);
@ -692,7 +696,7 @@ ncz_sync_atts(NC_FILE_INFO_T* file, NC_OBJ* container, NCindex* attlist, int isc
goto done;
if((stat = NCJinsert(jdict,"types",jtypes))) goto done;
jtypes = NULL;
if((stat = NCJinsert(jatts,NCZ_V2_ATTR,jdict))) goto done;
if((stat = NCJinsert(jatts,NCZ_V2_ATTR,jdict))) goto done;
jdict = NULL;
}
@ -724,7 +728,7 @@ done:
@internal Convert a list of attributes to corresponding json.
Note that this does not push to the file.
Also note that attributes of length 1 are stored as singletons, not arrays.
This is to be more consistent with pure zarr.
This is to be more consistent with pure zarr.
@param attlist - [in] the attributes to dictify
@param jattrsp - [out] the json'ized att list
@return NC_NOERR
@ -988,7 +992,7 @@ computeattrdata(nc_type* typeidp, NCjson* values, size_t* typelenp, size_t* lenp
data = malloc(typelen*count);
if(data == NULL)
{stat = NC_ENOMEM; goto done;}
/* convert to target type */
/* convert to target type */
if((stat = zconvert(typeid, typelen, data, values)))
goto done;
}
@ -996,7 +1000,7 @@ computeattrdata(nc_type* typeidp, NCjson* values, size_t* typelenp, size_t* lenp
if(typelenp) *typelenp = typelen;
if(datap) {*datap = data; data = NULL;}
if(typeidp) *typeidp = typeid; /* return possibly inferred type */
done:
if(reclaimvalues) NCJreclaim(values); /* we created it */
nullfree(data);
@ -1081,7 +1085,7 @@ mininttype(unsigned long long u64, int negative)
if(i64 <= NC_MAX_UINT) return NC_UINT;
return NC_INT64;
}
/**
* @internal Read file data from map to memory.
@ -1258,7 +1262,7 @@ ncz_read_atts(NC_FILE_INFO_T* file, NC_OBJ* container)
NCjson* key = NCJith(jattrs,i);
NCjson* value = NCJith(jattrs,i+1);
const NC_reservedatt* ra = NULL;
/* See if this is reserved attribute */
ra = NC_findreserved(NCJstring(key));
if(ra != NULL) {
@ -1287,7 +1291,7 @@ ncz_read_atts(NC_FILE_INFO_T* file, NC_OBJ* container)
assert(k != NULL && NCJsort(k) == NCJ_STRING);
nclistpush(zvar->xarray,strdup(NCJstring(k)));
}
}
}
/* else ignore */
continue;
}
@ -1510,7 +1514,7 @@ define_vars(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NClist* varnames)
/* Note that we do not create the _FillValue
attribute here to avoid having to read all
the attributes and thus foiling lazy read.*/
}
}
}
/* chunks */
{
@ -1562,12 +1566,12 @@ define_vars(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NClist* varnames)
if((stat = NCZ_filter_initialize())) goto done;
if((stat = NCJdictget(jvar,"filters",&jvalue))) goto done;
if(jvalue != NULL && NCJsort(jvalue) != NCJ_NULL) {
if(NCJsort(jvalue) != NCJ_ARRAY) {stat = NC_EFILTER; goto done;}
if(NCJsort(jvalue) != NCJ_ARRAY) {stat = NC_EFILTER; goto done;}
for(k=0;;k++) {
jfilter = NULL;
jfilter = NCJith(jvalue,k);
if(jfilter == NULL) break; /* done */
if(NCJsort(jfilter) != NCJ_DICT) {stat = NC_EFILTER; goto done;}
if(NCJsort(jfilter) != NCJ_DICT) {stat = NC_EFILTER; goto done;}
if((stat = NCZ_filter_build(file,var,jfilter))) goto done;
}
}
@ -1584,7 +1588,7 @@ define_vars(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NClist* varnames)
if((stat = NCZ_filter_initialize())) goto done;
if((stat = NCJdictget(jvar,"compressor",&jfilter))) goto done;
if(jfilter != NULL && NCJsort(jfilter) != NCJ_NULL) {
if(NCJsort(jfilter) != NCJ_DICT) {stat = NC_EFILTER; goto done;}
if(NCJsort(jfilter) != NCJ_DICT) {stat = NC_EFILTER; goto done;}
if((stat = NCZ_filter_build(file,var,jfilter))) goto done;
}
#endif
@ -1610,12 +1614,12 @@ define_vars(NC_FILE_INFO_T* file, NC_GRP_INFO_T* grp, NClist* varnames)
goto done;
if(jvalue != NULL) {
if(strcmp(NCJstring(jvalue),"chunked") == 0) {
var->storage = NC_CHUNKED;
var->storage = NC_CHUNKED;
} else if(strcmp(NCJstring(jvalue),"compact") == 0) {
var->storage = NC_COMPACT;
} else if(strcmp(NCJstring(jvalue),"scalar") == 0) {
var->storage = NC_CONTIGUOUS;
zvar->scalar = 1;
zvar->scalar = 1;
} else { /*storage = NC_CONTIGUOUS;*/
var->storage = NC_CONTIGUOUS;
}
@ -1721,7 +1725,7 @@ ncz_read_superblock(NC_FILE_INFO_T* file, char** nczarrvp, char** zarrfp)
char* nczarr_version = NULL;
char* zarr_format = NULL;
NCZ_FILE_INFO_T* zinfo = (NCZ_FILE_INFO_T*)file->format_file_info;
/* See if the V1 META-Root is being used */
switch(stat = NCZ_downloadjson(zinfo->map, NCZMETAROOT, &jnczgroup)) {
case NC_EEMPTY: /* not there */
@ -1761,7 +1765,7 @@ ncz_read_superblock(NC_FILE_INFO_T* file, char** nczarrvp, char** zarrfp)
if(jnczgroup == NULL && jsuper == NULL) {
zinfo->controls.flags |= FLAG_PUREZARR;
} else if(jnczgroup != NULL) {
zinfo->controls.flags |= FLAG_NCZARR_V1;
zinfo->controls.flags |= FLAG_NCZARR_V1;
/* Also means file is read only */
file->no_write = 1;
} else if(jsuper != NULL) {
@ -1801,7 +1805,7 @@ parse_group_content(NCjson* jcontent, NClist* dimdefs, NClist* varnames, NClist*
/* check the length */
sscanf(NCJstring(jlen),"%lld",&len);
if(len < 0)
{stat = NC_EDIMSIZE; goto done;}
{stat = NC_EDIMSIZE; goto done;}
nclistpush(dimdefs,strdup(norm_name));
nclistpush(dimdefs,strdup(NCJstring(jlen)));
}
@ -1893,7 +1897,7 @@ searchvars(NCZ_FILE_INFO_T* zfile, NC_GRP_INFO_T* grp, NClist* varnames)
char* varkey = NULL;
char* zarray = NULL;
NClist* matches = nclistnew();
/* Compute the key for the grp */
if((stat = NCZ_grpkey(grp,&grpkey))) goto done;
/* Get the map and search group */
@ -1927,7 +1931,7 @@ searchsubgrps(NCZ_FILE_INFO_T* zfile, NC_GRP_INFO_T* grp, NClist* subgrpnames)
char* subkey = NULL;
char* zgroup = NULL;
NClist* matches = nclistnew();
/* Compute the key for the grp */
if((stat = NCZ_grpkey(grp,&grpkey))) goto done;
/* Get the map and search group */
@ -2014,7 +2018,7 @@ locategroup(NC_FILE_INFO_T* file, size_t nsegs, NClist* segments, NC_GRP_INFO_T*
break;
}
}
if(!found) {stat = NC_ENOGRP; goto done;}
if(!found) {stat = NC_ENOGRP; goto done;}
}
/* grp should be group of interest */
if(grpp) *grpp = grp;
@ -2144,7 +2148,7 @@ ncz_create_superblock(NCZ_FILE_INFO_T* zinfo)
char version[1024];
ZTRACE(4,"zinfo=%s",zinfo->common.file->controller->path);
/* If V2, then do not create a superblock per-se */
if(!(zinfo->controls.flags & FLAG_NCZARR_V1)) goto done;
@ -2186,7 +2190,7 @@ computedimrefs(NC_FILE_INFO_T* file, NC_VAR_INFO_T* var, int purezarr, int xarra
NCZ_FILE_INFO_T* zfile = (NCZ_FILE_INFO_T*)file->format_file_info;
NCZ_VAR_INFO_T* zvar = (NCZ_VAR_INFO_T*)(var->format_var_info);
NCjson* jatts = NULL;
assert(zfile && zvar);
/* xarray => purezarr */

View File

@ -10,8 +10,15 @@
#include "isnan.h"
#include <math.h>
#ifndef nulldup
#define nulldup(x) ((x)?strdup(x):(x))
#endif
static char stmp[256];
void
convert1(NCConstant* src, NCConstant* dst)
{
@ -34,7 +41,7 @@ convert1(NCConstant* src, NCConstant* dst)
if(src->nctype == NC_FILLVALUE) {
if(dst->nctype != NC_FILLVALUE) {
nc_getfill(dst,NULL);
}
}
return;
}
@ -516,39 +523,39 @@ case CASE(NC_OPAQUE,NC_BYTE):
tmp.uint8v = *(unsigned char*)bytes;
break;
case CASE(NC_OPAQUE,NC_UBYTE):
if(bytes)
if(bytes)
tmp.uint8v = *(unsigned char*)bytes;
break;
case CASE(NC_OPAQUE,NC_USHORT):
if(bytes)
if(bytes)
tmp.uint16v = *(unsigned short*)bytes;
break;
case CASE(NC_OPAQUE,NC_UINT):
if(bytes)
if(bytes)
tmp.uint32v = *(unsigned int*)bytes;
break;
case CASE(NC_OPAQUE,NC_UINT64):
if(bytes)
if(bytes)
tmp.uint64v = *(unsigned long long*)bytes;
break;
case CASE(NC_OPAQUE,NC_SHORT):
if(bytes)
if(bytes)
tmp.int16v = *(short*)bytes;
break;
case CASE(NC_OPAQUE,NC_INT):
if(bytes)
if(bytes)
tmp.int32v = *(int*)bytes;
break;
case CASE(NC_OPAQUE,NC_INT64):
if(bytes)
if(bytes)
tmp.int64v = *(long long*)bytes;
break;
case CASE(NC_OPAQUE,NC_FLOAT):
if(bytes)
if(bytes)
tmp.floatv = *(float*)bytes;
break;
case CASE(NC_OPAQUE,NC_DOUBLE):
if(bytes)
if(bytes)
tmp.doublev = *(double*)bytes;
break;
case CASE(NC_OPAQUE,NC_OPAQUE):
@ -561,7 +568,7 @@ case CASE(NC_NIL,NC_NIL):
break; /* probably will never happen */
case CASE(NC_NIL,NC_STRING):
tmp.stringv.len = 0;
tmp.stringv.stringv = NULL;
tmp.stringv.stringv = NULL;
break;
/* We are missing all CASE(X,NC_ECONST) cases*/
@ -605,7 +612,7 @@ setprimlength(NCConstant* prim, unsigned long len)
/* Note that expansion/contraction is in terms of whole
bytes = 2 nibbles */
ASSERT((len % 2) == 0);
if(prim->value.opaquev.len == len) {
if(prim->value.opaquev.len == len) {
/* do nothing*/
} else if(prim->value.opaquev.len > len) { /* truncate*/
prim->value.opaquev.stringv[len] = '\0';

View File

@ -8,6 +8,10 @@
#include "config.h"
#ifndef nulldup
#define nulldup(x) ((x)?strdup(x):(x))
#endif
#ifdef USE_NETCDF4
#define CLASSICONLY 0
#else

View File

@ -12,6 +12,10 @@
#include "config.h"
#include "generic.h"
#ifndef nulldup
#define nulldup(x) ((x)?strdup(x):(x))
#endif
extern int ncid; /* handle for netCDF */
extern int ndims; /* number of dimensions declared for netcdf */
extern int nvars; /* number of variables declared for netcdf */

View File

@ -30,6 +30,10 @@
#include "ncbytes.h"
#include "zincludes.h"
#ifndef nulldup
#define nulldup(x) ((x)?strdup(x):(x))
#endif
static char* progname = NULL;
struct ITOptions {
@ -120,8 +124,8 @@ void
processoptions(int argc, char** argv, const char* base_file_name)
{
int c;
if(argc == 1) test_usage();
if(argc == 1) test_usage();
progname = nulldup(ubasename(argv[0]));
while ((c = getopt(argc, argv, "e:c:F:")) != EOF)

View File

@ -139,7 +139,7 @@ main(int argc, char **argv)
if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR;
if (nvars != NUM_TYPE || ndims != NUM_DIM || ngatts != 0 || unlimdimid == 0) ERR;
for (t = 0; t < NUM_TYPE; t++)
{
sprintf(var_name, "var_%d", type_id[t]);
@ -381,7 +381,7 @@ main(int argc, char **argv)
/* Reopen the file. */
if (nc_open(itoptions.path, NC_NOWRITE, &ncid)) ERR;
/* Close the file. */
if (nc_close(ncid)) ERR;
}

View File

@ -1,40 +0,0 @@
# blocklist
branches:
except:
# - /.*[.]dmh/
- /.*[.]wif/
sudo: required
language: c
services:
- docker
env:
matrix:
# Ubuntu
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-fsigned-char' AC_COPTS='--disable-hdf5 --disable-hdf4 --disable-dap-remote-tests --enable-cdf5 --enable-byterange' COPTS='-DENABLE_HDF5=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=TRUE -DENABLE_BYTERANGE=TRUE' USECP=FALSE CURHOST=docker-gcc-x64-signed TESTFILTER=FALSE
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-fsigned-char' AC_COPTS='--disable-hdf5 --disable-hdf4 --disable-dap-remote-tests' COPTS='-DENABLE_HDF5=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=OFF' USECP=FALSE CURHOST=docker-gcc-x86-signed TESTFILTER=FALSE
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-funsigned-char' AC_COPTS='--disable-hdf5 --disable-hdf4 --disable-dap-remote-tests --enable-cdf5' COPTS='-DENABLE_HDF5=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=TRUE' USECP=FALSE CURHOST=docker-gcc-x64-unsigned TESTFILTER=FALSE
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-funsigned-char' AC_COPTS='--disable-hdf5 --disable-hdf4 --disable-dap-remote-tests' COPTS='-DENABLE_HDF5=OFF -DENABLE_HDF4=OFF -DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=OFF' USECP=FALSE CURHOST=docker-gcc-x86-unsigned TESTFILTER=FALSE
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-fsigned-char' AC_COPTS='--disable-dap-remote-tests --enable-cdf5' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=TRUE' USECP=FALSE CURHOST=docker-gcc-x64-signed TESTFILTER=TRUE
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-fsigned-char' AC_COPTS='--disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-fsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=OFF' USECP=FALSE CURHOST=docker-gcc-x86-signed TESTFILTER=TRUE
- DOCKIMG=unidata/nctests:serial USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-funsigned-char' AC_COPTS='--disable-dap-remote-tests --enable-cdf5' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=TRUE' USECP=FALSE CURHOST=docker-gcc-x64-unsigned TESTFILTER=TRUE
- DOCKIMG=unidata/nctests:serial32 USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc CFLAGS='-funsigned-char' AC_COPTS='--disable-dap-remote-tests' COPTS='-DCMAKE_C_FLAGS=-funsigned-char -DENABLE_DAP_REMOTE_TESTS=OFF -DENABLE_CDF5=OFF' USECP=FALSE CURHOST=docker-gcc-x86-unsigned TESTFILTER=TRUE
# Centos, Fedora
- DOCKIMG=unidata/nctests:serial.centos USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='--disable-dap-remote-tests' COPTS='-DENABLE_DAP_REMOTE_TESTS=OFF' USECP=TRUE CURHOST=docker-gcc-x64-centos TESTFILTER=TRUE
- DOCKIMG=unidata/nctests:serial.fedora USECMAKE=TRUE USEAC=TRUE DISTCHECK=TRUE USE_CC=gcc AC_COPTS='--disable-dap-remote-tests' COPTS='-DENABLE_DAP_REMOTE_TESTS=OFF' USECP=TRUE CURHOST=docker-gcc-x64-fedora TESTFILTER=TRUE
before_install:
- docker pull $DOCKIMG > /dev/null
script:
- docker run --privileged --rm -it -h "$CURHOST" -e USEDASH=FALSE -e RUNF=OFF -e RUNCXX=OFF -e RUNP=OFF -e RUNNCO=OFF -e USECMAKE=$USECMAKE -e USEAC=$USEAC -e DISTCHECK=$DISTCHECK -e COPTS="$COPTS" -e AC_COPTS="$AC_COPTS" -e CTEST_OUTPUT_ON_FAILURE=1 -v $(pwd):/netcdf-c -e USE_LOCAL_CP=$USECP -e USE_CC=$USE_CC -e TESTPROC=100 -e ENABLE_FILTER_TESTING=$TESTFILTER -e ENABLE_C_MEMCHECK=OFF -e CFLAGS="$CFLAGS" $DOCKIMG