From 2bb3d688ae36b317e1a08cb6c87d71797ba969eb Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 28 Jul 2016 16:05:36 +0200 Subject: [PATCH] test/h5{b,u}_{read,write}.c - fixes for serial version - h5u_test_write4(): bugfix: we have to write new attributes since we are in append-only mode --- test/h5b_read.c | 6 +++--- test/h5b_write.c | 6 +++--- test/h5u_read.c | 14 +++++++------- test/h5u_write.c | 30 +++++++++++++++++++----------- 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/test/h5b_read.c b/test/h5b_read.c index 090927b..92ecdb6 100644 --- a/test/h5b_read.c +++ b/test/h5b_read.c @@ -235,17 +235,17 @@ test_read_data32(h5_file_t file, int step) void h5b_test_read1(void) { h5_file_t file1; - h5_err_t status; - MPI_Comm comm = MPI_COMM_WORLD; TEST("Opening file once, read-only"); h5_prop_t props = H5CreateFileProp (); +#if defined(PARALLEL_IO) + MPI_Comm comm = MPI_COMM_WORLD; status = H5SetPropFileMPIOCollective (props, &comm); RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOCollective"); status = H5SetPropFileThrottle (props, 2); RETURN(status, H5_SUCCESS, "H5SetPropFileThrottle"); - +#endif file1 = H5OpenFile(FILENAME, H5_O_RDONLY, props); status = H5CheckFile(file1); RETURN(status, H5_SUCCESS, "H5CheckFile"); diff --git a/test/h5b_write.c b/test/h5b_write.c index 294a503..faa522d 100644 --- a/test/h5b_write.c +++ b/test/h5b_write.c @@ -177,17 +177,17 @@ test_write_data32(h5_file_t file, int step) void h5b_test_write1(void) { h5_file_t file1; - h5_err_t status; - MPI_Comm comm = MPI_COMM_WORLD; TEST("Opening file once, write-truncate"); h5_prop_t props = H5CreateFileProp (); +#if defined (PARALLEL_IO) + MPI_Comm comm = MPI_COMM_WORLD; status = H5SetPropFileMPIOCollective (props, &comm); RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOCollective"); status = H5SetPropFileThrottle (props, 2); RETURN(status, H5_SUCCESS, "H5SetPropFileThrottle"); - +#endif file1 = H5OpenFile(FILENAME, H5_O_WRONLY, props); status = H5CheckFile(file1); RETURN(status, H5_SUCCESS, "H5CheckFile"); diff --git a/test/h5u_read.c b/test/h5u_read.c index 505ab02..6a121dd 100644 --- a/test/h5u_read.c +++ b/test/h5u_read.c @@ -475,15 +475,15 @@ void h5u_test_read2(void) void h5u_test_read3(void) { h5_file_t file1; - h5_int64_t status; - MPI_Comm comm = MPI_COMM_WORLD; - + TEST("Opening file once, read-only, MPI-POSIX VFD"); h5_prop_t props = H5CreateFileProp (); +#if defined(PARALLEL_IO) + MPI_Comm comm = MPI_COMM_WORLD; status = H5SetPropFileMPIOPosix (props, &comm); RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOPosix"); - +#endif file1 = H5OpenFile(FILENAME, H5_O_RDONLY, props); status = H5CheckFile(file1); RETURN(status, H5_SUCCESS, "H5CheckFile"); @@ -504,15 +504,15 @@ void h5u_test_read4(void) { h5_file_t file1; h5_file_t file2; - h5_err_t status; - MPI_Comm comm = MPI_COMM_WORLD; TEST("Opening file twice, read-only, MPI-IO Independent VFD"); h5_prop_t props = H5CreateFileProp (); +#if defined(PARALLEL_IO) + MPI_Comm comm = MPI_COMM_WORLD; status = H5SetPropFileMPIOIndependent (props, &comm); RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOIndependent"); - +#endif file1 = H5OpenFile(FILENAME, H5_O_RDONLY, props); status = H5CheckFile(file1); RETURN(status, H5_SUCCESS, "H5CheckFile"); diff --git a/test/h5u_write.c b/test/h5u_write.c index 48ab8b7..e9d4f61 100644 --- a/test/h5u_write.c +++ b/test/h5u_write.c @@ -41,7 +41,7 @@ test_write_step_attribs(h5_file_t file, int position) h5_err_t status; char name[ATTR_NAME_SIZE]; - TEST("Writing file attributes"); + TEST("Writing step attributes"); get_attr_name(name, "str", position); status = H5WriteStepAttribString(file, name, ATTR_STR_VAL); @@ -354,13 +354,15 @@ void h5u_test_write1(void) { h5_file_t file1; h5_err_t status; - MPI_Comm comm = MPI_COMM_WORLD; TEST("Opening file once, write-truncate"); h5_prop_t props = H5CreateFileProp (); + +#if defined(PARALLEL_IO) + MPI_Comm comm = MPI_COMM_WORLD; status = H5SetPropFileMPIOCollective (props, &comm); RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOCollective"); - +#endif file1 = H5OpenFile(FILENAME, H5_O_WRONLY, props); status = H5CheckFile(file1); RETURN(status, H5_SUCCESS, "H5CheckFile"); @@ -380,13 +382,15 @@ void h5u_test_write2(void) h5_file_t file1; h5_file_t file2; h5_err_t status; - MPI_Comm comm = MPI_COMM_WORLD; TEST("Opening file twice, write-append + read-only"); h5_prop_t props = H5CreateFileProp (); + +#if defined(PARALLEL_IO) + MPI_Comm comm = MPI_COMM_WORLD; status = H5SetPropFileMPIOCollective (props, &comm); RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOCollective"); - +#endif file1 = H5OpenFile(FILENAME, H5_O_APPENDONLY, props); status = H5CheckFile(file1); RETURN(status, H5_SUCCESS, "H5CheckFile"); @@ -411,15 +415,17 @@ void h5u_test_write2(void) void h5u_test_write3(void) { h5_file_t file1; - h5_err_t status; - MPI_Comm comm = MPI_COMM_WORLD; TEST("Opening file once, write-truncate, MPI-POSIX VFD"); + h5_prop_t props = H5CreateFileProp (); + +#if defined(PARALLEL_IO) + MPI_Comm comm = MPI_COMM_WORLD; status = H5SetPropFileMPIOPosix (props, &comm); RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOPosix"); - +#endif file1 = H5OpenFile(FILENAME, H5_O_WRONLY, props); status = H5CheckFile(file1); @@ -447,13 +453,15 @@ void h5u_test_write4(void) h5_err_t status; h5_prop_t props; - MPI_Comm comm = MPI_COMM_WORLD; TEST("Opening file twice, write-append + read-only, MPI-IO Independent VFD"); + props = H5CreateFileProp (); +#if defined(PARALLEL_IO) + MPI_Comm comm = MPI_COMM_WORLD; status = H5SetPropFileMPIOIndependent (props, &comm); RETURN(status, H5_SUCCESS, "H5SetPropFileMPIOIndependent"); - +#endif file1 = H5OpenFile(FILENAME, H5_O_APPENDONLY, props); status = H5CheckFile(file1); RETURN(status, H5_SUCCESS, "H5CheckFile"); @@ -476,7 +484,7 @@ void h5u_test_write4(void) RETURN(status, H5_SUCCESS, "H5PartSetChunk"); test_write_data64(file1, NPARTICLES, NTIMESTEPS-2); - test_write_file_attribs(file1, 1); + test_write_file_attribs(file1, 2); status = H5CloseFile(file1); RETURN(status, H5_SUCCESS, "H5CloseFile");