Test reusing iodescs across reads
Adding tests to make sure that we can reuse iodesc across
multiple reads and writes+reads. Also verifying that we
get the expected values after the reads.
@@ -99,7 +99,7 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_1d_reuse_decomp
character(len=PIO_TF_MAX_STR_LEN) :: filename1, filename2
type(io_desc_t) :: iodesc
integer, dimension(VEC_LOCAL_SZ) :: compdof, compdof_rel_disps
- PIO_TF_FC_DATA_TYPE, dimension(VEC_LOCAL_SZ) :: buf
+ PIO_TF_FC_DATA_TYPE, dimension(VEC_LOCAL_SZ) :: buf, rbuf
integer, dimension(1) :: dims
integer :: pio_dim_file1, pio_dim_file2
integer :: i, ierr, lsz
@@ -166,7 +166,25 @@ PIO_TF_AUTO_TEST_SUB_BEGIN nc_write_1d_reuse_decomp
call PIO_write_darray(pio_file2, pio_var1_file2, iodesc, buf, ierr)
PIO_TF_CHECK_ERR(ierr, "Failed to write first darray : " // trim(filename2))
- ! FIXME: Verify the written output
+ call PIO_syncfile(pio_file1)
+ rbuf = 0
+ call PIO_read_darray(pio_file1, pio_var1_file1, iodesc, rbuf, ierr)
+ PIO_TF_CHECK_ERR(ierr, "Failed to read first darray : " // trim(filename1))
+
+ PIO_TF_CHECK_VAL((rbuf, buf), "Got wrong val")
+
+ rbuf = 0
+ call PIO_read_darray(pio_file1, pio_var2_file1, iodesc, rbuf, ierr)
+ PIO_TF_CHECK_ERR(ierr, "Failed to read second darray : " // trim(filename1))
+
+ PIO_TF_CHECK_VAL((rbuf, buf), "Got wrong val")
+
+ call PIO_syncfile(pio_file2)
+ rbuf = 0
+ call PIO_read_darray(pio_file2, pio_var1_file2, iodesc, rbuf, ierr)
+ PIO_TF_CHECK_ERR(ierr, "Failed to read first darray : " // trim(filename2))
+
+ PIO_TF_CHECK_VAL((rbuf, buf), "Got wrong val")
call PIO_closefile(pio_file1)
call PIO_closefile(pio_file2)
