diff --git a/nczarr_test/CMakeLists.txt b/nczarr_test/CMakeLists.txt index dc66e96bba..9a877e942a 100644 --- a/nczarr_test/CMakeLists.txt +++ b/nczarr_test/CMakeLists.txt @@ -120,6 +120,12 @@ IF(ENABLE_TESTS) TARGET_INCLUDE_DIRECTORIES(tst_chunkcases PUBLIC ../libnczarr) add_sh_test(nczarr_test run_chunkcases) + if(LARGE_FILE_TESTS) + BUILD_BIN_TEST(test_readcaching}) + BUILD_BIN_TEST(test_writecaching}) + add_sh_test(nczarr_test run_cachetest) + ENDIF() + add_sh_test(nczarr_test run_purezarr) add_sh_test(nczarr_test run_interop) add_sh_test(nczarr_test run_misc) diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index f238adb98b..b605a2ab4a 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -34,9 +34,6 @@ ut_projections_SOURCES = ut_projections.c ${commonsrc} ut_chunking_SOURCES = ut_chunking.c ${commonsrc} tst_fillonlyz_SOURCES = tst_fillonlyz.c ${tstcommonsrc} -check_PROGRAMS += test_readcaching test_writecaching -TESTS += test_readcaching test_writecaching - check_PROGRAMS += tst_zchunks tst_zchunks2 tst_zchunks3 tst_fillonlyz test_quantize tst_notzarr TESTS += run_ut_chunk.sh @@ -69,6 +66,11 @@ TESTS += run_nulls.sh TESTS += run_notzarr.sh TESTS += run_external.sh +if LARGE_FILE_TESTS +check_PROGRAMS += test_writecaching test_readcaching +TESTS += run_cachetest.sh +endif + endif #BUILD_UTILITIES if BUILD_UTILITIES diff --git a/nczarr_test/test_readcaching.c b/nczarr_test/test_readcaching.c index ecfca615f1..29002b283e 100644 --- a/nczarr_test/test_readcaching.c +++ b/nczarr_test/test_readcaching.c @@ -1,8 +1,5 @@ -#include "netcdf.h" - #include #include - #include #include @@ -10,6 +7,15 @@ #include #endif +#include "netcdf.h" + +#define filename "file://tmp_cachetest.zarr#mode=zarr,file" +#define chunkSize (size_t)(1<<17) /* 128k */ +#define numCells (size_t)(50 * chunkSize) +#define numSteps (size_t)360 + +static float var[numCells]; + size_t getPeakRSS(void) { struct rusage rusage; @@ -34,11 +40,6 @@ nce(int istat) int main(void) { - const char *filename = "file://tmp_readcaching.zarr#mode=zarr,file"; - const size_t chunkSize = 262144; // 256k - const size_t numCells = 50 * chunkSize; - const size_t numSteps = 360; - printf("read: chunkSize=%zu, numCells=%zu, numSteps=%zu, filename=%s\n", chunkSize, numCells, numSteps, filename); int ncId; @@ -58,7 +59,6 @@ main(void) printf("set chunk cache: size=%zu, nelems=%zu, preemption=%g\n", size, nelems, preemption); { - float* var = calloc(sizeof(float),numCells); for (size_t i = 0; i < numCells; ++i) var[i] = 0.0f; for (size_t i = 0; i < numSteps; ++i) { diff --git a/nczarr_test/test_writecaching.c b/nczarr_test/test_writecaching.c index c2b9293332..a1d6b3e8b0 100644 --- a/nczarr_test/test_writecaching.c +++ b/nczarr_test/test_writecaching.c @@ -1,15 +1,20 @@ -#include "netcdf.h" - #include #include - #include #include - #if defined(__APPLE__) && defined(__MACH__) #include #endif +#include "netcdf.h" + +#define filename "file://tmp_cachetest.zarr#mode=zarr,file" +#define chunkSize ((size_t)(1<<17)) /* 128k */ +#define numCells ((size_t)(50 * chunkSize)) +#define numSteps ((size_t)360) + +static float var[numCells]; + size_t getPeakRSS(void) { struct rusage rusage; @@ -34,11 +39,6 @@ nce(int istat) int main(void) { - const char *filename = "file://tmp_writecaching.zarr#mode=zarr,file"; - const size_t chunkSize = 262144; // 256k - const size_t numCells = 50 * chunkSize; - const size_t numSteps = 360; - printf("write: chunkSize=%zu, numCells=%zu, numSteps=%zu, filename=%s\n", chunkSize, numCells, numSteps, filename); int ncId; @@ -72,7 +72,6 @@ main(void) nce(nc_enddef(ncId)); { - float* var = calloc(sizeof(float),numCells); for (size_t i = 0; i < numCells; ++i) var[i] = 0.0f; for (size_t i = 0; i < numSteps; ++i) { @@ -92,7 +91,7 @@ main(void) printf("*** Failed: used: %luMB expected: < 100MB\n",mbused); return (1); } else { - printf("*** Passed: used: %luMB (< 100MB\)n",mbused); + printf("*** Passed: used: %luMB (< 100MB)\n",mbused); return 0; } }