mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
f6e25b695e
re: https://github.com/Unidata/netcdf-c/issues/2117 re: https://github.com/Unidata/netcdf-c/issues/2119 * Modify libsrc to allow byte-range reading of netcdf-3 files in private S3 buckets; this required using the aws sdk. Also add a test case. * The aws sdk can sometimes cause problems if the Awd::ShutdownAPI function is not called. So at optional atexit() support to ensure it is called. This is disabled for Windows. * Add documentation to nczarr.md on how to build and use the aws sdk under windows. Currently it builds, but testing fails. * Switch testing from stratus to the Unidata bucket on S3. * Improve support for the s3: url protocol. * Add a s3 specific utility code file: ds3util.c * Modify NC_infermodel to attempt to read the magic number of byte-ranged files in S3. ## Misc. * Move and rename the core S3 SDK wrapper code (libnczarr/zs3sdk.cpp) to libdispatch since it now used in libsrc as well as libnczarr. * Add calls to nc_finalize in the utilities in case atexit is disabled. * Add header only json parser to the distribution rather than as a built source.
79 lines
1.8 KiB
C
79 lines
1.8 KiB
C
/*
|
|
* Copyright 2018, University Corporation for Atmospheric Research
|
|
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
|
*/
|
|
|
|
#ifndef ZTEST_H
|
|
#define ZTEST_H
|
|
|
|
#include "nclist.h"
|
|
|
|
typedef struct Dimdef {
|
|
char* name;
|
|
size64_t size;
|
|
} Dimdef;
|
|
|
|
typedef struct Vardef {
|
|
char* name;
|
|
nc_type typeid;
|
|
size_t typesize;
|
|
int rank;
|
|
Dimdef* dimrefs[NC_MAX_VAR_DIMS];
|
|
size64_t dimsizes[NC_MAX_VAR_DIMS];
|
|
size64_t chunksizes[NC_MAX_VAR_DIMS];
|
|
} Vardef;
|
|
|
|
/* Expose functions for unit tests */
|
|
typedef struct NCZ_UT_PRINTER {
|
|
int printsort;
|
|
void (*printer)(struct NCZ_UT_PRINTER*);
|
|
/* Union of all fields */
|
|
int rank;
|
|
size64_t count;
|
|
size64_t offset;
|
|
size64_t* indices;
|
|
size64_t* vector;
|
|
void** pvector;
|
|
NCZOdometer* odom;
|
|
void* output;
|
|
size_t used;
|
|
} NCZ_UT_PRINTER;
|
|
|
|
/* Arguments from command line */
|
|
struct UTOptions {
|
|
int debug;
|
|
char** cmds;
|
|
char* file;
|
|
char* output;
|
|
char* kind;
|
|
char* profile;
|
|
NCZChunkRange ranges[NC_MAX_VAR_DIMS];
|
|
int nslices;
|
|
NCZSlice slices[NC_MAX_VAR_DIMS];
|
|
NClist* dimdefs; /*List<struct Dimdef*> */
|
|
NClist* vardefs; /*List<struct Vardef*> */
|
|
size_t idatalen;
|
|
int* idata;
|
|
};
|
|
|
|
struct Test {
|
|
char* cmd;
|
|
int (*test)(void);
|
|
};
|
|
|
|
extern struct UTOptions utoptions;
|
|
|
|
#define NCCHECK(expr) nccheck((expr),__LINE__)
|
|
|
|
extern void usage(int err);
|
|
extern int ut_init(int argc, char** argv, struct UTOptions* test);
|
|
extern void ut_final(void);
|
|
|
|
extern void nccheck(int stat, int line);
|
|
extern char* makeurl(const char* file, NCZM_IMPL, struct UTOptions*);
|
|
//extern int setup(int argc, char** argv);
|
|
extern struct Test* findtest(const char* cmd, struct Test* tests);
|
|
extern int runtests(const char** cmds, struct Test* tests);
|
|
|
|
#endif /*ZTEST_H*/
|